2 * blenlib/DNA_material_types.h (mar-2001 nzc)
6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL LICENSE BLOCK *****
31 #ifndef DNA_MATERIAL_TYPES_H
32 #define DNA_MATERIAL_TYPES_H
35 #include "DNA_scriptlink_types.h"
36 #include "DNA_listBase.h"
49 /* WATCH IT: change type? also make changes in ipo.h */
51 typedef struct Material {
54 short colormodel, flag;
55 /* note, keep this below synced with render_types.h */
57 float specr, specg, specb;
58 float mirr, mirg, mirb;
59 float ambr, ambb, ambg;
60 float amb, emit, ang, spectra, ray_mirror;
61 float alpha, ref, spec, zoffs, add;
63 /* end synced with render_types.h */
65 short material_type; /* solid, halo, volumetric */
69 short vol_stepsize_type;
70 short vol_precache_resolution;
71 float vol_stepsize, vol_shade_stepsize;
72 float vol_depth_cutoff;
75 float vol_density_scale;
76 float vol_absorption, vol_scattering;
77 float vol_absorption_col[3];
79 short vol_phasefunc_type;
80 float vol_phasefunc_g;
83 float vol_ms_diff, vol_ms_intensity;
86 float fresnel_mir, fresnel_mir_i;
87 float fresnel_tra, fresnel_tra_i;
88 float filter; /* filter added, for raytrace transparency and transmissivity */
89 float tx_limit, tx_falloff;
90 short ray_depth, ray_depth_tra;
94 float gloss_mir, gloss_tra;
95 short samp_gloss_mir, samp_gloss_tra;
96 float adapt_thresh_mir, adapt_thresh_tra;
97 float aniso_gloss_mir;
100 short shade_flag; /* like Cubic interpolation */
102 int mode, mode_l; /* mode_l is the or-ed result of all layer modes */
103 short flarec, starc, linec, ringc;
104 float hasize, flaresize, subsize, flareboost;
105 float strand_sta, strand_end, strand_ease, strand_surfnor;
106 float strand_min, strand_widthfade;
107 char strand_uvname[32];
109 float sbias; /* shadow bias to prevent terminator prob */
110 float lbias; /* factor to multiply lampbias with (0.0 = no mult) */
111 float shad_alpha; /* in use for irregular shadowbuffer */
114 /* for buttons and render*/
115 char rgbsel, texact, pr_type, use_nodes;
116 short pr_back, pr_lamp, pad4, ml_flag; /* ml_flag is for disable base material */
119 short diff_shader, spec_shader;
120 float roughness, refrac;
121 float param[4]; /* size, smooth, size, smooth, for toonshader */
127 struct ColorBand *ramp_col;
128 struct ColorBand *ramp_spec;
129 char rampin_col, rampin_spec;
130 char rampblend_col, rampblend_spec;
131 short ramp_show, pad3;
132 float rampfac_col, rampfac_spec;
134 struct MTex *mtex[18]; /* MAX_MTEX */
135 struct bNodeTree *nodetree;
137 struct Group *group; /* light group */
138 struct PreviewImage * preview;
140 /* dynamic properties */
141 float friction, fh, reflect;
142 float fhdist, xyfrict;
143 short dynamode, pad2;
145 /* subsurface scattering */
146 float sss_radius[3], sss_col[3];
147 float sss_error, sss_scale, sss_ior;
148 float sss_colfac, sss_texfac;
149 float sss_front, sss_back;
150 short sss_flag, sss_preset;
152 /* yafray: absorption color, dispersion parameters and material preset menu */
153 float YF_ar, YF_ag, YF_ab, YF_dscale, YF_dpwr;
154 int YF_dsmp, YF_preset, YF_djit;
156 ScriptLink scriptlink;
158 ListBase gpumaterial; /* runtime */
161 /* **************** MATERIAL ********************* */
163 /* maximum number of materials per material array
164 * (on object, mesh, lamp, etc.)
177 #define MA_IS_TEXTURED 2
183 #define MA_VOLUMESOLID 3
186 #define MA_TRACEBLE 1
190 #define MA_VERTEXCOL 16
191 #define MA_HALO_SOFT 16
194 #define MA_VERTEXCOLP 128
196 #define MA_HALO_RINGS 256
198 #define MA_HALO_LINES 512
199 #define MA_ONLYSHADOW 1024
200 #define MA_HALO_XALPHA 1024
201 #define MA_STAR 0x800
202 #define MA_FACETEXTURE 0x800
203 #define MA_HALOTEX 0x1000
204 #define MA_HALOPUNO 0x2000
205 #define MA_ONLYCAST 0x2000
206 #define MA_NOMIST 0x4000
207 #define MA_HALO_SHADE 0x4000
208 #define MA_HALO_FLARE 0x8000
209 #define MA_RADIO 0x10000
210 #define MA_RAYTRANSP 0x20000
211 #define MA_RAYMIRROR 0x40000
212 #define MA_SHADOW_TRA 0x80000
213 #define MA_RAMP_COL 0x100000
214 #define MA_RAMP_SPEC 0x200000
215 #define MA_RAYBIAS 0x400000
216 #define MA_FULL_OSA 0x800000
217 #define MA_TANGENT_STR 0x1000000
218 #define MA_SHADBUF 0x2000000
219 /* note; we drop MA_TANGENT_STR later to become tangent_u */
220 #define MA_TANGENT_V 0x4000000
221 /* qdn: a bit clumsy this, tangents needed for normal maps separated from shading */
222 #define MA_NORMAP_TANG 0x8000000
223 #define MA_GROUP_NOLAY 0x10000000
224 #define MA_FACETEXTURE_ALPHA 0x20000000
225 #define MA_STR_B_UNITS 0x40000000
226 #define MA_STR_SURFDIFF 0x80000000
228 #define MA_MODE_MASK 0x6fffffff /* all valid mode bits */
230 /* ray mirror fadeout */
231 #define MA_RAYMIR_FADETOSKY 0
232 #define MA_RAYMIR_FADETOMAT 1
239 #define MA_DIFF_LAMBERT 0
240 #define MA_DIFF_ORENNAYAR 1
241 #define MA_DIFF_TOON 2
242 #define MA_DIFF_MINNAERT 3
243 #define MA_DIFF_FRESNEL 4
246 #define MA_SPEC_COOKTORR 0
247 #define MA_SPEC_PHONG 1
248 #define MA_SPEC_BLINN 2
249 #define MA_SPEC_TOON 3
250 #define MA_SPEC_WARDISO 4
253 #define MA_DRAW_DYNABUTS 1
257 #define MA_RAMP_IN_SHADER 0
258 #define MA_RAMP_IN_ENERGY 1
259 #define MA_RAMP_IN_NOR 2
260 #define MA_RAMP_IN_RESULT 3
262 #define MA_RAMP_BLEND 0
263 #define MA_RAMP_ADD 1
264 #define MA_RAMP_MULT 2
265 #define MA_RAMP_SUB 3
266 #define MA_RAMP_SCREEN 4
267 #define MA_RAMP_DIV 5
268 #define MA_RAMP_DIFF 6
269 #define MA_RAMP_DARK 7
270 #define MA_RAMP_LIGHT 8
271 #define MA_RAMP_OVERLAY 9
272 #define MA_RAMP_DODGE 10
273 #define MA_RAMP_BURN 11
274 #define MA_RAMP_HUE 12
275 #define MA_RAMP_SAT 13
276 #define MA_RAMP_VAL 14
277 #define MA_RAMP_COLOR 15
285 #define TEXCO_OBJECT 32
286 #define TEXCO_LAVECTOR 64
287 #define TEXCO_VIEW 128
288 #define TEXCO_STICKY 256
289 #define TEXCO_OSA 512
290 #define TEXCO_WINDOW 1024
292 #define TEXCO_TANGENT 4096
293 /* still stored in vertex->accum, 1 D */
294 #define TEXCO_STRAND 8192
295 #define TEXCO_STRESS 16384
296 #define TEXCO_SPEED 32768
301 #define MAP_COLSPEC 4
303 #define MAP_VARS (0xFFF0)
307 #define MAP_ALPHA 128
309 #define MAP_RAYMIRR 512
310 #define MAP_TRANSLU 1024
312 #define MAP_DISPLACE 4096
313 #define MAP_WARP 8192
314 #define MAP_LAYER 16384
317 //#define MAP_HA_COL 1
318 //#define MAP_HA_ALPHA 128
319 //#define MAP_HA_HAR 256
320 //#define MAP_HA_SIZE 2
321 //#define MAP_HA_ADD 64
325 #define MAP_PA_INIT 31
326 #define MAP_PA_TIME 1
327 #define MAP_PA_LIFE 2
328 #define MAP_PA_DENS 4
329 #define MAP_PA_SIZE 8
330 #define MAP_PA_LENGTH 16
332 #define MAP_PA_IVEL 32
334 #define MAP_PA_PVEL 64
336 #define MAP_PA_CACHE 912
337 #define MAP_PA_CLUMP 128
338 #define MAP_PA_KINK 256
339 #define MAP_PA_ROUGH 512
346 #define MA_SPHERE_A 4
357 #define MA_DIFF_SSS 1
359 /* vol_stepsize_type */
360 #define MA_VOL_STEP_RANDOMIZED 0
361 #define MA_VOL_STEP_CONSTANT 1
362 #define MA_VOL_STEP_ADAPTIVE 2
365 #define MA_VOL_SHADED 1
366 #define MA_VOL_RECVSHADOW 4
367 #define MA_VOL_PRECACHESHADING 8
368 #define MA_VOL_USEALPHA 16
370 /* vol_shading_type */
371 #define MA_VOL_SHADE_NONE 0
372 #define MA_VOL_SHADE_SINGLE 1
373 #define MA_VOL_SHADE_MULTIPLE 2
374 #define MA_VOL_SHADE_SINGLEPLUSMULTIPLE 3
376 /* vol_phasefunc_type */
377 #define MA_VOL_PH_ISOTROPIC 0
378 #define MA_VOL_PH_MIEHAZY 1
379 #define MA_VOL_PH_MIEMURKY 2
380 #define MA_VOL_PH_RAYLEIGH 3
381 #define MA_VOL_PH_HG 4
382 #define MA_VOL_PH_SCHLICK 5