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