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 | char* searchTextureInPaths(char* texName) const; |
---|
55 | // MAPPING // |
---|
56 | void setDiffuseMap(char* dMap); |
---|
57 | void setAmbientMap(char* aMap); |
---|
58 | void setSpecularMap(char* sMap); |
---|
59 | void setBump(char* bump); |
---|
60 | |
---|
61 | private: |
---|
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. |
---|
69 | |
---|
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. |
---|
73 | |
---|
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. |
---|
77 | |
---|
78 | Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. |
---|
79 | |
---|
80 | |
---|
81 | }; |
---|
82 | #endif |
---|