Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DNA_material_types.h « makesdna « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eb469895fd771a6b223886f7ce2ba31cfe502220 (plain)
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
/*
 * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 *****
 */

/** \file DNA_material_types.h
 *  \ingroup DNA
 */

#ifndef __DNA_MATERIAL_TYPES_H__
#define __DNA_MATERIAL_TYPES_H__

#include "DNA_defs.h"
#include "DNA_ID.h"
#include "DNA_listBase.h"

#ifndef MAX_MTEX
#define MAX_MTEX	18
#endif

struct Image;
struct bNodeTree;
struct AnimData;
struct Ipo;

/* WATCH IT: change type? also make changes in ipo.h  */

typedef struct TexPaintSlot {
	struct Image *ima; /* image to be painted on */
	char *uvname;      /* customdata index for uv layer, MAX_NAME*/
	int valid;         /* do we have a valid image and UV map */
	int pad;
} TexPaintSlot;

typedef struct Material {
	ID id;
	struct AnimData *adt;	/* animation data (must be immediately after id for utilities to use it) */

	short flag, pad1[7];

	/* Colors from Blender Internal that we are still using. */
	float r, g, b;
	float specr, specg, specb;
	float alpha DNA_DEPRECATED;
	float ray_mirror  DNA_DEPRECATED;
	float spec;
	float gloss_mir  DNA_DEPRECATED; /* renamed and inversed to roughness */
	float roughness;
	float metallic;
	float pad4[2];

	/* Ror buttons and render. */
	char pr_type, use_nodes;
	short pr_lamp, pr_texture;

	/* Index for render passes. */
	short index;

	struct bNodeTree *nodetree;
	struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated for 2.5 */
	struct PreviewImage *preview;

	/* Freestyle line settings. */
	float line_col[4];
	short line_priority;
	short vcol_alpha;

	/* Texture painting slots. */
	short paint_active_slot;
	short paint_clone_slot;
	short tot_slots;
	short pad2[3];

	/* Transparency. */
	float alpha_threshold;
	float refract_depth;
	char blend_method;
	char blend_shadow;
	char blend_flag;
	char pad3[5];

	/* Cached slots for texture painting, must be refreshed in
	 * refresh_texpaint_image_cache before using. */
	struct TexPaintSlot *texpaintslot;

	/* Runtime cache for GLSL materials. */
	ListBase gpumaterial;
} Material;

/* **************** MATERIAL ********************* */

/* maximum number of materials per material array.
 * (on object, mesh, lamp, etc.). limited by
 * short mat_nr in verts, faces.
 * -1 because for active material we store the index + 1 */
#define MAXMAT			(32767-1)

/* flag */
		/* for render */
#define MA_IS_USED		1
		/* for dopesheet */
#define MA_DS_EXPAND	2
		/* for dopesheet (texture stack expander)
		 * NOTE: this must have the same value as other texture stacks,
		 * otherwise anim-editors will not read correctly
		 */
#define MA_DS_SHOW_TEXS	4

/* ramps */
#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
#define MA_RAMP_SOFT        16
#define MA_RAMP_LINEAR      17

/* 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  // DEPRECATED
#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_PARTICLE	8192 /* strand is used for normal materials, particle for halo materials */
#define TEXCO_STRESS	16384
#define TEXCO_SPEED		32768

/* mapto */
#define MAP_COL			1
#define MAP_ALPHA		128

/* 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
#define MAP_PA_FREQ		1024

/* 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

/* blend_method */
enum {
	MA_BM_SOLID,
	MA_BM_ADD,
	MA_BM_MULTIPLY,
	MA_BM_CLIP,
	MA_BM_HASHED,
	MA_BM_BLEND,
};

/* blend_flag */
enum {
	MA_BL_HIDE_BACKSIDE =        (1 << 0),
	MA_BL_SS_REFRACTION =        (1 << 1),
	MA_BL_SS_SUBSURFACE =        (1 << 2),
	MA_BL_TRANSLUCENCY =         (1 << 3),
};

/* blend_shadow */
enum {
	MA_BS_NONE = 0,
	MA_BS_SOLID,
	MA_BS_CLIP,
	MA_BS_HASHED,
};

#endif