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