| [2842] | 1 | /*! |
|---|
| 2 | \file material.h |
|---|
| 3 | \brief Contains the Material Class that handles Material for 3D-Objects. |
|---|
| [4836] | 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 |
|---|
| [4584] | 10 | #include "base_object.h" |
|---|
| [2804] | 11 | |
|---|
| [4584] | 12 | #if HAVE_CONFIG_H |
|---|
| 13 | #include <config.h> |
|---|
| [3140] | 14 | #endif /* HAVE_CONFIG_H */ |
|---|
| 15 | |
|---|
| [3894] | 16 | #ifndef NULL |
|---|
| [4466] | 17 | #define NULL 0 //!< a pointer to NULL |
|---|
| [3894] | 18 | #endif |
|---|
| 19 | |
|---|
| [5405] | 20 | // FORWARD DECLARATIONS // |
|---|
| [3427] | 21 | class Texture; |
|---|
| [3140] | 22 | |
|---|
| [2842] | 23 | //! Class to handle Materials. |
|---|
| [4584] | 24 | class Material : public BaseObject |
|---|
| [2776] | 25 | { |
|---|
| 26 | public: |
|---|
| [3894] | 27 | Material (const char* mtlName = NULL); |
|---|
| [5308] | 28 | virtual ~Material (); |
|---|
| [2778] | 29 | |
|---|
| [6622] | 30 | Material& operator=(const Material& material); |
|---|
| 31 | |
|---|
| [5308] | 32 | bool select () const; |
|---|
| [2778] | 33 | |
|---|
| [2776] | 34 | void setIllum (int illum); |
|---|
| 35 | void setIllum (char* illum); |
|---|
| [6622] | 36 | int getIllumModel() const { return this->illumModel; }; |
|---|
| [2776] | 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); |
|---|
| [2836] | 43 | void setShininess (float shini); |
|---|
| 44 | void setShininess (char* shini); |
|---|
| [2776] | 45 | void setTransparency (float trans); |
|---|
| 46 | void setTransparency (char* trans); |
|---|
| 47 | |
|---|
| [3140] | 48 | // MAPPING // |
|---|
| [6467] | 49 | void setDiffuseMap(const char* dMap, GLenum target = GL_TEXTURE_2D); |
|---|
| 50 | void setAmbientMap(const char* aMap, GLenum target = GL_TEXTURE_2D); |
|---|
| 51 | void setSpecularMap(const char* sMap, GLenum target = GL_TEXTURE_2D); |
|---|
| [3803] | 52 | void setBump(const char* bump); |
|---|
| [3070] | 53 | |
|---|
| [4466] | 54 | static void addTexturePath(const char* pathName); |
|---|
| 55 | |
|---|
| [5866] | 56 | private: |
|---|
| 57 | int illumModel; //!< The IlluminationModel is either flat or smooth. |
|---|
| 58 | float diffuse [4]; //!< The diffuse color of the Material. |
|---|
| 59 | float ambient [4]; //!< The ambient color of the Material. |
|---|
| 60 | float specular [4]; //!< The specular color of the Material. |
|---|
| 61 | float shininess; //!< The shininess of the Material. |
|---|
| 62 | float transparency; //!< The transperency of the Material. |
|---|
| [6622] | 63 | |
|---|
| [5866] | 64 | Texture* diffuseTexture; //!< The diffuse texture of the Material. |
|---|
| 65 | Texture* ambientTexture; //!< The ambient texture of the Material. |
|---|
| 66 | Texture* specularTexture; //!< The specular texture of the Material. |
|---|
| [2776] | 67 | }; |
|---|
| 68 | #endif |
|---|