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