shader_bsdf.h

00001 /******************************************************************************
00002  * Copyright 1986-2008 by mental images GmbH, Fasanenstr. 81, D-10623 Berlin
00003  * All rights reserved.
00004  ******************************************************************************
00005  * Author:      daniel  
00006  * Created:     25.04.2008
00007  * Purpose:     BSDF interface for mental ray
00008  *
00009  * Note: This file is generated automatically from the mental ray sources, do
00010  * not edit. Some definitions exist for internal reasons and are subject to
00011  * change between mental ray versions. See the mental ray user's manual for
00012  * a definitive description of the shader interface. Avoid using features not
00013  * documented in the manual because they may change in future versions.
00014  *****************************************************************************/
00015 
00016 #ifndef SHADER_BSDF_H
00017 #define SHADER_BSDF_H
00018 
00019 
00020 /*------------ brdf.h ------------*/
00021 
00022 
00023 namespace mi {
00024 namespace shader_v3 {
00025 
00026 
00066 class Bsdf
00067 {
00068 public:
00070     
00072     typedef bool Transport;
00073     static const Transport From_eye     = false;  
00074     static const Transport From_light   = true;   
00075 
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 
00192     virtual Type sample(
00193             const miVector&     ray,
00194             miVector*           out,
00195             miColor*            weight,
00196             double              xi[3],
00197             Type                flags = All,
00198             Transport           dir = From_eye
00199             ) const = 0;
00200     
00201     
00212     virtual bool all_components(Type type) const = 0;
00213     
00214     
00225     virtual bool any_component(Type type) const = 0;
00226 };
00227 
00228 
00229 
00233 class Access_bsdf
00234 {
00235 public:
00236     
00245     Access_bsdf(miState* state)
00246     : m_state(state)
00247     {
00248         m_bsdf = Interface_access()->allocBsdf(state);
00249     }
00250 
00251     
00255     ~Access_bsdf()
00256     {
00257         Interface_access()->releaseBsdf(m_bsdf,m_state);
00258     }
00259     
00260     
00262     const Bsdf* operator->() const { return m_bsdf; }
00263     
00264     
00269     bool valid() const { return 0 != m_bsdf; }
00270     
00271 private:
00272     Access_bsdf(const Access_bsdf&);
00273     Access_bsdf& operator=(const Access_bsdf&);
00274     
00275     miState*    m_state;
00276     Bsdf*       m_bsdf;
00277 };
00278 
00279 }}
00280 
00281 
00282 #endif

Copyright © 1986-2008 by mental images GmbH