CameraData Input Cycles 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 64
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 /* note that we do not simply use 0, 1, 2, .. as values for these. this works
34  * around an obscure CUDA bug that happens when compiling for fermi. why it
35  * happens i have no idea, but consecutive values are problematic, maybe it
36  * generates an incorrect jump table. */
37
38 typedef enum NodeType {
39         NODE_END = 0,
40         NODE_CLOSURE_BSDF = 100,
41         NODE_CLOSURE_EMISSION = 200,
42         NODE_CLOSURE_BACKGROUND = 300,
43         NODE_CLOSURE_SET_WEIGHT = 400,
44         NODE_CLOSURE_WEIGHT = 500,
45         NODE_MIX_CLOSURE = 600,
46         NODE_JUMP = 700,
47         NODE_TEX_IMAGE = 1000,
48         NODE_TEX_SKY = 1100,
49         NODE_GEOMETRY = 1200,
50         NODE_LIGHT_PATH = 1300,
51         NODE_VALUE_F = 1400,
52         NODE_VALUE_V = 1500,
53         NODE_MIX = 1600,
54         NODE_ATTR = 1700,
55         NODE_CONVERT = 1900,
56         NODE_FRESNEL = 2000,
57         NODE_EMISSION_WEIGHT = 2100,
58         NODE_TEX_GRADIENT = 2200,
59         NODE_TEX_VORONOI = 2300,
60         NODE_TEX_MUSGRAVE = 2400,
61         NODE_TEX_WAVE = 2500,
62         NODE_TEX_MAGIC = 2600,
63         NODE_TEX_NOISE = 3000,
64         NODE_SHADER_JUMP = 3100,
65         NODE_SET_DISPLACEMENT = 3200,
66         NODE_GEOMETRY_BUMP_DX = 3300,
67         NODE_GEOMETRY_BUMP_DY = 3400,
68         NODE_SET_BUMP = 3500,
69         NODE_MATH = 3600,
70         NODE_VECTOR_MATH = 3700,
71         NODE_MAPPING = 3800,
72         NODE_TEX_COORD = 3900,
73         NODE_TEX_COORD_BUMP_DX = 4000,
74         NODE_TEX_COORD_BUMP_DY = 4100,
75         NODE_ADD_CLOSURE = 4200,
76         NODE_EMISSION_SET_WEIGHT_TOTAL = 4300,
77         NODE_ATTR_BUMP_DX = 4400,
78         NODE_ATTR_BUMP_DY = 4500,
79         NODE_TEX_ENVIRONMENT = 4600,
80         NODE_CLOSURE_HOLDOUT = 4700,
81         NODE_LAYER_WEIGHT = 4800,
82         NODE_CLOSURE_VOLUME = 4900,
83         NODE_SEPARATE_RGB = 5000,
84         NODE_COMBINE_RGB = 5100,
85         NODE_HSV = 5200,
86         NODE_CAMERA = 5300
87 } NodeType;
88
89 typedef enum NodeAttributeType {
90         NODE_ATTR_FLOAT = 0,
91         NODE_ATTR_FLOAT3
92 } NodeAttributeType;
93
94 typedef enum NodeGeometry {
95         NODE_GEOM_P = 0,
96         NODE_GEOM_N,
97         NODE_GEOM_T,
98         NODE_GEOM_I,
99         NODE_GEOM_Ng,
100         NODE_GEOM_uv
101 } NodeGeometry;
102
103 typedef enum NodeLightPath {
104         NODE_LP_camera = 0,
105         NODE_LP_shadow,
106         NODE_LP_diffuse,
107         NODE_LP_glossy,
108         NODE_LP_singular,
109         NODE_LP_reflection,
110         NODE_LP_transmission,
111         NODE_LP_backfacing
112 } NodeLightPath;
113
114 typedef enum NodeTexCoord {
115         NODE_TEXCO_OBJECT,
116         NODE_TEXCO_CAMERA,
117         NODE_TEXCO_WINDOW,
118         NODE_TEXCO_REFLECTION
119 } NodeTexCoord;
120
121 typedef enum NodeMix {
122         NODE_MIX_BLEND = 0,
123         NODE_MIX_ADD,
124         NODE_MIX_MUL,
125         NODE_MIX_SUB,
126         NODE_MIX_SCREEN,
127         NODE_MIX_DIV,
128         NODE_MIX_DIFF,
129         NODE_MIX_DARK,
130         NODE_MIX_LIGHT,
131         NODE_MIX_OVERLAY,
132         NODE_MIX_DODGE,
133         NODE_MIX_BURN,
134         NODE_MIX_HUE,
135         NODE_MIX_SAT,
136         NODE_MIX_VAL,
137         NODE_MIX_COLOR,
138         NODE_MIX_SOFT,
139         NODE_MIX_LINEAR
140 } NodeMix;
141
142 typedef enum NodeMath {
143         NODE_MATH_ADD,
144         NODE_MATH_SUBTRACT,
145         NODE_MATH_MULTIPLY,
146         NODE_MATH_DIVIDE,
147         NODE_MATH_SINE,
148         NODE_MATH_COSINE,
149         NODE_MATH_TANGENT,
150         NODE_MATH_ARCSINE,
151         NODE_MATH_ARCCOSINE,
152         NODE_MATH_ARCTANGENT,
153         NODE_MATH_POWER,
154         NODE_MATH_LOGARITHM,
155         NODE_MATH_MINIMUM,
156         NODE_MATH_MAXIMUM,
157         NODE_MATH_ROUND,
158         NODE_MATH_LESS_THAN,
159         NODE_MATH_GREATER_THAN
160 } NodeMath;
161
162 typedef enum NodeVectorMath {
163         NODE_VECTOR_MATH_ADD,
164         NODE_VECTOR_MATH_SUBTRACT,
165         NODE_VECTOR_MATH_AVERAGE,
166         NODE_VECTOR_MATH_DOT_PRODUCT,
167         NODE_VECTOR_MATH_CROSS_PRODUCT,
168         NODE_VECTOR_MATH_NORMALIZE
169 } NodeVectorMath;
170
171 typedef enum NodeConvert {
172         NODE_CONVERT_FV,
173         NODE_CONVERT_CF,
174         NODE_CONVERT_VF
175 } NodeConvert;
176
177 typedef enum NodeDistanceMetric {
178         NODE_VORONOI_DISTANCE_SQUARED,
179         NODE_VORONOI_ACTUAL_DISTANCE,
180         NODE_VORONOI_MANHATTAN,
181         NODE_VORONOI_CHEBYCHEV,
182         NODE_VORONOI_MINKOVSKY_H,
183         NODE_VORONOI_MINKOVSKY_4,
184         NODE_VORONOI_MINKOVSKY
185 } NodeDistanceMetric;
186
187 typedef enum NodeNoiseBasis {
188         NODE_NOISE_PERLIN,
189         NODE_NOISE_VORONOI_F1,
190         NODE_NOISE_VORONOI_F2,
191         NODE_NOISE_VORONOI_F3,
192         NODE_NOISE_VORONOI_F4,
193         NODE_NOISE_VORONOI_F2_F1,
194         NODE_NOISE_VORONOI_CRACKLE,
195         NODE_NOISE_CELL_NOISE
196 } NodeNoiseBasis;
197
198 typedef enum NodeWaveType {
199         NODE_WAVE_SINE,
200         NODE_WAVE_SAW,
201         NODE_WAVE_TRI
202 } NodeWaveType;
203
204 typedef enum NodeMusgraveType {
205         NODE_MUSGRAVE_MULTIFRACTAL,
206         NODE_MUSGRAVE_FBM,
207         NODE_MUSGRAVE_HYBRID_MULTIFRACTAL,
208         NODE_MUSGRAVE_RIDGED_MULTIFRACTAL,
209         NODE_MUSGRAVE_HETERO_TERRAIN
210 } NodeMusgraveType;
211
212 typedef enum NodeWoodType {
213         NODE_WAVE_BANDS,
214         NODE_WAVE_RINGS
215 } NodeWoodType;
216
217 typedef enum NodeBlendType {
218         NODE_BLEND_LINEAR,
219         NODE_BLEND_QUADRATIC,
220         NODE_BLEND_EASING,
221         NODE_BLEND_DIAGONAL,
222         NODE_BLEND_RADIAL,
223         NODE_BLEND_QUADRATIC_SPHERE,
224         NODE_BLEND_SPHERICAL
225 } NodeBlendType;
226
227 typedef enum NodeBlendAxis {
228         NODE_BLEND_HORIZONTAL,
229         NODE_BLEND_VERTICAL
230 } NodeBlendAxis;
231
232 typedef enum NodeMarbleType {
233         NODE_MARBLE_SOFT,
234         NODE_MARBLE_SHARP,
235         NODE_MARBLE_SHARPER
236 } NodeMarbleType;
237
238 typedef enum NodeStucciType {
239         NODE_STUCCI_PLASTIC,
240         NODE_STUCCI_WALL_IN,
241         NODE_STUCCI_WALL_OUT
242 } NodeStucciType;
243
244 typedef enum NodeVoronoiColoring {
245         NODE_VORONOI_INTENSITY,
246         NODE_VORONOI_CELLS
247 } NodeVoronoiColoring;
248
249 typedef enum NodeBlendWeightType {
250         NODE_LAYER_WEIGHT_FRESNEL,
251         NODE_LAYER_WEIGHT_FACING
252 } NodeBlendWeightType;
253
254 typedef enum ShaderType {
255         SHADER_TYPE_SURFACE,
256         SHADER_TYPE_VOLUME,
257         SHADER_TYPE_DISPLACEMENT
258 } ShaderType;
259
260 /* Closure */
261
262 typedef enum ClosureType {
263         CLOSURE_BSDF_ID,
264         CLOSURE_BSDF_DIFFUSE_ID,
265         CLOSURE_BSDF_OREN_NAYAR_ID,
266         CLOSURE_BSDF_TRANSLUCENT_ID,
267         CLOSURE_BSDF_REFLECTION_ID,
268         CLOSURE_BSDF_REFRACTION_ID,
269         CLOSURE_BSDF_GLASS_ID,
270         CLOSURE_BSDF_TRANSPARENT_ID,
271         CLOSURE_BSDF_MICROFACET_GGX_ID,
272         CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
273         CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
274         CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
275         CLOSURE_BSDF_WARD_ID,
276         CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
277         CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
278         CLOSURE_BSDF_WESTIN_SHEEN_ID,
279
280         CLOSURE_BSSRDF_CUBIC_ID,
281         CLOSURE_EMISSION_ID,
282         CLOSURE_DEBUG_ID,
283         CLOSURE_BACKGROUND_ID,
284         CLOSURE_HOLDOUT_ID,
285         CLOSURE_SUBSURFACE_ID,
286
287         CLOSURE_VOLUME_ID,
288         CLOSURE_VOLUME_TRANSPARENT_ID,
289         CLOSURE_VOLUME_ISOTROPIC_ID,
290
291         NBUILTIN_CLOSURES
292 } ClosureType;
293
294 /* watch this, being lazy with memory usage */
295 #define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
296 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
297 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
298 #define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
299 #define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
300
301 CCL_NAMESPACE_END
302
303 #endif /*  __SVM_TYPES_H__ */
304