1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
/**
* blenlib/DNA_material_types.h (mar-2001 nzc)
*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef DNA_MATERIAL_TYPES_H
#define DNA_MATERIAL_TYPES_H
#include "DNA_ID.h"
#include "DNA_listBase.h"
#ifndef MAX_MTEX
#define MAX_MTEX 18
#endif
struct MTex;
struct ColorBand;
struct Group;
struct bNodeTree;
struct AnimData;
struct Ipo;
/* WATCH IT: change type? also make changes in ipo.h */
typedef struct VolumeSettings {
short stepsize_type;
short precache_resolution;
float stepsize, shade_stepsize;
float depth_cutoff;
short shade_type;
short vpad;
float density_scale;
float absorption, scattering;
float absorption_col[3];
short shadeflag;
short phasefunc_type;
float phasefunc_g;
float vpad2[2];
float ms_diff, ms_intensity;
int ms_steps;
} VolumeSettings;
typedef struct Material {
ID id;
struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
short material_type, flag;
/* note, keep this below synced with render_types.h */
float r, g, b;
float specr, specg, specb;
float mirr, mirg, mirb;
float ambr, ambb, ambg;
float amb, emit, ang, spectra, ray_mirror;
float alpha, ref, spec, zoffs, add;
float translucency;
/* end synced with render_types.h */
struct VolumeSettings vol;
float fresnel_mir, fresnel_mir_i;
float fresnel_tra, fresnel_tra_i;
float filter; /* filter added, for raytrace transparency and transmissivity */
float tx_limit, tx_falloff;
short ray_depth, ray_depth_tra;
short har;
char seed1, seed2;
float gloss_mir, gloss_tra;
short samp_gloss_mir, samp_gloss_tra;
float adapt_thresh_mir, adapt_thresh_tra;
float aniso_gloss_mir;
float dist_mir;
short fadeto_mir;
short shade_flag; /* like Cubic interpolation */
int mode, mode_l; /* mode_l is the or-ed result of all layer modes */
short flarec, starc, linec, ringc;
float hasize, flaresize, subsize, flareboost;
float strand_sta, strand_end, strand_ease, strand_surfnor;
float strand_min, strand_widthfade;
char strand_uvname[32];
float sbias; /* shadow bias to prevent terminator prob */
float lbias; /* factor to multiply lampbias with (0.0 = no mult) */
float shad_alpha; /* in use for irregular shadowbuffer */
int septex;
/* for buttons and render*/
char rgbsel, texact, pr_type, use_nodes;
short pr_back, pr_lamp, pr_texture, ml_flag; /* ml_flag is for disable base material */
/* shaders */
short diff_shader, spec_shader;
float roughness, refrac;
/* XXX param[4] needs review and improvement (shader system as whole anyway)
This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */
float param[4]; /* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */
float rms;
float darkness;
short texco, mapto;
/* ramp colors */
struct ColorBand *ramp_col;
struct ColorBand *ramp_spec;
char rampin_col, rampin_spec;
char rampblend_col, rampblend_spec;
short ramp_show, pad3;
float rampfac_col, rampfac_spec;
struct MTex *mtex[18]; /* MAX_MTEX */
struct bNodeTree *nodetree;
struct Ipo *ipo; // XXX depreceated... old animation system
struct Group *group; /* light group */
struct PreviewImage * preview;
/* dynamic properties */
float friction, fh, reflect;
float fhdist, xyfrict;
short dynamode, pad2;
/* subsurface scattering */
float sss_radius[3], sss_col[3];
float sss_error, sss_scale, sss_ior;
float sss_colfac, sss_texfac;
float sss_front, sss_back;
short sss_flag, sss_preset;
/* yafray: absorption color, dispersion parameters and material preset menu */
float YF_ar, YF_ag, YF_ab, YF_dscale, YF_dpwr;
int YF_dsmp, YF_preset, YF_djit;
ListBase gpumaterial; /* runtime */
} Material;
/* **************** MATERIAL ********************* */
/* maximum number of materials per material array.
* (on object, mesh, lamp, etc.). limited by
* short mat_nr in verts, faces. */
#define MAXMAT 32767
/* material_type */
#define MA_TYPE_SURFACE 0
#define MA_TYPE_HALO 1
#define MA_TYPE_VOLUME 2
#define MA_TYPE_WIRE 3
/* flag */
/* for render */
#define MA_IS_USED 1
/* for dopesheet */
#define MA_DS_EXPAND 2
/* mode (is int) */
#define MA_TRACEBLE 1
#define MA_SHADOW 2
#define MA_SHLESS 4
#define MA_WIRE 8 /* deprecated */
#define MA_VERTEXCOL 16
#define MA_HALO_SOFT 16
#define MA_HALO 32 /* deprecated */
#define MA_ZTRA 64
#define MA_VERTEXCOLP 128
#define MA_ZINV 256
#define MA_HALO_RINGS 256
#define MA_ENV 512
#define MA_HALO_LINES 512
#define MA_ONLYSHADOW 1024
#define MA_HALO_XALPHA 1024
#define MA_STAR 0x800
#define MA_FACETEXTURE 0x800
#define MA_HALOTEX 0x1000
#define MA_HALOPUNO 0x2000
#define MA_ONLYCAST 0x2000
#define MA_NOMIST 0x4000
#define MA_HALO_SHADE 0x4000
#define MA_HALO_FLARE 0x8000
#define MA_RADIO 0x10000
#define MA_RAYTRANSP 0x20000
#define MA_RAYMIRROR 0x40000
#define MA_SHADOW_TRA 0x80000
#define MA_RAMP_COL 0x100000
#define MA_RAMP_SPEC 0x200000
#define MA_RAYBIAS 0x400000
#define MA_FULL_OSA 0x800000
#define MA_TANGENT_STR 0x1000000
#define MA_SHADBUF 0x2000000
/* note; we drop MA_TANGENT_STR later to become tangent_u */
#define MA_TANGENT_V 0x4000000
/* qdn: a bit clumsy this, tangents needed for normal maps separated from shading */
#define MA_NORMAP_TANG 0x8000000
#define MA_GROUP_NOLAY 0x10000000
#define MA_FACETEXTURE_ALPHA 0x20000000
#define MA_STR_B_UNITS 0x40000000
#define MA_STR_SURFDIFF 0x80000000
#define MA_MODE_MASK 0x6fffffff /* all valid mode bits */
/* ray mirror fadeout */
#define MA_RAYMIR_FADETOSKY 0
#define MA_RAYMIR_FADETOMAT 1
/* shade_flag */
#define MA_CUBIC 1
#define MA_OBCOLOR 2
/* diff_shader */
#define MA_DIFF_LAMBERT 0
#define MA_DIFF_ORENNAYAR 1
#define MA_DIFF_TOON 2
#define MA_DIFF_MINNAERT 3
#define MA_DIFF_FRESNEL 4
/* spec_shader */
#define MA_SPEC_COOKTORR 0
#define MA_SPEC_PHONG 1
#define MA_SPEC_BLINN 2
#define MA_SPEC_TOON 3
#define MA_SPEC_WARDISO 4
/* dynamode */
#define MA_DRAW_DYNABUTS 1 /* deprecated */
#define MA_FH_NOR 2
/* ramps */
#define MA_RAMP_IN_SHADER 0
#define MA_RAMP_IN_ENERGY 1
#define MA_RAMP_IN_NOR 2
#define MA_RAMP_IN_RESULT 3
#define MA_RAMP_BLEND 0
#define MA_RAMP_ADD 1
#define MA_RAMP_MULT 2
#define MA_RAMP_SUB 3
#define MA_RAMP_SCREEN 4
#define MA_RAMP_DIV 5
#define MA_RAMP_DIFF 6
#define MA_RAMP_DARK 7
#define MA_RAMP_LIGHT 8
#define MA_RAMP_OVERLAY 9
#define MA_RAMP_DODGE 10
#define MA_RAMP_BURN 11
#define MA_RAMP_HUE 12
#define MA_RAMP_SAT 13
#define MA_RAMP_VAL 14
#define MA_RAMP_COLOR 15
/* texco */
#define TEXCO_ORCO 1
#define TEXCO_REFL 2
#define TEXCO_NORM 4
#define TEXCO_GLOB 8
#define TEXCO_UV 16
#define TEXCO_OBJECT 32
#define TEXCO_LAVECTOR 64
#define TEXCO_VIEW 128
#define TEXCO_STICKY 256
#define TEXCO_OSA 512
#define TEXCO_WINDOW 1024
#define NEED_UV 2048
#define TEXCO_TANGENT 4096
/* still stored in vertex->accum, 1 D */
#define TEXCO_STRAND 8192
#define TEXCO_STRESS 16384
#define TEXCO_SPEED 32768
/* mapto */
#define MAP_COL 1
#define MAP_NORM 2
#define MAP_COLSPEC 4
#define MAP_COLMIR 8
#define MAP_VARS (0xFFF0)
#define MAP_REF 16
#define MAP_SPEC 32
#define MAP_EMIT 64
#define MAP_ALPHA 128
#define MAP_HAR 256
#define MAP_RAYMIRR 512
#define MAP_TRANSLU 1024
#define MAP_AMB 2048
#define MAP_DISPLACE 4096
#define MAP_WARP 8192
#define MAP_LAYER 16384
/* mapto for halo */
//#define MAP_HA_COL 1
//#define MAP_HA_ALPHA 128
//#define MAP_HA_HAR 256
//#define MAP_HA_SIZE 2
//#define MAP_HA_ADD 64
/* pmapto */
/* init */
#define MAP_PA_INIT 31
#define MAP_PA_TIME 1
#define MAP_PA_LIFE 2
#define MAP_PA_DENS 4
#define MAP_PA_SIZE 8
#define MAP_PA_LENGTH 16
/* reset */
#define MAP_PA_IVEL 32
/* physics */
#define MAP_PA_PVEL 64
/* path cache */
#define MAP_PA_CACHE 912
#define MAP_PA_CLUMP 128
#define MAP_PA_KINK 256
#define MAP_PA_ROUGH 512
/* pr_type */
#define MA_FLAT 0
#define MA_SPHERE 1
#define MA_CUBE 2
#define MA_MONKEY 3
#define MA_SPHERE_A 4
#define MA_TEXTURE 5
#define MA_LAMP 6
#define MA_SKY 7
#define MA_HAIR 10
#define MA_ATMOS 11
/* pr_back */
#define MA_DARK 1
/* sss_flag */
#define MA_DIFF_SSS 1
/* vol_stepsize_type */
#define MA_VOL_STEP_RANDOMIZED 0
#define MA_VOL_STEP_CONSTANT 1
#define MA_VOL_STEP_ADAPTIVE 2
/* vol_shadeflag */
#define MA_VOL_SHADED 1
#define MA_VOL_RECVSHADOW 4
#define MA_VOL_PRECACHESHADING 8
#define MA_VOL_USEALPHA 16
/* vol_shading_type */
#define MA_VOL_SHADE_NONE 0
#define MA_VOL_SHADE_SINGLE 1
#define MA_VOL_SHADE_MULTIPLE 2
#define MA_VOL_SHADE_SINGLEPLUSMULTIPLE 3
/* vol_phasefunc_type */
#define MA_VOL_PH_ISOTROPIC 0
#define MA_VOL_PH_MIEHAZY 1
#define MA_VOL_PH_MIEMURKY 2
#define MA_VOL_PH_RAYLEIGH 3
#define MA_VOL_PH_HG 4
#define MA_VOL_PH_SCHLICK 5
#endif
|