Cycles / Sky Model:
[blender.git] / intern / cycles / kernel / svm / svm_types.h
1 /*
2  * Copyright 2011, Blender Foundation.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef __SVM_TYPES_H__
20 #define __SVM_TYPES_H__
21
22 CCL_NAMESPACE_BEGIN
23
24 /* Stack */
25
26 /* SVM stack has a fixed size */
27 #define SVM_STACK_SIZE 255
28 /* SVM stack offsets with this value indicate that it's not on the stack */
29 #define SVM_STACK_INVALID 255 
30
31 /* Nodes */
32
33 typedef enum NodeType {
34         NODE_END = 0,
35         NODE_CLOSURE_BSDF,
36         NODE_CLOSURE_EMISSION,
37         NODE_CLOSURE_BACKGROUND,
38         NODE_CLOSURE_SET_WEIGHT,
39         NODE_CLOSURE_WEIGHT,
40         NODE_MIX_CLOSURE,
41         NODE_JUMP,
42         NODE_TEX_IMAGE,
43         NODE_TEX_IMAGE_BOX,
44         NODE_TEX_SKY,
45         NODE_GEOMETRY,
46         NODE_GEOMETRY_DUPLI,
47         NODE_LIGHT_PATH,
48         NODE_VALUE_F,
49         NODE_VALUE_V,
50         NODE_MIX,
51         NODE_ATTR,
52         NODE_CONVERT,
53         NODE_FRESNEL,
54         NODE_WIREFRAME,
55         NODE_WAVELENGTH,
56         NODE_BLACKBODY,
57         NODE_EMISSION_WEIGHT,
58         NODE_TEX_GRADIENT,
59         NODE_TEX_VORONOI,
60         NODE_TEX_MUSGRAVE,
61         NODE_TEX_WAVE,
62         NODE_TEX_MAGIC,
63         NODE_TEX_NOISE,
64         NODE_SHADER_JUMP,
65         NODE_SET_DISPLACEMENT,
66         NODE_GEOMETRY_BUMP_DX,
67         NODE_GEOMETRY_BUMP_DY,
68         NODE_SET_BUMP,
69         NODE_MATH,
70         NODE_VECTOR_MATH,
71         NODE_VECTOR_TRANSFORM,
72         NODE_MAPPING,
73         NODE_TEX_COORD,
74         NODE_TEX_COORD_BUMP_DX,
75         NODE_TEX_COORD_BUMP_DY,
76         NODE_ADD_CLOSURE,
77         NODE_EMISSION_SET_WEIGHT_TOTAL,
78         NODE_ATTR_BUMP_DX,
79         NODE_ATTR_BUMP_DY,
80         NODE_TEX_ENVIRONMENT,
81         NODE_CLOSURE_HOLDOUT,
82         NODE_LAYER_WEIGHT,
83         NODE_CLOSURE_VOLUME,
84         NODE_SEPARATE_RGB,
85         NODE_COMBINE_RGB,
86         NODE_SEPARATE_HSV,
87         NODE_COMBINE_HSV,
88         NODE_HSV,
89         NODE_CAMERA,
90         NODE_INVERT,
91         NODE_NORMAL,
92         NODE_GAMMA,
93         NODE_TEX_CHECKER,
94         NODE_BRIGHTCONTRAST,
95         NODE_RGB_RAMP,
96         NODE_RGB_CURVES,
97         NODE_VECTOR_CURVES,
98         NODE_MIN_MAX,
99         NODE_LIGHT_FALLOFF,
100         NODE_OBJECT_INFO,
101         NODE_PARTICLE_INFO,
102         NODE_TEX_BRICK,
103         NODE_CLOSURE_SET_NORMAL,
104         NODE_CLOSURE_AMBIENT_OCCLUSION,
105         NODE_TANGENT,
106         NODE_NORMAL_MAP,
107         NODE_HAIR_INFO
108 } NodeType;
109
110 typedef enum NodeAttributeType {
111         NODE_ATTR_FLOAT = 0,
112         NODE_ATTR_FLOAT3
113 } NodeAttributeType;
114
115 typedef enum NodeGeometry {
116         NODE_GEOM_P = 0,
117         NODE_GEOM_N,
118         NODE_GEOM_T,
119         NODE_GEOM_I,
120         NODE_GEOM_Ng,
121         NODE_GEOM_uv
122 } NodeGeometry;
123
124 typedef enum NodeObjectInfo {
125         NODE_INFO_OB_LOCATION,
126         NODE_INFO_OB_INDEX,
127         NODE_INFO_MAT_INDEX,
128         NODE_INFO_OB_RANDOM
129 } NodeObjectInfo;
130
131 typedef enum NodeParticleInfo {
132         NODE_INFO_PAR_INDEX,
133         NODE_INFO_PAR_AGE,
134         NODE_INFO_PAR_LIFETIME,
135         NODE_INFO_PAR_LOCATION,
136         NODE_INFO_PAR_ROTATION,
137         NODE_INFO_PAR_SIZE,
138         NODE_INFO_PAR_VELOCITY,
139         NODE_INFO_PAR_ANGULAR_VELOCITY
140 } NodeParticleInfo;
141
142 typedef enum NodeHairInfo {
143         NODE_INFO_CURVE_IS_STRAND,
144         NODE_INFO_CURVE_INTERCEPT,
145         NODE_INFO_CURVE_THICKNESS,
146         /*fade for minimum hair width transpency*/
147         /*NODE_INFO_CURVE_FADE,*/
148         NODE_INFO_CURVE_TANGENT_NORMAL
149 } NodeHairInfo;
150
151 typedef enum NodeLightPath {
152         NODE_LP_camera = 0,
153         NODE_LP_shadow,
154         NODE_LP_diffuse,
155         NODE_LP_glossy,
156         NODE_LP_singular,
157         NODE_LP_reflection,
158         NODE_LP_transmission,
159         NODE_LP_backfacing,
160         NODE_LP_ray_length,
161         NODE_LP_ray_depth
162 } NodeLightPath;
163
164 typedef enum NodeLightFalloff {
165         NODE_LIGHT_FALLOFF_QUADRATIC,
166         NODE_LIGHT_FALLOFF_LINEAR,
167         NODE_LIGHT_FALLOFF_CONSTANT
168 } NodeLightFalloff;
169
170 typedef enum NodeTexCoord {
171         NODE_TEXCO_NORMAL,
172         NODE_TEXCO_OBJECT,
173         NODE_TEXCO_CAMERA,
174         NODE_TEXCO_WINDOW,
175         NODE_TEXCO_REFLECTION,
176         NODE_TEXCO_DUPLI_GENERATED,
177         NODE_TEXCO_DUPLI_UV
178 } NodeTexCoord;
179
180 typedef enum NodeMix {
181         NODE_MIX_BLEND = 0,
182         NODE_MIX_ADD,
183         NODE_MIX_MUL,
184         NODE_MIX_SUB,
185         NODE_MIX_SCREEN,
186         NODE_MIX_DIV,
187         NODE_MIX_DIFF,
188         NODE_MIX_DARK,
189         NODE_MIX_LIGHT,
190         NODE_MIX_OVERLAY,
191         NODE_MIX_DODGE,
192         NODE_MIX_BURN,
193         NODE_MIX_HUE,
194         NODE_MIX_SAT,
195         NODE_MIX_VAL,
196         NODE_MIX_COLOR,
197         NODE_MIX_SOFT,
198         NODE_MIX_LINEAR,
199         NODE_MIX_CLAMP /* used for the clamp UI option */
200 } NodeMix;
201
202 typedef enum NodeMath {
203         NODE_MATH_ADD,
204         NODE_MATH_SUBTRACT,
205         NODE_MATH_MULTIPLY,
206         NODE_MATH_DIVIDE,
207         NODE_MATH_SINE,
208         NODE_MATH_COSINE,
209         NODE_MATH_TANGENT,
210         NODE_MATH_ARCSINE,
211         NODE_MATH_ARCCOSINE,
212         NODE_MATH_ARCTANGENT,
213         NODE_MATH_POWER,
214         NODE_MATH_LOGARITHM,
215         NODE_MATH_MINIMUM,
216         NODE_MATH_MAXIMUM,
217         NODE_MATH_ROUND,
218         NODE_MATH_LESS_THAN,
219         NODE_MATH_GREATER_THAN,
220         NODE_MATH_MODULO,
221         NODE_MATH_CLAMP /* used for the clamp UI option */
222 } NodeMath;
223
224 typedef enum NodeVectorMath {
225         NODE_VECTOR_MATH_ADD,
226         NODE_VECTOR_MATH_SUBTRACT,
227         NODE_VECTOR_MATH_AVERAGE,
228         NODE_VECTOR_MATH_DOT_PRODUCT,
229         NODE_VECTOR_MATH_CROSS_PRODUCT,
230         NODE_VECTOR_MATH_NORMALIZE
231 } NodeVectorMath;
232
233 typedef enum NodeVectorTransformType {
234         NODE_VECTOR_TRANSFORM_TYPE_VECTOR,
235         NODE_VECTOR_TRANSFORM_TYPE_POINT,
236         NODE_VECTOR_TRANSFORM_TYPE_NORMAL
237 } NodeVectorTransformType;
238
239 typedef enum NodeVectorTransformConvertSpace {
240         NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD,
241         NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT,
242         NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA
243 } NodeVectorTransformConvertSpace;
244
245 typedef enum NodeConvert {
246         NODE_CONVERT_FV,
247         NODE_CONVERT_FI,
248         NODE_CONVERT_CF,
249         NODE_CONVERT_CI,
250         NODE_CONVERT_VF,
251         NODE_CONVERT_VI,
252         NODE_CONVERT_IF,
253         NODE_CONVERT_IV
254 } NodeConvert;
255
256 typedef enum NodeDistanceMetric {
257         NODE_VORONOI_DISTANCE_SQUARED,
258         NODE_VORONOI_ACTUAL_DISTANCE,
259         NODE_VORONOI_MANHATTAN,
260         NODE_VORONOI_CHEBYCHEV,
261         NODE_VORONOI_MINKOVSKY_H,
262         NODE_VORONOI_MINKOVSKY_4,
263         NODE_VORONOI_MINKOVSKY
264 } NodeDistanceMetric;
265
266 typedef enum NodeNoiseBasis {
267         NODE_NOISE_PERLIN,
268         NODE_NOISE_VORONOI_F1,
269         NODE_NOISE_VORONOI_F2,
270         NODE_NOISE_VORONOI_F3,
271         NODE_NOISE_VORONOI_F4,
272         NODE_NOISE_VORONOI_F2_F1,
273         NODE_NOISE_VORONOI_CRACKLE,
274         NODE_NOISE_CELL_NOISE
275 } NodeNoiseBasis;
276
277 typedef enum NodeMusgraveType {
278         NODE_MUSGRAVE_MULTIFRACTAL,
279         NODE_MUSGRAVE_FBM,
280         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
281         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
282         NODE_MUSGRAVE_HETERO_TERRAIN
283 } NodeMusgraveType;
284
285 typedef enum NodeWaveType {
286         NODE_WAVE_BANDS,
287         NODE_WAVE_RINGS
288 } NodeWaveType;
289
290 typedef enum NodeGradientType {
291         NODE_BLEND_LINEAR,
292         NODE_BLEND_QUADRATIC,
293         NODE_BLEND_EASING,
294         NODE_BLEND_DIAGONAL,
295         NODE_BLEND_RADIAL,
296         NODE_BLEND_QUADRATIC_SPHERE,
297         NODE_BLEND_SPHERICAL
298 } NodeGradientType;
299
300 typedef enum NodeVoronoiColoring {
301         NODE_VORONOI_INTENSITY,
302         NODE_VORONOI_CELLS
303 } NodeVoronoiColoring;
304
305 typedef enum NodeBlendWeightType {
306         NODE_LAYER_WEIGHT_FRESNEL,
307         NODE_LAYER_WEIGHT_FACING
308 } NodeBlendWeightType;
309
310 typedef enum NodeTangentDirectionType {
311         NODE_TANGENT_RADIAL,
312         NODE_TANGENT_UVMAP
313 } NodeTangentDirectionType;
314
315 typedef enum NodeTangentAxis {
316         NODE_TANGENT_AXIS_X,
317         NODE_TANGENT_AXIS_Y,
318         NODE_TANGENT_AXIS_Z
319 } NodeTangentAxis;
320
321 typedef enum NodeNormalMapSpace {
322         NODE_NORMAL_MAP_TANGENT,
323         NODE_NORMAL_MAP_OBJECT,
324         NODE_NORMAL_MAP_WORLD,
325         NODE_NORMAL_MAP_BLENDER_OBJECT,
326         NODE_NORMAL_MAP_BLENDER_WORLD,
327 } NodeNormalMapSpace;
328
329 typedef enum ShaderType {
330         SHADER_TYPE_SURFACE,
331         SHADER_TYPE_VOLUME,
332         SHADER_TYPE_DISPLACEMENT
333 } ShaderType;
334
335 /* Closure */
336
337 typedef enum ClosureType {
338         CLOSURE_BSDF_ID,
339         
340         /* Diffuse */
341         CLOSURE_BSDF_DIFFUSE_ID,
342         CLOSURE_BSDF_OREN_NAYAR_ID,
343         CLOSURE_BSDF_WESTIN_SHEEN_ID,
344         CLOSURE_BSDF_DIFFUSE_RAMP_ID,
345         CLOSURE_BSDF_DIFFUSE_TOON_ID,
346         
347         /* Glossy */
348         CLOSURE_BSDF_GLOSSY_ID,
349         CLOSURE_BSDF_REFLECTION_ID,
350         CLOSURE_BSDF_MICROFACET_GGX_ID,
351         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
352         CLOSURE_BSDF_WARD_ID,
353         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
354         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
355         CLOSURE_BSDF_PHONG_RAMP_ID,
356         CLOSURE_BSDF_GLOSSY_TOON_ID,
357         
358         /* Transmission */
359         CLOSURE_BSDF_TRANSMISSION_ID,
360         CLOSURE_BSDF_TRANSLUCENT_ID,
361         CLOSURE_BSDF_REFRACTION_ID,
362         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
363         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
364         CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID,
365         CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID,
366         CLOSURE_BSDF_SHARP_GLASS_ID,
367         
368         /* Special cases */
369         CLOSURE_BSDF_BSSRDF_ID,
370         CLOSURE_BSDF_TRANSPARENT_ID,
371
372         /* Other */
373         CLOSURE_BSSRDF_ID,
374         CLOSURE_EMISSION_ID,
375         CLOSURE_DEBUG_ID,
376         CLOSURE_BACKGROUND_ID,
377         CLOSURE_HOLDOUT_ID,
378         CLOSURE_AMBIENT_OCCLUSION_ID,
379
380         /* Volume */
381         CLOSURE_VOLUME_ID,
382         CLOSURE_VOLUME_TRANSPARENT_ID,
383         CLOSURE_VOLUME_ISOTROPIC_ID,
384
385         NBUILTIN_CLOSURES
386 } ClosureType;
387
388 /* watch this, being lazy with memory usage */
389 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID)
390 #define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_DIFFUSE_TOON_ID)
391 #define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_GLOSSY_TOON_ID)
392 #define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_SHARP_GLASS_ID)
393 #define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID)
394 #define CLOSURE_IS_BSSRDF(type) (type == CLOSURE_BSSRDF_ID)
395 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
396 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
397 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
398 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
399 #define CLOSURE_IS_AMBIENT_OCCLUSION(type) (type == CLOSURE_AMBIENT_OCCLUSION_ID)
400
401 CCL_NAMESPACE_END
402
403 #endif /*  __SVM_TYPES_H__ */
404