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_listBase.h"
48 /* WATCH IT: change type? also make changes in ipo.h */
50 typedef struct VolumeSettings {
56 float emission_col[3];
57 float absorption_col[3];
71 short precache_resolution;
78 typedef struct Material {
80 struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
82 short material_type, flag;
83 /* note, keep this below synced with render_types.h */
85 float specr, specg, specb;
86 float mirr, mirg, mirb;
87 float ambr, ambb, ambg;
88 float amb, emit, ang, spectra, ray_mirror;
89 float alpha, ref, spec, zoffs, add;
91 /* end synced with render_types.h */
93 struct VolumeSettings vol;
95 float fresnel_mir, fresnel_mir_i;
96 float fresnel_tra, fresnel_tra_i;
97 float filter; /* filter added, for raytrace transparency and transmissivity */
98 float tx_limit, tx_falloff;
99 short ray_depth, ray_depth_tra;
103 float gloss_mir, gloss_tra;
104 short samp_gloss_mir, samp_gloss_tra;
105 float adapt_thresh_mir, adapt_thresh_tra;
106 float aniso_gloss_mir;
109 short shade_flag; /* like Cubic interpolation */
111 int mode, mode_l; /* mode_l is the or-ed result of all layer modes */
112 short flarec, starc, linec, ringc;
113 float hasize, flaresize, subsize, flareboost;
114 float strand_sta, strand_end, strand_ease, strand_surfnor;
115 float strand_min, strand_widthfade;
116 char strand_uvname[32];
118 float sbias; /* shadow bias to prevent terminator prob */
119 float lbias; /* factor to multiply lampbias with (0.0 = no mult) */
120 float shad_alpha; /* in use for irregular shadowbuffer */
123 /* for buttons and render*/
124 char rgbsel, texact, pr_type, use_nodes;
125 short pr_back, pr_lamp, pr_texture, ml_flag; /* ml_flag is for disable base material */
128 short diff_shader, spec_shader;
129 float roughness, refrac;
130 /* XXX param[4] needs review and improvement (shader system as whole anyway)
131 This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */
132 float param[4]; /* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */
138 struct ColorBand *ramp_col;
139 struct ColorBand *ramp_spec;
140 char rampin_col, rampin_spec;
141 char rampblend_col, rampblend_spec;
142 short ramp_show, pad3;
143 float rampfac_col, rampfac_spec;
145 struct MTex *mtex[18]; /* MAX_MTEX */
146 struct bNodeTree *nodetree;
147 struct Ipo *ipo; // XXX depreceated... old animation system
148 struct Group *group; /* light group */
149 struct PreviewImage * preview;
151 /* dynamic properties */
152 float friction, fh, reflect;
153 float fhdist, xyfrict;
154 short dynamode, pad2;
156 /* subsurface scattering */
157 float sss_radius[3], sss_col[3];
158 float sss_error, sss_scale, sss_ior;
159 float sss_colfac, sss_texfac;
160 float sss_front, sss_back;
161 short sss_flag, sss_preset;
163 /* yafray: absorption color, dispersion parameters and material preset menu */
164 float YF_ar, YF_ag, YF_ab, YF_dscale, YF_dpwr;
165 int YF_dsmp, YF_preset, YF_djit;
167 ListBase gpumaterial; /* runtime */
170 /* **************** MATERIAL ********************* */
172 /* maximum number of materials per material array.
173 * (on object, mesh, lamp, etc.). limited by
174 * short mat_nr in verts, faces. */
178 #define MA_TYPE_SURFACE 0
179 #define MA_TYPE_HALO 1
180 #define MA_TYPE_VOLUME 2
181 #define MA_TYPE_WIRE 3
187 #define MA_DS_EXPAND 2
190 #define MA_TRACEBLE 1
193 #define MA_WIRE 8 /* deprecated */
194 #define MA_VERTEXCOL 16
195 #define MA_HALO_SOFT 16
196 #define MA_HALO 32 /* deprecated */
198 #define MA_VERTEXCOLP 128
200 #define MA_HALO_RINGS 256
202 #define MA_HALO_LINES 512
203 #define MA_ONLYSHADOW 1024
204 #define MA_HALO_XALPHA 1024
205 #define MA_STAR 0x800
206 #define MA_FACETEXTURE 0x800
207 #define MA_HALOTEX 0x1000
208 #define MA_HALOPUNO 0x2000
209 #define MA_ONLYCAST 0x2000
210 #define MA_NOMIST 0x4000
211 #define MA_HALO_SHADE 0x4000
212 #define MA_HALO_FLARE 0x8000
213 #define MA_RADIO 0x10000
214 #define MA_RAYTRANSP 0x20000
215 #define MA_RAYMIRROR 0x40000
216 #define MA_SHADOW_TRA 0x80000
217 #define MA_RAMP_COL 0x100000
218 #define MA_RAMP_SPEC 0x200000
219 #define MA_RAYBIAS 0x400000
220 #define MA_FULL_OSA 0x800000
221 #define MA_TANGENT_STR 0x1000000
222 #define MA_SHADBUF 0x2000000
223 /* note; we drop MA_TANGENT_STR later to become tangent_u */
224 #define MA_TANGENT_V 0x4000000
225 /* qdn: a bit clumsy this, tangents needed for normal maps separated from shading */
226 #define MA_NORMAP_TANG 0x8000000
227 #define MA_GROUP_NOLAY 0x10000000
228 #define MA_FACETEXTURE_ALPHA 0x20000000
229 #define MA_STR_B_UNITS 0x40000000
230 #define MA_STR_SURFDIFF 0x80000000
232 #define MA_MODE_MASK 0x6fffffff /* all valid mode bits */
234 /* ray mirror fadeout */
235 #define MA_RAYMIR_FADETOSKY 0
236 #define MA_RAYMIR_FADETOMAT 1
243 #define MA_DIFF_LAMBERT 0
244 #define MA_DIFF_ORENNAYAR 1
245 #define MA_DIFF_TOON 2
246 #define MA_DIFF_MINNAERT 3
247 #define MA_DIFF_FRESNEL 4
250 #define MA_SPEC_COOKTORR 0
251 #define MA_SPEC_PHONG 1
252 #define MA_SPEC_BLINN 2
253 #define MA_SPEC_TOON 3
254 #define MA_SPEC_WARDISO 4
257 #define MA_DRAW_DYNABUTS 1 /* deprecated */
261 #define MA_RAMP_IN_SHADER 0
262 #define MA_RAMP_IN_ENERGY 1
263 #define MA_RAMP_IN_NOR 2
264 #define MA_RAMP_IN_RESULT 3
266 #define MA_RAMP_BLEND 0
267 #define MA_RAMP_ADD 1
268 #define MA_RAMP_MULT 2
269 #define MA_RAMP_SUB 3
270 #define MA_RAMP_SCREEN 4
271 #define MA_RAMP_DIV 5
272 #define MA_RAMP_DIFF 6
273 #define MA_RAMP_DARK 7
274 #define MA_RAMP_LIGHT 8
275 #define MA_RAMP_OVERLAY 9
276 #define MA_RAMP_DODGE 10
277 #define MA_RAMP_BURN 11
278 #define MA_RAMP_HUE 12
279 #define MA_RAMP_SAT 13
280 #define MA_RAMP_VAL 14
281 #define MA_RAMP_COLOR 15
289 #define TEXCO_OBJECT 32
290 #define TEXCO_LAVECTOR 64
291 #define TEXCO_VIEW 128
292 #define TEXCO_STICKY 256
293 #define TEXCO_OSA 512
294 #define TEXCO_WINDOW 1024
296 #define TEXCO_TANGENT 4096
297 /* still stored in vertex->accum, 1 D */
298 #define TEXCO_STRAND 8192
299 #define TEXCO_STRESS 16384
300 #define TEXCO_SPEED 32768
305 #define MAP_COLSPEC 4
307 #define MAP_VARS (0xFFF0)
311 #define MAP_ALPHA 128
313 #define MAP_RAYMIRR 512
314 #define MAP_TRANSLU 1024
316 #define MAP_DISPLACE 4096
317 #define MAP_WARP 8192
318 #define MAP_LAYER 16384
320 /* volume mapto - reuse definitions for now - a bit naughty! */
321 #define MAP_DENSITY 128
322 #define MAP_EMISSION 64
323 #define MAP_EMISSION_COL 1
324 #define MAP_ABSORPTION 512
325 #define MAP_ABSORPTION_COL 8
326 #define MAP_SCATTERING 16
329 //#define MAP_HA_COL 1
330 //#define MAP_HA_ALPHA 128
331 //#define MAP_HA_HAR 256
332 //#define MAP_HA_SIZE 2
333 //#define MAP_HA_ADD 64
337 #define MAP_PA_INIT 31
338 #define MAP_PA_TIME 1
339 #define MAP_PA_LIFE 2
340 #define MAP_PA_DENS 4
341 #define MAP_PA_SIZE 8
342 #define MAP_PA_LENGTH 16
344 #define MAP_PA_IVEL 32
346 #define MAP_PA_PVEL 64
348 #define MAP_PA_CACHE 912
349 #define MAP_PA_CLUMP 128
350 #define MAP_PA_KINK 256
351 #define MAP_PA_ROUGH 512
358 #define MA_SPHERE_A 4
369 #define MA_DIFF_SSS 1
371 /* vol_stepsize_type */
372 #define MA_VOL_STEP_RANDOMIZED 0
373 #define MA_VOL_STEP_CONSTANT 1
374 #define MA_VOL_STEP_ADAPTIVE 2
377 #define MA_VOL_SHADED 1
378 #define MA_VOL_RECVSHADOW 4
379 #define MA_VOL_PRECACHESHADING 8
380 #define MA_VOL_USEALPHA 16
382 /* vol_shading_type */
383 #define MA_VOL_SHADE_NONE 0
384 #define MA_VOL_SHADE_SINGLE 1
385 #define MA_VOL_SHADE_MULTIPLE 2
386 #define MA_VOL_SHADE_SINGLEPLUSMULTIPLE 3
388 /* vol_phasefunc_type */
389 #define MA_VOL_PH_ISOTROPIC 0
390 #define MA_VOL_PH_MIEHAZY 1
391 #define MA_VOL_PH_MIEMURKY 2
392 #define MA_VOL_PH_RAYLEIGH 3
393 #define MA_VOL_PH_HG 4
394 #define MA_VOL_PH_SCHLICK 5