Code cleanup: libmv C API
[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_EMISSION_WEIGHT,
57         NODE_TEX_GRADIENT,
58         NODE_TEX_VORONOI,
59         NODE_TEX_MUSGRAVE,
60         NODE_TEX_WAVE,
61         NODE_TEX_MAGIC,
62         NODE_TEX_NOISE,
63         NODE_SHADER_JUMP,
64         NODE_SET_DISPLACEMENT,
65         NODE_GEOMETRY_BUMP_DX,
66         NODE_GEOMETRY_BUMP_DY,
67         NODE_SET_BUMP,
68         NODE_MATH,
69         NODE_VECTOR_MATH,
70         NODE_MAPPING,
71         NODE_TEX_COORD,
72         NODE_TEX_COORD_BUMP_DX,
73         NODE_TEX_COORD_BUMP_DY,
74         NODE_ADD_CLOSURE,
75         NODE_EMISSION_SET_WEIGHT_TOTAL,
76         NODE_ATTR_BUMP_DX,
77         NODE_ATTR_BUMP_DY,
78         NODE_TEX_ENVIRONMENT,
79         NODE_CLOSURE_HOLDOUT,
80         NODE_LAYER_WEIGHT,
81         NODE_CLOSURE_VOLUME,
82         NODE_SEPARATE_RGB,
83         NODE_COMBINE_RGB,
84         NODE_HSV,
85         NODE_CAMERA,
86         NODE_INVERT,
87         NODE_NORMAL,
88         NODE_GAMMA,
89         NODE_TEX_CHECKER,
90         NODE_BRIGHTCONTRAST,
91         NODE_RGB_RAMP,
92         NODE_RGB_CURVES,
93         NODE_VECTOR_CURVES,
94         NODE_MIN_MAX,
95         NODE_LIGHT_FALLOFF,
96         NODE_OBJECT_INFO,
97         NODE_PARTICLE_INFO,
98         NODE_TEX_BRICK,
99         NODE_CLOSURE_SET_NORMAL,
100         NODE_CLOSURE_AMBIENT_OCCLUSION,
101         NODE_TANGENT,
102         NODE_NORMAL_MAP,
103         NODE_HAIR_INFO
104 } NodeType;
105
106 typedef enum NodeAttributeType {
107         NODE_ATTR_FLOAT = 0,
108         NODE_ATTR_FLOAT3
109 } NodeAttributeType;
110
111 typedef enum NodeGeometry {
112         NODE_GEOM_P = 0,
113         NODE_GEOM_N,
114         NODE_GEOM_T,
115         NODE_GEOM_I,
116         NODE_GEOM_Ng,
117         NODE_GEOM_uv
118 } NodeGeometry;
119
120 typedef enum NodeObjectInfo {
121         NODE_INFO_OB_LOCATION,
122         NODE_INFO_OB_INDEX,
123         NODE_INFO_MAT_INDEX,
124         NODE_INFO_OB_RANDOM
125 } NodeObjectInfo;
126
127 typedef enum NodeParticleInfo {
128         NODE_INFO_PAR_INDEX,
129         NODE_INFO_PAR_AGE,
130         NODE_INFO_PAR_LIFETIME,
131         NODE_INFO_PAR_LOCATION,
132         NODE_INFO_PAR_ROTATION,
133         NODE_INFO_PAR_SIZE,
134         NODE_INFO_PAR_VELOCITY,
135         NODE_INFO_PAR_ANGULAR_VELOCITY
136 } NodeParticleInfo;
137
138 typedef enum NodeHairInfo {
139         NODE_INFO_CURVE_IS_STRAND,
140         NODE_INFO_CURVE_INTERCEPT,
141         NODE_INFO_CURVE_THICKNESS,
142         /*fade for minimum hair width transpency*/
143         /*NODE_INFO_CURVE_FADE,*/
144         NODE_INFO_CURVE_TANGENT_NORMAL
145 } NodeHairInfo;
146
147 typedef enum NodeLightPath {
148         NODE_LP_camera = 0,
149         NODE_LP_shadow,
150         NODE_LP_diffuse,
151         NODE_LP_glossy,
152         NODE_LP_singular,
153         NODE_LP_reflection,
154         NODE_LP_transmission,
155         NODE_LP_backfacing,
156         NODE_LP_ray_length
157 } NodeLightPath;
158
159 typedef enum NodeLightFalloff {
160         NODE_LIGHT_FALLOFF_QUADRATIC,
161         NODE_LIGHT_FALLOFF_LINEAR,
162         NODE_LIGHT_FALLOFF_CONSTANT
163 } NodeLightFalloff;
164
165 typedef enum NodeTexCoord {
166         NODE_TEXCO_NORMAL,
167         NODE_TEXCO_OBJECT,
168         NODE_TEXCO_CAMERA,
169         NODE_TEXCO_WINDOW,
170         NODE_TEXCO_REFLECTION,
171         NODE_TEXCO_DUPLI_GENERATED,
172         NODE_TEXCO_DUPLI_UV
173 } NodeTexCoord;
174
175 typedef enum NodeMix {
176         NODE_MIX_BLEND = 0,
177         NODE_MIX_ADD,
178         NODE_MIX_MUL,
179         NODE_MIX_SUB,
180         NODE_MIX_SCREEN,
181         NODE_MIX_DIV,
182         NODE_MIX_DIFF,
183         NODE_MIX_DARK,
184         NODE_MIX_LIGHT,
185         NODE_MIX_OVERLAY,
186         NODE_MIX_DODGE,
187         NODE_MIX_BURN,
188         NODE_MIX_HUE,
189         NODE_MIX_SAT,
190         NODE_MIX_VAL,
191         NODE_MIX_COLOR,
192         NODE_MIX_SOFT,
193         NODE_MIX_LINEAR,
194         NODE_MIX_CLAMP /* used for the clamp UI option */
195 } NodeMix;
196
197 typedef enum NodeMath {
198         NODE_MATH_ADD,
199         NODE_MATH_SUBTRACT,
200         NODE_MATH_MULTIPLY,
201         NODE_MATH_DIVIDE,
202         NODE_MATH_SINE,
203         NODE_MATH_COSINE,
204         NODE_MATH_TANGENT,
205         NODE_MATH_ARCSINE,
206         NODE_MATH_ARCCOSINE,
207         NODE_MATH_ARCTANGENT,
208         NODE_MATH_POWER,
209         NODE_MATH_LOGARITHM,
210         NODE_MATH_MINIMUM,
211         NODE_MATH_MAXIMUM,
212         NODE_MATH_ROUND,
213         NODE_MATH_LESS_THAN,
214         NODE_MATH_GREATER_THAN,
215         NODE_MATH_MODULO,
216         NODE_MATH_CLAMP /* used for the clamp UI option */
217 } NodeMath;
218
219 typedef enum NodeVectorMath {
220         NODE_VECTOR_MATH_ADD,
221         NODE_VECTOR_MATH_SUBTRACT,
222         NODE_VECTOR_MATH_AVERAGE,
223         NODE_VECTOR_MATH_DOT_PRODUCT,
224         NODE_VECTOR_MATH_CROSS_PRODUCT,
225         NODE_VECTOR_MATH_NORMALIZE
226 } NodeVectorMath;
227
228 typedef enum NodeConvert {
229         NODE_CONVERT_FV,
230         NODE_CONVERT_FI,
231         NODE_CONVERT_CF,
232         NODE_CONVERT_CI,
233         NODE_CONVERT_VF,
234         NODE_CONVERT_VI,
235         NODE_CONVERT_IF,
236         NODE_CONVERT_IV
237 } NodeConvert;
238
239 typedef enum NodeDistanceMetric {
240         NODE_VORONOI_DISTANCE_SQUARED,
241         NODE_VORONOI_ACTUAL_DISTANCE,
242         NODE_VORONOI_MANHATTAN,
243         NODE_VORONOI_CHEBYCHEV,
244         NODE_VORONOI_MINKOVSKY_H,
245         NODE_VORONOI_MINKOVSKY_4,
246         NODE_VORONOI_MINKOVSKY
247 } NodeDistanceMetric;
248
249 typedef enum NodeNoiseBasis {
250         NODE_NOISE_PERLIN,
251         NODE_NOISE_VORONOI_F1,
252         NODE_NOISE_VORONOI_F2,
253         NODE_NOISE_VORONOI_F3,
254         NODE_NOISE_VORONOI_F4,
255         NODE_NOISE_VORONOI_F2_F1,
256         NODE_NOISE_VORONOI_CRACKLE,
257         NODE_NOISE_CELL_NOISE
258 } NodeNoiseBasis;
259
260 typedef enum NodeWaveBasis {
261         NODE_WAVE_SINE,
262         NODE_WAVE_SAW,
263         NODE_WAVE_TRI
264 } NodeWaveBasis;
265
266 typedef enum NodeMusgraveType {
267         NODE_MUSGRAVE_MULTIFRACTAL,
268         NODE_MUSGRAVE_FBM,
269         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
270         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
271         NODE_MUSGRAVE_HETERO_TERRAIN
272 } NodeMusgraveType;
273
274 typedef enum NodeWaveType {
275         NODE_WAVE_BANDS,
276         NODE_WAVE_RINGS
277 } NodeWaveType;
278
279 typedef enum NodeGradientType {
280         NODE_BLEND_LINEAR,
281         NODE_BLEND_QUADRATIC,
282         NODE_BLEND_EASING,
283         NODE_BLEND_DIAGONAL,
284         NODE_BLEND_RADIAL,
285         NODE_BLEND_QUADRATIC_SPHERE,
286         NODE_BLEND_SPHERICAL
287 } NodeGradientType;
288
289 typedef enum NodeVoronoiColoring {
290         NODE_VORONOI_INTENSITY,
291         NODE_VORONOI_CELLS
292 } NodeVoronoiColoring;
293
294 typedef enum NodeBlendWeightType {
295         NODE_LAYER_WEIGHT_FRESNEL,
296         NODE_LAYER_WEIGHT_FACING
297 } NodeBlendWeightType;
298
299 typedef enum NodeTangentDirectionType {
300         NODE_TANGENT_RADIAL,
301         NODE_TANGENT_UVMAP
302 } NodeTangentDirectionType;
303
304 typedef enum NodeTangentAxis {
305         NODE_TANGENT_AXIS_X,
306         NODE_TANGENT_AXIS_Y,
307         NODE_TANGENT_AXIS_Z
308 } NodeTangentAxis;
309
310 typedef enum NodeNormalMapSpace {
311         NODE_NORMAL_MAP_TANGENT,
312         NODE_NORMAL_MAP_OBJECT,
313         NODE_NORMAL_MAP_WORLD,
314         NODE_NORMAL_MAP_BLENDER_OBJECT,
315         NODE_NORMAL_MAP_BLENDER_WORLD,
316 } NodeNormalMapSpace;
317
318 typedef enum ShaderType {
319         SHADER_TYPE_SURFACE,
320         SHADER_TYPE_VOLUME,
321         SHADER_TYPE_DISPLACEMENT
322 } ShaderType;
323
324 /* Closure */
325
326 typedef enum ClosureType {
327         CLOSURE_BSDF_ID,
328         
329         /* Diffuse */
330         CLOSURE_BSDF_DIFFUSE_ID,
331         CLOSURE_BSDF_OREN_NAYAR_ID,
332         CLOSURE_BSDF_WESTIN_SHEEN_ID,
333         CLOSURE_BSDF_DIFFUSE_RAMP_ID,
334         CLOSURE_BSDF_DIFFUSE_TOON_ID,
335         
336         /* Glossy */
337         CLOSURE_BSDF_GLOSSY_ID,
338         CLOSURE_BSDF_REFLECTION_ID,
339         CLOSURE_BSDF_MICROFACET_GGX_ID,
340         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
341         CLOSURE_BSDF_WARD_ID,
342         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
343         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
344         CLOSURE_BSDF_PHONG_RAMP_ID,
345         CLOSURE_BSDF_GLOSSY_TOON_ID,
346         
347         /* Transmission */
348         CLOSURE_BSDF_TRANSMISSION_ID,
349         CLOSURE_BSDF_TRANSLUCENT_ID,
350         CLOSURE_BSDF_REFRACTION_ID,
351         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
352         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
353         CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID,
354         CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID,
355         CLOSURE_BSDF_SHARP_GLASS_ID,
356         
357         /* Transparent */
358         CLOSURE_BSDF_TRANSPARENT_ID,
359
360         /* Other */
361         CLOSURE_BSSRDF_ID,
362         CLOSURE_EMISSION_ID,
363         CLOSURE_DEBUG_ID,
364         CLOSURE_BACKGROUND_ID,
365         CLOSURE_HOLDOUT_ID,
366         CLOSURE_AMBIENT_OCCLUSION_ID,
367
368         /* Volume */
369         CLOSURE_VOLUME_ID,
370         CLOSURE_VOLUME_TRANSPARENT_ID,
371         CLOSURE_VOLUME_ISOTROPIC_ID,
372
373         NBUILTIN_CLOSURES
374 } ClosureType;
375
376 /* watch this, being lazy with memory usage */
377 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID)
378 #define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_DIFFUSE_TOON_ID)
379 #define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_GLOSSY_TOON_ID)
380 #define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_SHARP_GLASS_ID)
381 #define CLOSURE_IS_BSSRDF(type) (type == CLOSURE_BSSRDF_ID)
382 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
383 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
384 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
385 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
386 #define CLOSURE_IS_AMBIENT_OCCLUSION(type) (type == CLOSURE_AMBIENT_OCCLUSION_ID)
387
388 CCL_NAMESPACE_END
389
390 #endif /*  __SVM_TYPES_H__ */
391