Blender V2.61 - r43446

svm_types.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2011, Blender Foundation.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef __SVM_TYPES_H__
00020 #define __SVM_TYPES_H__
00021 
00022 CCL_NAMESPACE_BEGIN
00023 
00024 /* Stack */
00025 
00026 /* SVM stack has a fixed size */
00027 #define SVM_STACK_SIZE 64
00028 /* SVM stack offsets with this value indicate that it's not on the stack */
00029 #define SVM_STACK_INVALID 255 
00030 
00031 /* Nodes */
00032 
00033 /* note that we do not simply use 0, 1, 2, .. as values for these. this works
00034  * around an obscure CUDA bug that happens when compiling for fermi. why it
00035  * happens i have no idea, but consecutive values are problematic, maybe it
00036  * generates an incorrect jump table. */
00037 
00038 typedef enum NodeType {
00039     NODE_END = 0,
00040     NODE_CLOSURE_BSDF = 100,
00041     NODE_CLOSURE_EMISSION = 200,
00042     NODE_CLOSURE_BACKGROUND = 300,
00043     NODE_CLOSURE_SET_WEIGHT = 400,
00044     NODE_CLOSURE_WEIGHT = 500,
00045     NODE_MIX_CLOSURE = 600,
00046     NODE_JUMP = 700,
00047     NODE_TEX_IMAGE = 1000,
00048     NODE_TEX_SKY = 1100,
00049     NODE_GEOMETRY = 1200,
00050     NODE_LIGHT_PATH = 1300,
00051     NODE_VALUE_F = 1400,
00052     NODE_VALUE_V = 1500,
00053     NODE_MIX = 1600,
00054     NODE_ATTR = 1700,
00055     NODE_CONVERT = 1900,
00056     NODE_FRESNEL = 2000,
00057     NODE_EMISSION_WEIGHT = 2100,
00058     NODE_TEX_GRADIENT = 2200,
00059     NODE_TEX_VORONOI = 2300,
00060     NODE_TEX_MUSGRAVE = 2400,
00061     NODE_TEX_WAVE = 2500,
00062     NODE_TEX_MAGIC = 2600,
00063     NODE_TEX_NOISE = 3000,
00064     NODE_SHADER_JUMP = 3100,
00065     NODE_SET_DISPLACEMENT = 3200,
00066     NODE_GEOMETRY_BUMP_DX = 3300,
00067     NODE_GEOMETRY_BUMP_DY = 3400,
00068     NODE_SET_BUMP = 3500,
00069     NODE_MATH = 3600,
00070     NODE_VECTOR_MATH = 3700,
00071     NODE_MAPPING = 3800,
00072     NODE_TEX_COORD = 3900,
00073     NODE_TEX_COORD_BUMP_DX = 4000,
00074     NODE_TEX_COORD_BUMP_DY = 4100,
00075     NODE_ADD_CLOSURE = 4200,
00076     NODE_EMISSION_SET_WEIGHT_TOTAL = 4300,
00077     NODE_ATTR_BUMP_DX = 4400,
00078     NODE_ATTR_BUMP_DY = 4500,
00079     NODE_TEX_ENVIRONMENT = 4600,
00080     NODE_CLOSURE_HOLDOUT = 4700,
00081     NODE_LAYER_WEIGHT = 4800,
00082     NODE_CLOSURE_VOLUME = 4900,
00083     NODE_SEPARATE_RGB = 5000,
00084     NODE_COMBINE_RGB = 5100,
00085     NODE_HSV = 5200,
00086     NODE_CAMERA = 5300,
00087     NODE_INVERT = 5400,
00088     NODE_NORMAL = 5500,
00089     NODE_GAMMA = 5600,
00090     NODE_TEX_CHECKER = 5700
00091 } NodeType;
00092 
00093 typedef enum NodeAttributeType {
00094     NODE_ATTR_FLOAT = 0,
00095     NODE_ATTR_FLOAT3
00096 } NodeAttributeType;
00097 
00098 typedef enum NodeGeometry {
00099     NODE_GEOM_P = 0,
00100     NODE_GEOM_N,
00101     NODE_GEOM_T,
00102     NODE_GEOM_I,
00103     NODE_GEOM_Ng,
00104     NODE_GEOM_uv
00105 } NodeGeometry;
00106 
00107 typedef enum NodeLightPath {
00108     NODE_LP_camera = 0,
00109     NODE_LP_shadow,
00110     NODE_LP_diffuse,
00111     NODE_LP_glossy,
00112     NODE_LP_singular,
00113     NODE_LP_reflection,
00114     NODE_LP_transmission,
00115     NODE_LP_backfacing
00116 } NodeLightPath;
00117 
00118 typedef enum NodeTexCoord {
00119     NODE_TEXCO_OBJECT,
00120     NODE_TEXCO_CAMERA,
00121     NODE_TEXCO_WINDOW,
00122     NODE_TEXCO_REFLECTION
00123 } NodeTexCoord;
00124 
00125 typedef enum NodeMix {
00126     NODE_MIX_BLEND = 0,
00127     NODE_MIX_ADD,
00128     NODE_MIX_MUL,
00129     NODE_MIX_SUB,
00130     NODE_MIX_SCREEN,
00131     NODE_MIX_DIV,
00132     NODE_MIX_DIFF,
00133     NODE_MIX_DARK,
00134     NODE_MIX_LIGHT,
00135     NODE_MIX_OVERLAY,
00136     NODE_MIX_DODGE,
00137     NODE_MIX_BURN,
00138     NODE_MIX_HUE,
00139     NODE_MIX_SAT,
00140     NODE_MIX_VAL,
00141     NODE_MIX_COLOR,
00142     NODE_MIX_SOFT,
00143     NODE_MIX_LINEAR
00144 } NodeMix;
00145 
00146 typedef enum NodeMath {
00147     NODE_MATH_ADD,
00148     NODE_MATH_SUBTRACT,
00149     NODE_MATH_MULTIPLY,
00150     NODE_MATH_DIVIDE,
00151     NODE_MATH_SINE,
00152     NODE_MATH_COSINE,
00153     NODE_MATH_TANGENT,
00154     NODE_MATH_ARCSINE,
00155     NODE_MATH_ARCCOSINE,
00156     NODE_MATH_ARCTANGENT,
00157     NODE_MATH_POWER,
00158     NODE_MATH_LOGARITHM,
00159     NODE_MATH_MINIMUM,
00160     NODE_MATH_MAXIMUM,
00161     NODE_MATH_ROUND,
00162     NODE_MATH_LESS_THAN,
00163     NODE_MATH_GREATER_THAN
00164 } NodeMath;
00165 
00166 typedef enum NodeVectorMath {
00167     NODE_VECTOR_MATH_ADD,
00168     NODE_VECTOR_MATH_SUBTRACT,
00169     NODE_VECTOR_MATH_AVERAGE,
00170     NODE_VECTOR_MATH_DOT_PRODUCT,
00171     NODE_VECTOR_MATH_CROSS_PRODUCT,
00172     NODE_VECTOR_MATH_NORMALIZE
00173 } NodeVectorMath;
00174 
00175 typedef enum NodeConvert {
00176     NODE_CONVERT_FV,
00177     NODE_CONVERT_CF,
00178     NODE_CONVERT_VF
00179 } NodeConvert;
00180 
00181 typedef enum NodeDistanceMetric {
00182     NODE_VORONOI_DISTANCE_SQUARED,
00183     NODE_VORONOI_ACTUAL_DISTANCE,
00184     NODE_VORONOI_MANHATTAN,
00185     NODE_VORONOI_CHEBYCHEV,
00186     NODE_VORONOI_MINKOVSKY_H,
00187     NODE_VORONOI_MINKOVSKY_4,
00188     NODE_VORONOI_MINKOVSKY
00189 } NodeDistanceMetric;
00190 
00191 typedef enum NodeNoiseBasis {
00192     NODE_NOISE_PERLIN,
00193     NODE_NOISE_VORONOI_F1,
00194     NODE_NOISE_VORONOI_F2,
00195     NODE_NOISE_VORONOI_F3,
00196     NODE_NOISE_VORONOI_F4,
00197     NODE_NOISE_VORONOI_F2_F1,
00198     NODE_NOISE_VORONOI_CRACKLE,
00199     NODE_NOISE_CELL_NOISE
00200 } NodeNoiseBasis;
00201 
00202 typedef enum NodeWaveType {
00203     NODE_WAVE_SINE,
00204     NODE_WAVE_SAW,
00205     NODE_WAVE_TRI
00206 } NodeWaveType;
00207 
00208 typedef enum NodeMusgraveType {
00209     NODE_MUSGRAVE_MULTIFRACTAL,
00210     NODE_MUSGRAVE_FBM,
00211     NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
00212     NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
00213     NODE_MUSGRAVE_HETERO_TERRAIN
00214 } NodeMusgraveType;
00215 
00216 typedef enum NodeWoodType {
00217     NODE_WAVE_BANDS,
00218     NODE_WAVE_RINGS
00219 } NodeWoodType;
00220 
00221 typedef enum NodeBlendType {
00222     NODE_BLEND_LINEAR,
00223     NODE_BLEND_QUADRATIC,
00224     NODE_BLEND_EASING,
00225     NODE_BLEND_DIAGONAL,
00226     NODE_BLEND_RADIAL,
00227     NODE_BLEND_QUADRATIC_SPHERE,
00228     NODE_BLEND_SPHERICAL
00229 } NodeBlendType;
00230 
00231 typedef enum NodeBlendAxis {
00232     NODE_BLEND_HORIZONTAL,
00233     NODE_BLEND_VERTICAL
00234 } NodeBlendAxis;
00235 
00236 typedef enum NodeMarbleType {
00237     NODE_MARBLE_SOFT,
00238     NODE_MARBLE_SHARP,
00239     NODE_MARBLE_SHARPER
00240 } NodeMarbleType;
00241 
00242 typedef enum NodeStucciType {
00243     NODE_STUCCI_PLASTIC,
00244     NODE_STUCCI_WALL_IN,
00245     NODE_STUCCI_WALL_OUT
00246 } NodeStucciType;
00247 
00248 typedef enum NodeVoronoiColoring {
00249     NODE_VORONOI_INTENSITY,
00250     NODE_VORONOI_CELLS
00251 } NodeVoronoiColoring;
00252 
00253 typedef enum NodeBlendWeightType {
00254     NODE_LAYER_WEIGHT_FRESNEL,
00255     NODE_LAYER_WEIGHT_FACING
00256 } NodeBlendWeightType;
00257 
00258 typedef enum ShaderType {
00259     SHADER_TYPE_SURFACE,
00260     SHADER_TYPE_VOLUME,
00261     SHADER_TYPE_DISPLACEMENT
00262 } ShaderType;
00263 
00264 /* Closure */
00265 
00266 typedef enum ClosureType {
00267     CLOSURE_BSDF_ID,
00268     CLOSURE_BSDF_DIFFUSE_ID,
00269     CLOSURE_BSDF_OREN_NAYAR_ID,
00270     CLOSURE_BSDF_TRANSLUCENT_ID,
00271     CLOSURE_BSDF_REFLECTION_ID,
00272     CLOSURE_BSDF_REFRACTION_ID,
00273     CLOSURE_BSDF_GLASS_ID,
00274     CLOSURE_BSDF_TRANSPARENT_ID,
00275     CLOSURE_BSDF_MICROFACET_GGX_ID,
00276     CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
00277     CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
00278     CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
00279     CLOSURE_BSDF_WARD_ID,
00280     CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
00281     CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
00282     CLOSURE_BSDF_WESTIN_SHEEN_ID,
00283 
00284     CLOSURE_BSSRDF_CUBIC_ID,
00285     CLOSURE_EMISSION_ID,
00286     CLOSURE_DEBUG_ID,
00287     CLOSURE_BACKGROUND_ID,
00288     CLOSURE_HOLDOUT_ID,
00289     CLOSURE_SUBSURFACE_ID,
00290 
00291     CLOSURE_VOLUME_ID,
00292     CLOSURE_VOLUME_TRANSPARENT_ID,
00293     CLOSURE_VOLUME_ISOTROPIC_ID,
00294 
00295     NBUILTIN_CLOSURES
00296 } ClosureType;
00297 
00298 /* watch this, being lazy with memory usage */
00299 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
00300 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
00301 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
00302 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
00303 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
00304 
00305 CCL_NAMESPACE_END
00306 
00307 #endif /*  __SVM_TYPES_H__ */
00308