LEFT | RIGHT |
1 | 1 |
2 /** \file BL_Material.h | 2 /** \file BL_Material.h |
3 * \ingroup ketsji | 3 * \ingroup ketsji |
4 */ | 4 */ |
5 | 5 |
6 #ifndef __BL_MATERIAL_H__ | 6 #ifndef __BL_MATERIAL_H__ |
7 #define __BL_MATERIAL_H__ | 7 #define __BL_MATERIAL_H__ |
8 | 8 |
9 #include "STR_String.h" | 9 #include "STR_String.h" |
10 #include "MT_Point2.h" | 10 #include "MT_Point2.h" |
| 11 #include "DNA_meshdata_types.h" |
11 | 12 |
12 #ifdef WITH_CXX_GUARDEDALLOC | 13 #ifdef WITH_CXX_GUARDEDALLOC |
13 #include "MEM_guardedalloc.h" | 14 #include "MEM_guardedalloc.h" |
14 #endif | 15 #endif |
15 | 16 |
16 // -- | 17 // -- |
17 struct MTex; | 18 struct MTex; |
18 struct Material; | 19 struct Material; |
19 struct Image; | 20 struct Image; |
20 struct MTFace; | 21 struct MTFace; |
21 struct MTex; | 22 struct MTex; |
22 struct Material; | 23 struct Material; |
23 struct EnvMap; | 24 struct EnvMap; |
24 // -- | 25 // -- |
25 | 26 |
26 /** max units | 27 /** max units |
27 » this will default to users available units | 28 * this will default to users available units |
28 » to build with more available, just increment this value | 29 * to build with more available, just increment this value |
29 » although the more you add the slower the search time will be. | 30 * although the more you add the slower the search time will be. |
30 » we will go for eight, which should be enough | 31 * we will go for eight, which should be enough |
31 */ | 32 */ |
32 #define MAXTEX 8 //match in RAS_TexVert & RAS_OpenGLRaste
rizer | 33 #define MAXTEX 8 //match in RAS_TexVert & RAS_OpenGLRaste
rizer |
33 | 34 |
34 // different mapping modes | 35 // different mapping modes |
35 class BL_Mapping | 36 class BL_Mapping |
36 { | 37 { |
37 public: | 38 public: |
38 int mapping; | 39 int mapping; |
39 float scale[3]; | 40 float scale[3]; |
40 float offsets[3]; | 41 float offsets[3]; |
41 int projplane[3]; | 42 int projplane[3]; |
(...skipping 15 matching lines...) Expand all Loading... |
57 | 58 |
58 int IdMode; | 59 int IdMode; |
59 unsigned int ras_mode; | 60 unsigned int ras_mode; |
60 bool glslmat; | 61 bool glslmat; |
61 | 62 |
62 STR_String texname[MAXTEX]; | 63 STR_String texname[MAXTEX]; |
63 unsigned int flag[MAXTEX]; | 64 unsigned int flag[MAXTEX]; |
64 int tile,tilexrep[MAXTEX],tileyrep[MAXTEX]; | 65 int tile,tilexrep[MAXTEX],tileyrep[MAXTEX]; |
65 STR_String matname; | 66 STR_String matname; |
66 STR_String mtexname[MAXTEX]; | 67 STR_String mtexname[MAXTEX]; |
67 int materialindex; | |
68 | 68 |
69 float matcolor[4]; | 69 float matcolor[4]; |
70 float speccolor[3]; | 70 float speccolor[3]; |
71 » short alphablend, pad; | 71 » short transp, pad; |
72 | 72 |
73 float hard, spec_f; | 73 float hard, spec_f; |
74 float alpha, emit, color_blend[MAXTEX], ref; | 74 float alpha, emit, color_blend[MAXTEX], ref; |
75 float amb; | |
76 | |
77 int blend_mode[MAXTEX]; | |
78 | |
79 int num_enabled; | |
80 ········ | |
81 BL_Mapping mapping[MAXTEX]; | |
82 STR_String imageId[MAXTEX]; | |
83 | |
84 | |
85 Material* material; | |
86 MTFace* tface; | |
87 Image* img[MAXTEX]; | |
88 EnvMap* cubemap[MAXTEX]; | |
89 | |
90 unsigned int rgb[4]; | |
91 MT_Point2 uv[4]; | |
92 MT_Point2 uv2[4]; | |
93 | |
94 STR_String uvName; | |
95 STR_String uv2Name; | |
96 | |
97 void SetConversionRGB(unsigned int *rgb); | |
98 void GetConversionRGB(unsigned int *rgb); | |
99 | |
100 void SetConversionUV(const STR_String& name, MT_Point2 *uv); | |
101 void GetConversionUV(MT_Point2 *uv); | |
102 | |
103 void SetConversionUV2(const STR_String& name, MT_Point2 *uv); | |
104 void GetConversionUV2(MT_Point2 *uv); | |
105 | |
106 void SetSharedMaterial(bool v); | |
107 bool IsShared(); | |
108 void SetUsers(int num); | |
109 ········ | |
110 ········ | |
111 #ifdef WITH_CXX_GUARDEDALLOC | |
112 public: | |
113 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE
:BL_Material"); } | |
114 void operator delete( void *mem ) { MEM_freeN(mem); } | |
115 #endif | |
116 }; | |
117 | |
118 // BL_Material::IdMode | |
119 enum BL_IdMode { | |
120 DEFAULT_BLENDER=-1, | |
121 TEXFACE, | |
122 ONETEX, | |
123 TWOTEX, | |
124 GREATERTHAN2 | |
125 }; | |
126 | |
127 // BL_Material::blend_mode[index] | |
128 enum BL_BlendMode | |
129 { | |
130 BLEND_MIX=1, | |
131 BLEND_ADD, | |
132 BLEND_SUB, | |
133 BLEND_MUL, | |
134 BLEND_SCR | |
135 }; | |
136 | |
137 // ------------------------------------- | |
138 // BL_Material::flag[index] | |
139 enum BL_flag | |
140 { | |
141 MIPMAP=1, // set to use mipmaps | |
142 CALCALPHA=2, // additive | |
143 USEALPHA=4, // use actual alpha channel | |
144 TEXALPHA=8, // use alpha combiner functions | |
145 TEXNEG=16, // negate blending | |
146 /*HASIPO=32,*/ // unused, commeted for now. | |
147 USENEGALPHA=64 | |
148 }; | |
149 | |
150 // BL_Material::ras_mode | |
151 enum BL_ras_mode | |
152 { | |
153 // POLY_VIS=1, | |
154 COLLIDER=2, | |
155 ZSORT=4, | |
156 ALPHA=8, | |
157 // TRIANGLE=16, | |
158 USE_LIGHT=32, | |
159 WIRE=64, | |
160 CAST_SHADOW=128, | |
161 TEX=256, | |
162 TWOSIDED=512 | |
163 }; | |
164 | |
165 // ------------------------------------- | |
166 // BL_Material::mapping[index]::mapping | |
167 enum BL_MappingFlag | |
168 { | |
169 USEENV =1, | |
170 // -- | |
171 USEREFL =2, | |
172 USEOBJ =4, | |
173 USENORM =8, | |
174 USEORCO =16, | |
175 USEUV =32, | |
176 USETANG =64, | |
177 DISABLE =128, | |
178 USECUSTOMUV=256 | |
179 }; | |
180 | |
181 // BL_Material::BL_Mapping::projplane | |
182 enum BL_MappingProj | |
183 { | |
184 PROJN=0, | |
185 PROJX, | |
186 PROJY, | |
187 PROJZ | |
188 }; | |
189 | |
190 // ------------------------------------ | |
191 //extern void initBL_Material(BL_Material* mat); | |
192 extern MTex* getImageFromMaterial(Material *mat, int index); | |
193 extern int getNumTexChannels( Material *mat ); | |
194 // ------------------------------------ | |
195 | |
196 #endif | |
197 | |
198 | |
LEFT | RIGHT |