2 /** \file BL_Material.h
6 #ifndef __BL_MATERIAL_H__
7 #define __BL_MATERIAL_H__
9 #include "STR_String.h"
10 #include "MT_Point2.h"
12 #ifdef WITH_CXX_GUARDEDALLOC
13 #include "MEM_guardedalloc.h"
27 this will default to users available units
28 to build with more available, just increment this value
29 although the more you add the slower the search time will be.
30 we will go for eight, which should be enough
32 #define MAXTEX 8 //match in RAS_TexVert & RAS_OpenGLRasterizer
34 // different mapping modes
46 // base material struct
54 // -----------------------------------
59 unsigned int ras_mode;
62 STR_String texname[MAXTEX];
63 unsigned int flag[MAXTEX];
64 int tile,tilexrep[MAXTEX],tileyrep[MAXTEX];
66 STR_String mtexname[MAXTEX];
74 float alpha, emit, color_blend[MAXTEX], ref;
77 int blend_mode[MAXTEX];
82 BL_Mapping mapping[MAXTEX];
83 STR_String imageId[MAXTEX];
89 EnvMap* cubemap[MAXTEX];
98 void SetConversionRGB(unsigned int *rgb);
99 void GetConversionRGB(unsigned int *rgb);
101 void SetConversionUV(const STR_String& name, MT_Point2 *uv);
102 void GetConversionUV(MT_Point2 *uv);
104 void SetConversionUV2(const STR_String& name, MT_Point2 *uv);
105 void GetConversionUV2(MT_Point2 *uv);
107 void SetSharedMaterial(bool v);
109 void SetUsers(int num);
112 #ifdef WITH_CXX_GUARDEDALLOC
114 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Material"); }
115 void operator delete( void *mem ) { MEM_freeN(mem); }
119 // BL_Material::IdMode
128 // BL_Material::blend_mode[index]
138 // -------------------------------------
139 // BL_Material::flag[index]
142 MIPMAP=1, // set to use mipmaps
143 CALCALPHA=2, // additive
144 USEALPHA=4, // use actual alpha channel
145 TEXALPHA=8, // use alpha combiner functions
146 TEXNEG=16, // negate blending
147 /*HASIPO=32,*/ // unused, commeted for now.
151 // BL_Material::ras_mode
163 // -------------------------------------
164 // BL_Material::mapping[index]::mapping
179 // BL_Material::BL_Mapping::projplane
188 // ------------------------------------
189 //extern void initBL_Material(BL_Material* mat);
190 extern MTex* getImageFromMaterial(Material *mat, int index);
191 extern int getNumTexChannels( Material *mat );
192 // ------------------------------------