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 float vol_stepsize, vol_shade_stepsize;
71 float vol_density_scale;
72 float vol_absorption, vol_scattering;
73 float vol_absorption_col[3];
75 short vol_phasefunc_type;
76 float vol_phasefunc_g;
78 float fresnel_mir, fresnel_mir_i;
79 float fresnel_tra, fresnel_tra_i;
80 float filter; /* filter added, for raytrace transparency and transmissivity */
81 float tx_limit, tx_falloff;
82 short ray_depth, ray_depth_tra;
86 float gloss_mir, gloss_tra;
87 short samp_gloss_mir, samp_gloss_tra;
88 float adapt_thresh_mir, adapt_thresh_tra;
89 float aniso_gloss_mir;
92 short shade_flag; /* like Cubic interpolation */
94 int mode, mode_l; /* mode_l is the or-ed result of all layer modes */
95 short flarec, starc, linec, ringc;
96 float hasize, flaresize, subsize, flareboost;
97 float strand_sta, strand_end, strand_ease, strand_surfnor;
98 float strand_min, strand_widthfade;
99 char strand_uvname[32];
101 float sbias; /* shadow bias to prevent terminator prob */
102 float lbias; /* factor to multiply lampbias with (0.0 = no mult) */
103 float shad_alpha; /* in use for irregular shadowbuffer */
106 /* for buttons and render*/
107 char rgbsel, texact, pr_type, use_nodes;
108 short pr_back, pr_lamp, pad4, ml_flag; /* ml_flag is for disable base material */
111 short diff_shader, spec_shader;
112 float roughness, refrac;
113 float param[4]; /* size, smooth, size, smooth, for toonshader */
119 struct ColorBand *ramp_col;
120 struct ColorBand *ramp_spec;
121 char rampin_col, rampin_spec;
122 char rampblend_col, rampblend_spec;
123 short ramp_show, pad3;
124 float rampfac_col, rampfac_spec;
126 struct MTex *mtex[18]; /* MAX_MTEX */
127 struct bNodeTree *nodetree;
129 struct Group *group; /* light group */
130 struct PreviewImage * preview;
132 /* dynamic properties */
133 float friction, fh, reflect;
134 float fhdist, xyfrict;
135 short dynamode, pad2;
137 /* subsurface scattering */
138 float sss_radius[3], sss_col[3];
139 float sss_error, sss_scale, sss_ior;
140 float sss_colfac, sss_texfac;
141 float sss_front, sss_back;
142 short sss_flag, sss_preset;
144 /* yafray: absorption color, dispersion parameters and material preset menu */
145 float YF_ar, YF_ag, YF_ab, YF_dscale, YF_dpwr;
146 int YF_dsmp, YF_preset, YF_djit;
148 ScriptLink scriptlink;
150 ListBase gpumaterial; /* runtime */
153 /* **************** MATERIAL ********************* */
155 /* maximum number of materials per material array
156 * (on object, mesh, lamp, etc.)
169 #define MA_IS_TEXTURED 2
175 #define MA_VOLUMESOLID 3
178 #define MA_TRACEBLE 1
182 #define MA_VERTEXCOL 16
183 #define MA_HALO_SOFT 16
186 #define MA_VERTEXCOLP 128
188 #define MA_HALO_RINGS 256
190 #define MA_HALO_LINES 512
191 #define MA_ONLYSHADOW 1024
192 #define MA_HALO_XALPHA 1024
193 #define MA_STAR 0x800
194 #define MA_FACETEXTURE 0x800
195 #define MA_HALOTEX 0x1000
196 #define MA_HALOPUNO 0x2000
197 #define MA_ONLYCAST 0x2000
198 #define MA_NOMIST 0x4000
199 #define MA_HALO_SHADE 0x4000
200 #define MA_HALO_FLARE 0x8000
201 #define MA_RADIO 0x10000
202 #define MA_RAYTRANSP 0x20000
203 #define MA_RAYMIRROR 0x40000
204 #define MA_SHADOW_TRA 0x80000
205 #define MA_RAMP_COL 0x100000
206 #define MA_RAMP_SPEC 0x200000
207 #define MA_RAYBIAS 0x400000
208 #define MA_FULL_OSA 0x800000
209 #define MA_TANGENT_STR 0x1000000
210 #define MA_SHADBUF 0x2000000
211 /* note; we drop MA_TANGENT_STR later to become tangent_u */
212 #define MA_TANGENT_V 0x4000000
213 /* qdn: a bit clumsy this, tangents needed for normal maps separated from shading */
214 #define MA_NORMAP_TANG 0x8000000
215 #define MA_GROUP_NOLAY 0x10000000
216 #define MA_FACETEXTURE_ALPHA 0x20000000
217 #define MA_STR_B_UNITS 0x40000000
218 #define MA_STR_SURFDIFF 0x80000000
220 #define MA_MODE_MASK 0x6fffffff /* all valid mode bits */
222 /* ray mirror fadeout */
223 #define MA_RAYMIR_FADETOSKY 0
224 #define MA_RAYMIR_FADETOMAT 1
231 #define MA_DIFF_LAMBERT 0
232 #define MA_DIFF_ORENNAYAR 1
233 #define MA_DIFF_TOON 2
234 #define MA_DIFF_MINNAERT 3
235 #define MA_DIFF_FRESNEL 4
238 #define MA_SPEC_COOKTORR 0
239 #define MA_SPEC_PHONG 1
240 #define MA_SPEC_BLINN 2
241 #define MA_SPEC_TOON 3
242 #define MA_SPEC_WARDISO 4
245 #define MA_DRAW_DYNABUTS 1
249 #define MA_RAMP_IN_SHADER 0
250 #define MA_RAMP_IN_ENERGY 1
251 #define MA_RAMP_IN_NOR 2
252 #define MA_RAMP_IN_RESULT 3
254 #define MA_RAMP_BLEND 0
255 #define MA_RAMP_ADD 1
256 #define MA_RAMP_MULT 2
257 #define MA_RAMP_SUB 3
258 #define MA_RAMP_SCREEN 4
259 #define MA_RAMP_DIV 5
260 #define MA_RAMP_DIFF 6
261 #define MA_RAMP_DARK 7
262 #define MA_RAMP_LIGHT 8
263 #define MA_RAMP_OVERLAY 9
264 #define MA_RAMP_DODGE 10
265 #define MA_RAMP_BURN 11
266 #define MA_RAMP_HUE 12
267 #define MA_RAMP_SAT 13
268 #define MA_RAMP_VAL 14
269 #define MA_RAMP_COLOR 15
277 #define TEXCO_OBJECT 32
278 #define TEXCO_LAVECTOR 64
279 #define TEXCO_VIEW 128
280 #define TEXCO_STICKY 256
281 #define TEXCO_OSA 512
282 #define TEXCO_WINDOW 1024
284 #define TEXCO_TANGENT 4096
285 /* still stored in vertex->accum, 1 D */
286 #define TEXCO_STRAND 8192
287 #define TEXCO_STRESS 16384
288 #define TEXCO_SPEED 32768
293 #define MAP_COLSPEC 4
295 #define MAP_VARS (0xFFF0)
299 #define MAP_ALPHA 128
301 #define MAP_RAYMIRR 512
302 #define MAP_TRANSLU 1024
304 #define MAP_DISPLACE 4096
305 #define MAP_WARP 8192
306 #define MAP_LAYER 16384
309 //#define MAP_HA_COL 1
310 //#define MAP_HA_ALPHA 128
311 //#define MAP_HA_HAR 256
312 //#define MAP_HA_SIZE 2
313 //#define MAP_HA_ADD 64
317 #define MAP_PA_INIT 31
318 #define MAP_PA_TIME 1
319 #define MAP_PA_LIFE 2
320 #define MAP_PA_DENS 4
321 #define MAP_PA_SIZE 8
322 #define MAP_PA_LENGTH 16
324 #define MAP_PA_IVEL 32
326 #define MAP_PA_PVEL 64
328 #define MAP_PA_CACHE 912
329 #define MAP_PA_CLUMP 128
330 #define MAP_PA_KINK 256
331 #define MAP_PA_ROUGH 512
338 #define MA_SPHERE_A 4
349 #define MA_DIFF_SSS 1
351 /* vol_stepsize_type */
352 #define MA_VOL_STEP_RANDOMIZED 0
353 #define MA_VOL_STEP_CONSTANT 1
354 #define MA_VOL_STEP_ADAPTIVE 2
357 #define MA_VOL_SHADED 1
358 #define MA_VOL_ATTENUATED 2
359 #define MA_VOL_RECVSHADOW 4
361 /* vol_phasefunc_type */
362 #define MA_VOL_PH_ISOTROPIC 0
363 #define MA_VOL_PH_MIEHAZY 1
364 #define MA_VOL_PH_MIEMURKY 2
365 #define MA_VOL_PH_RAYLEIGH 3
366 #define MA_VOL_PH_HG 4
367 #define MA_VOL_PH_SCHLICK 5