| 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 |  | 
|---|
| 13 | extern int verbose; //!< will be obsolete soon. | 
|---|
| 14 |  | 
|---|
| 15 | #include "../stdincl.h" | 
|---|
| 16 | #include "texture.h" | 
|---|
| 17 |  | 
|---|
| 18 | #if HAVE_CONFIG_H  | 
|---|
| 19 | #include <config.h>  | 
|---|
| 20 | #endif /* HAVE_CONFIG_H */ | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 | //! Class to handle Materials. | 
|---|
| 26 | class Material | 
|---|
| 27 | { | 
|---|
| 28 |  public: | 
|---|
| 29 |   Material (); | 
|---|
| 30 |   Material (char* mtlName); | 
|---|
| 31 |   Material* addMaterial(char* mtlName); | 
|---|
| 32 |   ~Material (); | 
|---|
| 33 |   void init(void); | 
|---|
| 34 |  | 
|---|
| 35 |   Material* search (char* mtlName); | 
|---|
| 36 |   bool select (void); | 
|---|
| 37 |  | 
|---|
| 38 |   void setName (char* mtlName); | 
|---|
| 39 |   char* getName (void); | 
|---|
| 40 |   void setIllum (int illum); | 
|---|
| 41 |   void setIllum (char* illum); | 
|---|
| 42 |   void setDiffuse (float r, float g, float b); | 
|---|
| 43 |   void setDiffuse (char* rgb); | 
|---|
| 44 |   void setAmbient (float r, float g, float b); | 
|---|
| 45 |   void setAmbient (char* rgb); | 
|---|
| 46 |   void setSpecular (float r, float g, float b); | 
|---|
| 47 |   void setSpecular (char* rgb); | 
|---|
| 48 |   void setShininess (float shini); | 
|---|
| 49 |   void setShininess (char* shini); | 
|---|
| 50 |   void setTransparency (float trans); | 
|---|
| 51 |   void setTransparency (char* trans); | 
|---|
| 52 |  | 
|---|
| 53 |  | 
|---|
| 54 |   | 
|---|
| 55 |   void addTexturePath(char* pathName); | 
|---|
| 56 |   char* searchTextureInPaths(char* texName) const; | 
|---|
| 57 |  // MAPPING // | 
|---|
| 58 |   void setDiffuseMap(char* dMap); | 
|---|
| 59 |   void setAmbientMap(char* aMap); | 
|---|
| 60 |   void setSpecularMap(char* sMap); | 
|---|
| 61 |   void setBump(char* bump); | 
|---|
| 62 |  | 
|---|
| 63 |  private: | 
|---|
| 64 |   char* name;        //!< The Name of the Material. | 
|---|
| 65 |   int illumModel;    //!< The IlluminationModel is either flat or smooth. | 
|---|
| 66 |   float diffuse [4]; //!< The diffuse color of the Material. | 
|---|
| 67 |   float ambient [4]; //!< The ambient color of the Material. | 
|---|
| 68 |   float specular [4];//!< The specular color of the Material. | 
|---|
| 69 |   float shininess;   //!< The shininess of the Material. | 
|---|
| 70 |   float transparency;//!< The transperency of the Material. | 
|---|
| 71 |  | 
|---|
| 72 |   Texture* diffuseTexture; //!< The diffuse texture of the Material. | 
|---|
| 73 |   Texture* ambientTexture; //!< The ambient texture of the Material. | 
|---|
| 74 |   Texture* specularTexture;//!< The specular texture of the Material. | 
|---|
| 75 |    | 
|---|
| 76 |   bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set. | 
|---|
| 77 |   bool ambientTextureSet; //!< Chekcs if the ambient texture is Set. | 
|---|
| 78 |   bool specularTextureSet;//!< Chekcs if the specular texture is Set. | 
|---|
| 79 |  | 
|---|
| 80 |   Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. | 
|---|
| 81 |  | 
|---|
| 82 |  | 
|---|
| 83 | }; | 
|---|
| 84 | #endif | 
|---|