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