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