shader_bsdf.h
00001 /******************************************************************************
00002  * Copyright 1986, 2015 NVIDIA ARC GmbH. All rights reserved.
00003  ******************************************************************************
00004  * Created:     14.06.2013
00005  * Purpose:     BSDF interface for mental ray
00006  *
00007  * Note: This file is generated automatically from the mental ray sources, do
00008  * not edit. Some definitions exist for internal reasons and are subject to
00009  * change between mental ray versions. See the mental ray user's manual for
00010  * a definitive description of the shader interface. Avoid using features not
00011  * documented in the manual because they may change in future versions.
00012  *****************************************************************************/
00013 
00014 #ifndef SHADER_BSDF_H
00015 #define SHADER_BSDF_H
00016 
00017 
00018 /*------------ brdf.h ------------*/
00019 
00020 
00021 namespace mi {
00022 namespace shader_v3 {
00023 
00024 
00067 class Bsdf
00068 {
00069 public:
00070     // no virtual dtor
00071 
00073     typedef bool Transport;
00074     static const Transport From_eye     = false;  
00075     static const Transport From_light   = true;   
00076 
00081     enum {
00082         // single types
00083         Invalid           = 0x00, 
00084         Reflect_diffuse   = 0x01, 
00085         Reflect_glossy    = 0x02, 
00086         Reflect_specular  = 0x04, 
00087         Transmit_diffuse  = 0x10, 
00088         Transmit_glossy   = 0x20, 
00089         Transmit_specular = 0x40, 
00090         
00091         // compound types
00092         Reflect_regular           
00093         = Reflect_diffuse
00094         | Reflect_glossy,
00095         Transmit_regular          
00096         = Transmit_diffuse
00097         | Transmit_glossy,
00098         All_diffuse               
00099         = Reflect_diffuse 
00100         | Transmit_diffuse,
00101         All_glossy                
00102         = Reflect_glossy 
00103         | Transmit_glossy,
00104         All_specular              
00105         = Reflect_specular 
00106         | Transmit_specular,
00107         All_regular               
00108         = Reflect_regular 
00109         | Transmit_regular,
00110         All_reflect               
00111         = Reflect_regular 
00112         | Reflect_specular,
00113         All_transmit              
00114         = Transmit_regular 
00115         | Transmit_specular,
00116         All                       
00117         = All_reflect 
00118         | All_transmit
00119     };
00120     typedef miUint4 Type;
00121 
00122     
00142     virtual miColor eval(
00143             const miVector&     ray,
00144             const miVector&     out,
00145             Type                flags = All,
00146             Transport           dir = From_eye
00147             ) const = 0;
00148     
00149 
00183     virtual Type sample(
00184             const miVector&     ray,
00185             miVector*           out,
00186             miColor*            weight,
00187             double              xi[3],
00188             Type                flags = All,
00189             Transport           dir = From_eye
00190             ) const = 0;
00191     
00202     virtual bool all_components(Type type) const = 0;
00203 
00204 
00215     virtual bool any_component(Type type) const = 0;
00216     
00217     
00226     virtual Type get_components() const = 0;
00227 };
00228 
00232 class Access_bsdf
00233 {
00234 public:
00235     
00244     Access_bsdf(miState* state)
00245     : m_state(state)
00246     {
00247         m_bsdf = Access_interface()->allocBsdf(state);
00248     }
00249 
00250     
00255     Access_bsdf()
00256     : m_state(0), m_bsdf(0)
00257     {}
00258     
00259     
00263     ~Access_bsdf()
00264     {
00265         Access_interface()->releaseBsdf(m_bsdf,m_state);
00266     }
00267     
00268     
00270     const Bsdf* operator->() const { return m_bsdf; }
00271     
00272     
00277     bool valid() const { return 0 != m_bsdf; }
00278 
00279 
00285     void reset(miState* state = 0)
00286     {
00287         Access_interface()->releaseBsdf(m_bsdf,m_state);
00288         m_state = state;
00289         m_bsdf = state ? Access_interface()->allocBsdf(state) : 0;
00290     }
00291 
00292 
00293 private:
00294     Access_bsdf(const Access_bsdf&);
00295     Access_bsdf& operator=(const Access_bsdf&);
00296     
00297     miState*    m_state;
00298     Bsdf*       m_bsdf;
00299 };
00300 
00301 }}
00302 
00303 
00304 #endif

Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.