| 1 | /*! | 
|---|
| 2 |   \file material.h | 
|---|
| 3 |   \brief Contains the Material Class that handles Material for 3D-Objects. | 
|---|
| 4 |   \todo free SDL-surface when deleting Material. | 
|---|
| 5 |   \todo delete imgNameWithPath after use creation. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef _MATERIAL_H | 
|---|
| 9 | #define _MATERIAL_H | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | #if HAVE_CONFIG_H  | 
|---|
| 13 | #include <config.h>  | 
|---|
| 14 | #endif /* HAVE_CONFIG_H */ | 
|---|
| 15 |  | 
|---|
| 16 | // FORWARD DEFINITIONS // | 
|---|
| 17 | class Texture; | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | //! Class to handle Materials. | 
|---|
| 21 | class Material | 
|---|
| 22 | { | 
|---|
| 23 |  public: | 
|---|
| 24 |   Material (); | 
|---|
| 25 |   Material (char* mtlName); | 
|---|
| 26 |   Material* addMaterial(char* mtlName); | 
|---|
| 27 |   ~Material (); | 
|---|
| 28 |   void init(void); | 
|---|
| 29 |  | 
|---|
| 30 |   Material* search(char* mtlName); | 
|---|
| 31 |   bool select (void); | 
|---|
| 32 |  | 
|---|
| 33 |   void setName (char* mtlName); | 
|---|
| 34 |   char* getName (void); | 
|---|
| 35 |   void setIllum (int illum); | 
|---|
| 36 |   void setIllum (char* illum); | 
|---|
| 37 |   void setDiffuse (float r, float g, float b); | 
|---|
| 38 |   void setDiffuse (char* rgb); | 
|---|
| 39 |   void setAmbient (float r, float g, float b); | 
|---|
| 40 |   void setAmbient (char* rgb); | 
|---|
| 41 |   void setSpecular (float r, float g, float b); | 
|---|
| 42 |   void setSpecular (char* rgb); | 
|---|
| 43 |   void setShininess (float shini); | 
|---|
| 44 |   void setShininess (char* shini); | 
|---|
| 45 |   void setTransparency (float trans); | 
|---|
| 46 |   void setTransparency (char* trans); | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 |   | 
|---|
| 50 |   void addTexturePath(char* pathName); | 
|---|
| 51 |  // MAPPING // | 
|---|
| 52 |   void setDiffuseMap(char* dMap); | 
|---|
| 53 |   void setAmbientMap(char* aMap); | 
|---|
| 54 |   void setSpecularMap(char* sMap); | 
|---|
| 55 |   void setBump(char* bump); | 
|---|
| 56 |  | 
|---|
| 57 |  private: | 
|---|
| 58 |   char* name;        //!< The Name of the Material. | 
|---|
| 59 |   int illumModel;    //!< The IlluminationModel is either flat or smooth. | 
|---|
| 60 |   float diffuse [4]; //!< The diffuse color of the Material. | 
|---|
| 61 |   float ambient [4]; //!< The ambient color of the Material. | 
|---|
| 62 |   float specular [4];//!< The specular color of the Material. | 
|---|
| 63 |   float shininess;   //!< The shininess of the Material. | 
|---|
| 64 |   float transparency;//!< The transperency of the Material. | 
|---|
| 65 |  | 
|---|
| 66 |   Texture* diffuseTexture; //!< The diffuse texture of the Material. | 
|---|
| 67 |   Texture* ambientTexture; //!< The ambient texture of the Material. | 
|---|
| 68 |   Texture* specularTexture;//!< The specular texture of the Material. | 
|---|
| 69 |    | 
|---|
| 70 |   bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set. | 
|---|
| 71 |   bool ambientTextureSet; //!< Chekcs if the ambient texture is Set. | 
|---|
| 72 |   bool specularTextureSet;//!< Chekcs if the specular texture is Set. | 
|---|
| 73 |  | 
|---|
| 74 |   Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. | 
|---|
| 75 |  | 
|---|
| 76 |  | 
|---|
| 77 | }; | 
|---|
| 78 | #endif | 
|---|