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