Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021 #ifndef __VR3MATERIAL_H__
00022 #define __VR3MATERIAL_H__
00023
00024 #include <VR3Texture.h>
00025 #include <string>
00026
00028
00034 class VR3Material {
00037 friend class VR3MaterialManager;
00039 friend class VR3Mesh;
00041 friend class VR3MeshManager;
00042
00044
00049 struct MatTexture {
00051 VR3Texture* tex;
00053 std::string Fi;
00055 GLfloat In;
00057 GLfloat UA;
00059 GLfloat VA;
00061 GLfloat WA;
00063 GLfloat UO;
00065 GLfloat VO;
00067 GLfloat UT;
00069 GLfloat VT;
00071 GLfloat transfmat[16];
00072 };
00073
00075 int m_ID;
00077
00080 int m_subID;
00082
00085 std::string m_multiname;
00087 std::string m_name;
00089 std::string m_matfile;
00091 std::string m_class;
00092
00094 GLfloat m_emission[3];
00096 GLfloat m_ambient[3];
00098 GLfloat m_diffuse[3];
00100 GLfloat m_specular[3];
00102 GLfloat m_transparency;
00104 GLfloat m_shininess;
00105
00107 MatTexture* m_ptex;
00109 MatTexture* m_stex;
00111 MatTexture* m_ntex;
00113 MatTexture* m_dtex;
00114
00116 VR3Material(const VR3Material&);
00118 VR3Material& operator = (const VR3Material&);
00119
00120
00121
00123
00124
00126
00131 ~VR3Material();
00132
00134
00135 public:
00136
00137
00138
00140
00141
00143
00161 VR3Material( const char* file_name,
00162 const char* mat_name = 0,
00163 int matID = -1,
00164 const char* multimat_name = 0,
00165 int submatID = -1 );
00166
00168
00169
00170
00172
00173
00175
00185 void Destroy();
00186
00187
00188
00190
00191
00193
00197 void SetEmission(GLfloat r, GLfloat g, GLfloat b);
00198
00200
00203 void SetEmission(const GLfloat *color);
00204
00206
00210 void GetEmission(GLfloat *color);
00211
00213
00217 void SetAmbient(GLfloat r, GLfloat g, GLfloat b);
00218
00220
00223 void SetAmbient(const GLfloat *color);
00224
00226
00230 void GetAmbient(GLfloat *color);
00231
00233
00237 void SetDiffuse(GLfloat r, GLfloat g, GLfloat b);
00238
00240
00243 void SetDiffuse(const GLfloat *color);
00244
00246
00250 void GetDiffuse(GLfloat *color);
00251
00253
00257 void SetSpecular(GLfloat r, GLfloat g, GLfloat b);
00258
00260
00263 void SetSpecular(const GLfloat *color);
00264
00266
00270 void GetSpecular(GLfloat *color);
00271
00273
00277 void SetTransparency(GLfloat trans)
00278 { m_transparency = trans; }
00279
00281
00285 GLfloat GetTransparency()
00286 { return m_transparency; }
00287
00289
00293 void SetShininess(GLfloat shin)
00294 { m_shininess = shin; }
00295
00297
00301 GLfloat GetShininess()
00302 { return m_shininess; }
00303
00305
00318 void GetTextureTransf(int slot, GLfloat* rot, GLfloat* off, GLfloat* til);
00319
00321
00334 void SetTextureTransf( int slot, const GLfloat* rot,
00335 const GLfloat* off, const GLfloat* til );
00336
00338
00350 GLfloat GetTextureIntensity(int slot);
00351
00353
00365 void SetTextureIntensity(int slot, GLfloat in);
00366
00368
00382 const char* GetTextureFiltering(int slot);
00383
00385
00397 void SetTextureFiltering(int slot, const char* fil);
00398
00400
00419 VR3Texture* GetTexture(int slot);
00420
00422
00435 void SetTexture(int slot, VR3Texture* tex);
00436
00438
00445 int GetID()
00446 { return m_ID; }
00447
00449
00455 int GetSubID()
00456 { return m_subID; }
00457
00459
00462 bool IsSubMaterial()
00463 { return (m_subID==VR3MAT_NOSUB); }
00464
00466
00474 const char* GetName()
00475 { return m_name.c_str(); }
00476
00478
00484 const char* GetClass()
00485 { return m_class.c_str(); }
00486
00488
00496 const char* GetMultiName()
00497 { return m_multiname.empty()? 0 : m_multiname.c_str(); }
00498
00500
00508 const char* GetFileName()
00509 { return m_matfile.c_str(); }
00510
00512 };
00513
00514 #endif