[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 | |
---|
[3196] | 15 | #include "../stdincl.h" |
---|
[3365] | 16 | #include "texture.h" |
---|
[2776] | 17 | |
---|
[3140] | 18 | #if HAVE_CONFIG_H |
---|
| 19 | #include <config.h> |
---|
| 20 | #endif /* HAVE_CONFIG_H */ |
---|
| 21 | |
---|
| 22 | |
---|
[3186] | 23 | |
---|
[3140] | 24 | |
---|
[2842] | 25 | //! Class to handle Materials. |
---|
[2776] | 26 | class Material |
---|
| 27 | { |
---|
| 28 | public: |
---|
| 29 | Material (); |
---|
| 30 | Material (char* mtlName); |
---|
[2778] | 31 | Material* addMaterial(char* mtlName); |
---|
[3140] | 32 | ~Material (); |
---|
[2776] | 33 | void init(void); |
---|
[2778] | 34 | |
---|
[3140] | 35 | Material* search (char* mtlName); |
---|
| 36 | bool select (void); |
---|
[2778] | 37 | |
---|
[2776] | 38 | void setName (char* mtlName); |
---|
[2778] | 39 | char* getName (void); |
---|
[2776] | 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); |
---|
[2836] | 48 | void setShininess (float shini); |
---|
| 49 | void setShininess (char* shini); |
---|
[2776] | 50 | void setTransparency (float trans); |
---|
| 51 | void setTransparency (char* trans); |
---|
| 52 | |
---|
[3140] | 53 | |
---|
| 54 | |
---|
| 55 | void addTexturePath(char* pathName); |
---|
| 56 | char* searchTextureInPaths(char* texName) const; |
---|
| 57 | // MAPPING // |
---|
[3070] | 58 | void setDiffuseMap(char* dMap); |
---|
| 59 | void setAmbientMap(char* aMap); |
---|
| 60 | void setSpecularMap(char* sMap); |
---|
| 61 | void setBump(char* bump); |
---|
| 62 | |
---|
[3140] | 63 | private: |
---|
[3186] | 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. |
---|
[2776] | 71 | |
---|
[3365] | 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. |
---|
[3140] | 75 | |
---|
[3186] | 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. |
---|
[3140] | 79 | |
---|
| 80 | Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. |
---|
| 81 | |
---|
| 82 | |
---|
[2776] | 83 | }; |
---|
| 84 | #endif |
---|