| 1 | /*! | 
|---|
| 2 |   \file material.h | 
|---|
| 3 |   \brief Contains the Material Class that handles Material for 3D-Objects. | 
|---|
| 4 | */ | 
|---|
| 5 |  | 
|---|
| 6 | #ifndef _MATERIAL_H | 
|---|
| 7 | #define _MATERIAL_H | 
|---|
| 8 |  | 
|---|
| 9 | extern int verbose; //!< will be obsolete soon. | 
|---|
| 10 |  | 
|---|
| 11 | #include <GL/gl.h> | 
|---|
| 12 | #include <GL/glu.h> | 
|---|
| 13 | #include <SDL/SDL.h> | 
|---|
| 14 | #include <stdlib.h> | 
|---|
| 15 | #include <fstream> | 
|---|
| 16 |  | 
|---|
| 17 | //! Class to handle Materials. | 
|---|
| 18 | class Material | 
|---|
| 19 | { | 
|---|
| 20 |  public: | 
|---|
| 21 |   Material (); | 
|---|
| 22 |   Material (char* mtlName); | 
|---|
| 23 |   Material* addMaterial(char* mtlName); | 
|---|
| 24 |  | 
|---|
| 25 |   void init(void); | 
|---|
| 26 |   ~Material (); | 
|---|
| 27 |  | 
|---|
| 28 |   GLuint diffuseTexture; | 
|---|
| 29 |   GLuint ambientTexture; | 
|---|
| 30 |   GLuint specularTexture; | 
|---|
| 31 |    | 
|---|
| 32 |   bool diffuseTextureSet; | 
|---|
| 33 |   bool ambientTextureSet; | 
|---|
| 34 |   bool specularTextureSet; | 
|---|
| 35 |  | 
|---|
| 36 |   void setName (char* mtlName); | 
|---|
| 37 |   char* getName (void); | 
|---|
| 38 |   void setIllum (int illum); | 
|---|
| 39 |   void setIllum (char* illum); | 
|---|
| 40 |   void setDiffuse (float r, float g, float b); | 
|---|
| 41 |   void setDiffuse (char* rgb); | 
|---|
| 42 |   void setAmbient (float r, float g, float b); | 
|---|
| 43 |   void setAmbient (char* rgb); | 
|---|
| 44 |   void setSpecular (float r, float g, float b); | 
|---|
| 45 |   void setSpecular (char* rgb); | 
|---|
| 46 |   void setShininess (float shini); | 
|---|
| 47 |   void setShininess (char* shini); | 
|---|
| 48 |   void setTransparency (float trans); | 
|---|
| 49 |   void setTransparency (char* trans); | 
|---|
| 50 |  | 
|---|
| 51 |   // MAPPING // | 
|---|
| 52 |   void setDiffuseMap(char* dMap); | 
|---|
| 53 |   void setAmbientMap(char* aMap); | 
|---|
| 54 |   void setSpecularMap(char* sMap); | 
|---|
| 55 |   void setBump(char* bump); | 
|---|
| 56 |  | 
|---|
| 57 |   bool loadBMP (char* bmpName, GLuint* texture); | 
|---|
| 58 |  | 
|---|
| 59 |  | 
|---|
| 60 |   Material* search (char* mtlName); | 
|---|
| 61 |  | 
|---|
| 62 |   bool select (void); | 
|---|
| 63 |  | 
|---|
| 64 |   Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. | 
|---|
| 65 |  | 
|---|
| 66 |  private: | 
|---|
| 67 |   char* name; | 
|---|
| 68 |   int illumModel; | 
|---|
| 69 |   float diffuse [4]; | 
|---|
| 70 |   float ambient [4]; | 
|---|
| 71 |   float specular [4]; | 
|---|
| 72 |   float shininess; | 
|---|
| 73 |   float transparency; | 
|---|
| 74 |  | 
|---|
| 75 | }; | 
|---|
| 76 | #endif | 
|---|