Merging r50049 through r50076 from trunk into soc-2011-tomato
[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_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 } NodeType;
95
96 typedef enum NodeAttributeType {
97         NODE_ATTR_FLOAT = 0,
98         NODE_ATTR_FLOAT3
99 } NodeAttributeType;
100
101 typedef enum NodeGeometry {
102         NODE_GEOM_P = 0,
103         NODE_GEOM_N,
104         NODE_GEOM_T,
105         NODE_GEOM_I,
106         NODE_GEOM_Ng,
107         NODE_GEOM_uv
108 } NodeGeometry;
109
110 typedef enum NodeObjectInfo {
111         NODE_INFO_OB_LOCATION,
112         NODE_INFO_OB_INDEX,
113         NODE_INFO_MAT_INDEX,
114         NODE_INFO_OB_RANDOM
115 } NodeObjectInfo;
116
117 typedef enum NodeParticleInfo {
118         NODE_INFO_PAR_INDEX,
119         NODE_INFO_PAR_AGE,
120         NODE_INFO_PAR_LIFETIME
121 } NodeParticleInfo;
122
123 typedef enum NodeLightPath {
124         NODE_LP_camera = 0,
125         NODE_LP_shadow,
126         NODE_LP_diffuse,
127         NODE_LP_glossy,
128         NODE_LP_singular,
129         NODE_LP_reflection,
130         NODE_LP_transmission,
131         NODE_LP_backfacing,
132         NODE_LP_ray_length
133 } NodeLightPath;
134
135 typedef enum NodeLightFalloff {
136         NODE_LIGHT_FALLOFF_QUADRATIC,
137         NODE_LIGHT_FALLOFF_LINEAR,
138         NODE_LIGHT_FALLOFF_CONSTANT
139 } NodeLightFalloff;
140
141 typedef enum NodeTexCoord {
142         NODE_TEXCO_NORMAL,
143         NODE_TEXCO_OBJECT,
144         NODE_TEXCO_CAMERA,
145         NODE_TEXCO_WINDOW,
146         NODE_TEXCO_REFLECTION
147 } NodeTexCoord;
148
149 typedef enum NodeMix {
150         NODE_MIX_BLEND = 0,
151         NODE_MIX_ADD,
152         NODE_MIX_MUL,
153         NODE_MIX_SUB,
154         NODE_MIX_SCREEN,
155         NODE_MIX_DIV,
156         NODE_MIX_DIFF,
157         NODE_MIX_DARK,
158         NODE_MIX_LIGHT,
159         NODE_MIX_OVERLAY,
160         NODE_MIX_DODGE,
161         NODE_MIX_BURN,
162         NODE_MIX_HUE,
163         NODE_MIX_SAT,
164         NODE_MIX_VAL,
165         NODE_MIX_COLOR,
166         NODE_MIX_SOFT,
167         NODE_MIX_LINEAR
168 } NodeMix;
169
170 typedef enum NodeMath {
171         NODE_MATH_ADD,
172         NODE_MATH_SUBTRACT,
173         NODE_MATH_MULTIPLY,
174         NODE_MATH_DIVIDE,
175         NODE_MATH_SINE,
176         NODE_MATH_COSINE,
177         NODE_MATH_TANGENT,
178         NODE_MATH_ARCSINE,
179         NODE_MATH_ARCCOSINE,
180         NODE_MATH_ARCTANGENT,
181         NODE_MATH_POWER,
182         NODE_MATH_LOGARITHM,
183         NODE_MATH_MINIMUM,
184         NODE_MATH_MAXIMUM,
185         NODE_MATH_ROUND,
186         NODE_MATH_LESS_THAN,
187         NODE_MATH_GREATER_THAN
188 } NodeMath;
189
190 typedef enum NodeVectorMath {
191         NODE_VECTOR_MATH_ADD,
192         NODE_VECTOR_MATH_SUBTRACT,
193         NODE_VECTOR_MATH_AVERAGE,
194         NODE_VECTOR_MATH_DOT_PRODUCT,
195         NODE_VECTOR_MATH_CROSS_PRODUCT,
196         NODE_VECTOR_MATH_NORMALIZE
197 } NodeVectorMath;
198
199 typedef enum NodeConvert {
200         NODE_CONVERT_FV,
201         NODE_CONVERT_CF,
202         NODE_CONVERT_VF
203 } NodeConvert;
204
205 typedef enum NodeDistanceMetric {
206         NODE_VORONOI_DISTANCE_SQUARED,
207         NODE_VORONOI_ACTUAL_DISTANCE,
208         NODE_VORONOI_MANHATTAN,
209         NODE_VORONOI_CHEBYCHEV,
210         NODE_VORONOI_MINKOVSKY_H,
211         NODE_VORONOI_MINKOVSKY_4,
212         NODE_VORONOI_MINKOVSKY
213 } NodeDistanceMetric;
214
215 typedef enum NodeNoiseBasis {
216         NODE_NOISE_PERLIN,
217         NODE_NOISE_VORONOI_F1,
218         NODE_NOISE_VORONOI_F2,
219         NODE_NOISE_VORONOI_F3,
220         NODE_NOISE_VORONOI_F4,
221         NODE_NOISE_VORONOI_F2_F1,
222         NODE_NOISE_VORONOI_CRACKLE,
223         NODE_NOISE_CELL_NOISE
224 } NodeNoiseBasis;
225
226 typedef enum NodeWaveBasis {
227         NODE_WAVE_SINE,
228         NODE_WAVE_SAW,
229         NODE_WAVE_TRI
230 } NodeWaveBasis;
231
232 typedef enum NodeMusgraveType {
233         NODE_MUSGRAVE_MULTIFRACTAL,
234         NODE_MUSGRAVE_FBM,
235         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
236         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
237         NODE_MUSGRAVE_HETERO_TERRAIN
238 } NodeMusgraveType;
239
240 typedef enum NodeWaveType {
241         NODE_WAVE_BANDS,
242         NODE_WAVE_RINGS
243 } NodeWaveType;
244
245 typedef enum NodeGradientType {
246         NODE_BLEND_LINEAR,
247         NODE_BLEND_QUADRATIC,
248         NODE_BLEND_EASING,
249         NODE_BLEND_DIAGONAL,
250         NODE_BLEND_RADIAL,
251         NODE_BLEND_QUADRATIC_SPHERE,
252         NODE_BLEND_SPHERICAL
253 } NodeGradientType;
254
255 typedef enum NodeVoronoiColoring {
256         NODE_VORONOI_INTENSITY,
257         NODE_VORONOI_CELLS
258 } NodeVoronoiColoring;
259
260 typedef enum NodeBlendWeightType {
261         NODE_LAYER_WEIGHT_FRESNEL,
262         NODE_LAYER_WEIGHT_FACING
263 } NodeBlendWeightType;
264
265 typedef enum ShaderType {
266         SHADER_TYPE_SURFACE,
267         SHADER_TYPE_VOLUME,
268         SHADER_TYPE_DISPLACEMENT
269 } ShaderType;
270
271 /* Closure */
272
273 typedef enum ClosureType {
274         CLOSURE_BSDF_ID,
275
276         CLOSURE_BSDF_DIFFUSE_ID,
277         CLOSURE_BSDF_OREN_NAYAR_ID,
278
279         CLOSURE_BSDF_REFLECTION_ID,
280         CLOSURE_BSDF_MICROFACET_GGX_ID,
281         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
282         CLOSURE_BSDF_WARD_ID,
283         CLOSURE_BSDF_WESTIN_SHEEN_ID,
284
285         CLOSURE_BSDF_TRANSLUCENT_ID,
286         CLOSURE_BSDF_REFRACTION_ID,
287         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
288         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
289         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
290         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
291         CLOSURE_BSDF_GLASS_ID,
292
293         CLOSURE_BSDF_TRANSPARENT_ID,
294
295         CLOSURE_BSSRDF_CUBIC_ID,
296         CLOSURE_EMISSION_ID,
297         CLOSURE_DEBUG_ID,
298         CLOSURE_BACKGROUND_ID,
299         CLOSURE_HOLDOUT_ID,
300         CLOSURE_SUBSURFACE_ID,
301
302         CLOSURE_VOLUME_ID,
303         CLOSURE_VOLUME_TRANSPARENT_ID,
304         CLOSURE_VOLUME_ISOTROPIC_ID,
305
306         NBUILTIN_CLOSURES
307 } ClosureType;
308
309 /* watch this, being lazy with memory usage */
310 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID)
311 #define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_OREN_NAYAR_ID)
312 #define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_REFLECTION_ID && type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
313 #define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSLUCENT_ID && type <= CLOSURE_BSDF_GLASS_ID)
314 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
315 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
316 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
317 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
318
319 CCL_NAMESPACE_END
320
321 #endif /*  __SVM_TYPES_H__ */
322