Cycles: add dedicated UV Map node, easier to find and has convenient auto complete.
[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         NODE_UVMAP
107 } NodeType;
108
109 typedef enum NodeAttributeType {
110         NODE_ATTR_FLOAT = 0,
111         NODE_ATTR_FLOAT3,
112         NODE_ATTR_MATRIX
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_volume_scatter,
160         NODE_LP_backfacing,
161         NODE_LP_ray_length,
162         NODE_LP_ray_depth
163 } NodeLightPath;
164
165 typedef enum NodeLightFalloff {
166         NODE_LIGHT_FALLOFF_QUADRATIC,
167         NODE_LIGHT_FALLOFF_LINEAR,
168         NODE_LIGHT_FALLOFF_CONSTANT
169 } NodeLightFalloff;
170
171 typedef enum NodeTexCoord {
172         NODE_TEXCO_NORMAL,
173         NODE_TEXCO_OBJECT,
174         NODE_TEXCO_CAMERA,
175         NODE_TEXCO_WINDOW,
176         NODE_TEXCO_REFLECTION,
177         NODE_TEXCO_DUPLI_GENERATED,
178         NODE_TEXCO_DUPLI_UV,
179         NODE_TEXCO_VOLUME_GENERATED
180 } NodeTexCoord;
181
182 typedef enum NodeMix {
183         NODE_MIX_BLEND = 0,
184         NODE_MIX_ADD,
185         NODE_MIX_MUL,
186         NODE_MIX_SUB,
187         NODE_MIX_SCREEN,
188         NODE_MIX_DIV,
189         NODE_MIX_DIFF,
190         NODE_MIX_DARK,
191         NODE_MIX_LIGHT,
192         NODE_MIX_OVERLAY,
193         NODE_MIX_DODGE,
194         NODE_MIX_BURN,
195         NODE_MIX_HUE,
196         NODE_MIX_SAT,
197         NODE_MIX_VAL,
198         NODE_MIX_COLOR,
199         NODE_MIX_SOFT,
200         NODE_MIX_LINEAR,
201         NODE_MIX_CLAMP /* used for the clamp UI option */
202 } NodeMix;
203
204 typedef enum NodeMath {
205         NODE_MATH_ADD,
206         NODE_MATH_SUBTRACT,
207         NODE_MATH_MULTIPLY,
208         NODE_MATH_DIVIDE,
209         NODE_MATH_SINE,
210         NODE_MATH_COSINE,
211         NODE_MATH_TANGENT,
212         NODE_MATH_ARCSINE,
213         NODE_MATH_ARCCOSINE,
214         NODE_MATH_ARCTANGENT,
215         NODE_MATH_POWER,
216         NODE_MATH_LOGARITHM,
217         NODE_MATH_MINIMUM,
218         NODE_MATH_MAXIMUM,
219         NODE_MATH_ROUND,
220         NODE_MATH_LESS_THAN,
221         NODE_MATH_GREATER_THAN,
222         NODE_MATH_MODULO,
223         NODE_MATH_CLAMP /* used for the clamp UI option */
224 } NodeMath;
225
226 typedef enum NodeVectorMath {
227         NODE_VECTOR_MATH_ADD,
228         NODE_VECTOR_MATH_SUBTRACT,
229         NODE_VECTOR_MATH_AVERAGE,
230         NODE_VECTOR_MATH_DOT_PRODUCT,
231         NODE_VECTOR_MATH_CROSS_PRODUCT,
232         NODE_VECTOR_MATH_NORMALIZE
233 } NodeVectorMath;
234
235 typedef enum NodeVectorTransformType {
236         NODE_VECTOR_TRANSFORM_TYPE_VECTOR,
237         NODE_VECTOR_TRANSFORM_TYPE_POINT,
238         NODE_VECTOR_TRANSFORM_TYPE_NORMAL
239 } NodeVectorTransformType;
240
241 typedef enum NodeVectorTransformConvertSpace {
242         NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD,
243         NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT,
244         NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA
245 } NodeVectorTransformConvertSpace;
246
247 typedef enum NodeConvert {
248         NODE_CONVERT_FV,
249         NODE_CONVERT_FI,
250         NODE_CONVERT_CF,
251         NODE_CONVERT_CI,
252         NODE_CONVERT_VF,
253         NODE_CONVERT_VI,
254         NODE_CONVERT_IF,
255         NODE_CONVERT_IV
256 } NodeConvert;
257
258 typedef enum NodeDistanceMetric {
259         NODE_VORONOI_DISTANCE_SQUARED,
260         NODE_VORONOI_ACTUAL_DISTANCE,
261         NODE_VORONOI_MANHATTAN,
262         NODE_VORONOI_CHEBYCHEV,
263         NODE_VORONOI_MINKOVSKY_H,
264         NODE_VORONOI_MINKOVSKY_4,
265         NODE_VORONOI_MINKOVSKY
266 } NodeDistanceMetric;
267
268 typedef enum NodeNoiseBasis {
269         NODE_NOISE_PERLIN,
270         NODE_NOISE_VORONOI_F1,
271         NODE_NOISE_VORONOI_F2,
272         NODE_NOISE_VORONOI_F3,
273         NODE_NOISE_VORONOI_F4,
274         NODE_NOISE_VORONOI_F2_F1,
275         NODE_NOISE_VORONOI_CRACKLE,
276         NODE_NOISE_CELL_NOISE
277 } NodeNoiseBasis;
278
279 typedef enum NodeMusgraveType {
280         NODE_MUSGRAVE_MULTIFRACTAL,
281         NODE_MUSGRAVE_FBM,
282         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
283         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
284         NODE_MUSGRAVE_HETERO_TERRAIN
285 } NodeMusgraveType;
286
287 typedef enum NodeWaveType {
288         NODE_WAVE_BANDS,
289         NODE_WAVE_RINGS
290 } NodeWaveType;
291
292 typedef enum NodeSkyType {
293         NODE_SKY_OLD,
294         NODE_SKY_NEW
295 } NodeSkyType;
296
297 typedef enum NodeGradientType {
298         NODE_BLEND_LINEAR,
299         NODE_BLEND_QUADRATIC,
300         NODE_BLEND_EASING,
301         NODE_BLEND_DIAGONAL,
302         NODE_BLEND_RADIAL,
303         NODE_BLEND_QUADRATIC_SPHERE,
304         NODE_BLEND_SPHERICAL
305 } NodeGradientType;
306
307 typedef enum NodeVoronoiColoring {
308         NODE_VORONOI_INTENSITY,
309         NODE_VORONOI_CELLS
310 } NodeVoronoiColoring;
311
312 typedef enum NodeBlendWeightType {
313         NODE_LAYER_WEIGHT_FRESNEL,
314         NODE_LAYER_WEIGHT_FACING
315 } NodeBlendWeightType;
316
317 typedef enum NodeTangentDirectionType {
318         NODE_TANGENT_RADIAL,
319         NODE_TANGENT_UVMAP
320 } NodeTangentDirectionType;
321
322 typedef enum NodeTangentAxis {
323         NODE_TANGENT_AXIS_X,
324         NODE_TANGENT_AXIS_Y,
325         NODE_TANGENT_AXIS_Z
326 } NodeTangentAxis;
327
328 typedef enum NodeNormalMapSpace {
329         NODE_NORMAL_MAP_TANGENT,
330         NODE_NORMAL_MAP_OBJECT,
331         NODE_NORMAL_MAP_WORLD,
332         NODE_NORMAL_MAP_BLENDER_OBJECT,
333         NODE_NORMAL_MAP_BLENDER_WORLD,
334 } NodeNormalMapSpace;
335
336 typedef enum ShaderType {
337         SHADER_TYPE_SURFACE,
338         SHADER_TYPE_VOLUME,
339         SHADER_TYPE_DISPLACEMENT
340 } ShaderType;
341
342 /* Closure */
343
344 typedef enum ClosureType {
345         CLOSURE_BSDF_ID,
346
347         /* Diffuse */
348         CLOSURE_BSDF_DIFFUSE_ID,
349         CLOSURE_BSDF_OREN_NAYAR_ID,
350         CLOSURE_BSDF_WESTIN_SHEEN_ID,
351         CLOSURE_BSDF_DIFFUSE_RAMP_ID,
352         CLOSURE_BSDF_DIFFUSE_TOON_ID,
353
354         /* Glossy */
355         CLOSURE_BSDF_GLOSSY_ID,
356         CLOSURE_BSDF_REFLECTION_ID,
357         CLOSURE_BSDF_MICROFACET_GGX_ID,
358         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
359         CLOSURE_BSDF_WARD_ID,
360         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
361         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
362         CLOSURE_BSDF_PHONG_RAMP_ID,
363         CLOSURE_BSDF_GLOSSY_TOON_ID,
364         CLOSURE_BSDF_HAIR_REFLECTION_ID,
365
366         /* Transmission */
367         CLOSURE_BSDF_TRANSMISSION_ID,
368         CLOSURE_BSDF_TRANSLUCENT_ID,
369         CLOSURE_BSDF_REFRACTION_ID,
370         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
371         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
372         CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID,
373         CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID,
374         CLOSURE_BSDF_SHARP_GLASS_ID,
375         CLOSURE_BSDF_HAIR_TRANSMISSION_ID,
376
377         /* Special cases */
378         CLOSURE_BSDF_BSSRDF_ID,
379         CLOSURE_BSDF_TRANSPARENT_ID,
380
381         /* BSSRDF */
382         CLOSURE_BSSRDF_CUBIC_ID,
383         CLOSURE_BSSRDF_GAUSSIAN_ID,
384
385         /* Other */
386         CLOSURE_EMISSION_ID,
387         CLOSURE_BACKGROUND_ID,
388         CLOSURE_HOLDOUT_ID,
389         CLOSURE_AMBIENT_OCCLUSION_ID,
390
391         /* Volume */
392         CLOSURE_VOLUME_ID,
393         CLOSURE_VOLUME_ABSORPTION_ID,
394         CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID,
395
396         NBUILTIN_CLOSURES
397 } ClosureType;
398
399 /* watch this, being lazy with memory usage */
400 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID)
401 #define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_DIFFUSE_TOON_ID)
402 #define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_HAIR_REFLECTION_ID)
403 #define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID)
404 #define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID)
405 #define CLOSURE_IS_BSSRDF(type) (type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_GAUSSIAN_ID)
406 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID)
407 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
408 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
409 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
410 #define CLOSURE_IS_AMBIENT_OCCLUSION(type) (type == CLOSURE_AMBIENT_OCCLUSION_ID)
411 #define CLOSURE_IS_PHASE(type) (type == CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID)
412
413 #define CLOSURE_WEIGHT_CUTOFF 1e-5f
414
415 CCL_NAMESPACE_END
416
417 #endif /*  __SVM_TYPES_H__ */
418