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