Blender V2.61 - r43446
|
00001 /* 00002 * Adapted from Open Shading Language with this license: 00003 * 00004 * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. 00005 * All Rights Reserved. 00006 * 00007 * Modifications Copyright 2011, Blender Foundation. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions are 00011 * met: 00012 * * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the distribution. 00017 * * Neither the name of Sony Pictures Imageworks nor the names of its 00018 * contributors may be used to endorse or promote products derived from 00019 * this software without specific prior written permission. 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00023 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00024 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 #ifndef __OSL_CLOSURES_H__ 00034 #define __OSL_CLOSURES_H__ 00035 00036 #include <OSL/oslclosure.h> 00037 #include <OSL/oslexec.h> 00038 #include <OSL/genclosure.h> 00039 00040 CCL_NAMESPACE_BEGIN 00041 00042 enum { 00043 OSL_CLOSURE_BSDF_DIFFUSE_ID, 00044 OSL_CLOSURE_BSDF_OREN_NAYAR_ID, 00045 OSL_CLOSURE_BSDF_TRANSLUCENT_ID, 00046 OSL_CLOSURE_BSDF_REFLECTION_ID, 00047 OSL_CLOSURE_BSDF_REFRACTION_ID, 00048 OSL_CLOSURE_BSDF_TRANSPARENT_ID, 00049 OSL_CLOSURE_BSDF_MICROFACET_GGX_ID, 00050 OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, 00051 OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID, 00052 OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, 00053 OSL_CLOSURE_BSDF_WARD_ID, 00054 OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, 00055 OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID, 00056 OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID, 00057 OSL_CLOSURE_BSSRDF_CUBIC_ID, 00058 OSL_CLOSURE_EMISSION_ID, 00059 OSL_CLOSURE_DEBUG_ID, 00060 OSL_CLOSURE_BACKGROUND_ID, 00061 OSL_CLOSURE_HOLDOUT_ID, 00062 OSL_CLOSURE_SUBSURFACE_ID 00063 }; 00064 00065 extern OSL::ClosureParam bsdf_diffuse_params[]; 00066 extern OSL::ClosureParam bsdf_oren_nayar_params[]; 00067 extern OSL::ClosureParam bsdf_translucent_params[]; 00068 extern OSL::ClosureParam bsdf_reflection_params[]; 00069 extern OSL::ClosureParam bsdf_refraction_params[]; 00070 extern OSL::ClosureParam bsdf_transparent_params[]; 00071 extern OSL::ClosureParam bsdf_microfacet_ggx_params[]; 00072 extern OSL::ClosureParam bsdf_microfacet_ggx_refraction_params[]; 00073 extern OSL::ClosureParam bsdf_microfacet_beckmann_params[]; 00074 extern OSL::ClosureParam bsdf_microfacet_beckmann_refraction_params[]; 00075 extern OSL::ClosureParam bsdf_ward_params[]; 00076 extern OSL::ClosureParam bsdf_ashikhmin_velvet_params[]; 00077 extern OSL::ClosureParam bsdf_westin_backscatter_params[]; 00078 extern OSL::ClosureParam bsdf_westin_sheen_params[]; 00079 extern OSL::ClosureParam closure_bssrdf_cubic_params[]; 00080 extern OSL::ClosureParam closure_emission_params[]; 00081 extern OSL::ClosureParam closure_debug_params[]; 00082 extern OSL::ClosureParam closure_background_params[]; 00083 extern OSL::ClosureParam closure_holdout_params[]; 00084 extern OSL::ClosureParam closure_subsurface_params[]; 00085 00086 void bsdf_diffuse_prepare(OSL::RendererServices *, int id, void *data); 00087 void bsdf_oren_nayar_prepare(OSL::RendererServices *, int id, void *data); 00088 void bsdf_translucent_prepare(OSL::RendererServices *, int id, void *data); 00089 void bsdf_reflection_prepare(OSL::RendererServices *, int id, void *data); 00090 void bsdf_refraction_prepare(OSL::RendererServices *, int id, void *data); 00091 void bsdf_transparent_prepare(OSL::RendererServices *, int id, void *data); 00092 void bsdf_microfacet_ggx_prepare(OSL::RendererServices *, int id, void *data); 00093 void bsdf_microfacet_ggx_refraction_prepare(OSL::RendererServices *, int id, void *data); 00094 void bsdf_microfacet_beckmann_prepare(OSL::RendererServices *, int id, void *data); 00095 void bsdf_microfacet_beckmann_refraction_prepare(OSL::RendererServices *, int id, void *data); 00096 void bsdf_ward_prepare(OSL::RendererServices *, int id, void *data); 00097 void bsdf_ashikhmin_velvet_prepare(OSL::RendererServices *, int id, void *data); 00098 void bsdf_westin_backscatter_prepare(OSL::RendererServices *, int id, void *data); 00099 void bsdf_westin_sheen_prepare(OSL::RendererServices *, int id, void *data); 00100 void closure_bssrdf_cubic_prepare(OSL::RendererServices *, int id, void *data); 00101 void closure_emission_prepare(OSL::RendererServices *, int id, void *data); 00102 void closure_debug_prepare(OSL::RendererServices *, int id, void *data); 00103 void closure_background_prepare(OSL::RendererServices *, int id, void *data); 00104 void closure_holdout_prepare(OSL::RendererServices *, int id, void *data); 00105 void closure_subsurface_prepare(OSL::RendererServices *, int id, void *data); 00106 00107 #define CLOSURE_PREPARE(name, classname) \ 00108 void name(RendererServices *, int id, void *data) \ 00109 { \ 00110 memset(data, 0, sizeof(classname)); \ 00111 new (data) classname(); \ 00112 } 00113 00114 CCL_NAMESPACE_END 00115 00116 #endif /* __OSL_CLOSURES_H__ */ 00117