Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cdmerge/src/lib/graphics/importer/material.h @ 6937

Last change on this file since 6937 was 6769, checked in by bensch, 19 years ago

trunk: vertexArrayModel with TexCoords

File size: 2.3 KB
Line 
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#include "base_object.h"
11
12#if HAVE_CONFIG_H
13#include <config.h>
14#endif /* HAVE_CONFIG_H */
15
16#ifndef NULL
17#define NULL 0            //!< a pointer to NULL
18#endif
19
20#include "texture.h"
21
22// FORWARD DECLARATIONS //
23
24//! Class to handle Materials.
25class Material : public BaseObject
26{
27 public:
28  Material (const char* mtlName = NULL);
29  virtual ~Material ();
30
31  Material& operator=(const Material& material);
32
33  bool select () const;
34
35  void setIllum (int illum);
36  void setIllum (char* illum);
37  int getIllumModel() const { return this->illumModel; };
38  void setDiffuse (float r, float g, float b);
39  void setDiffuse (char* rgb);
40  void setAmbient (float r, float g, float b);
41  void setAmbient (char* rgb);
42  void setSpecular (float r, float g, float b);
43  void setSpecular (char* rgb);
44  void setShininess (float shini);
45  void setShininess (char* shini);
46  void setTransparency (float trans);
47  void setTransparency (char* trans);
48
49 // MAPPING //
50  void setDiffuseMap(const char* dMap, GLenum target = GL_TEXTURE_2D);
51  void setAmbientMap(const char* aMap, GLenum target = GL_TEXTURE_2D);
52  void setSpecularMap(const char* sMap, GLenum target = GL_TEXTURE_2D);
53  void setBump(const char* bump);
54  GLuint getDiffuseTexture() const { return (this->diffuseTexture)? this->diffuseTexture->getTexture() : 0; };
55
56  static void addTexturePath(const char* pathName);
57
58  private:
59    int         illumModel;       //!< The IlluminationModel is either flat or smooth.
60    float       diffuse [4];      //!< The diffuse color of the Material.
61    float       ambient [4];      //!< The ambient color of the Material.
62    float       specular [4];     //!< The specular color of the Material.
63    float       shininess;        //!< The shininess of the Material.
64    float       transparency;     //!< The transperency of the Material.
65
66    Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
67    Texture*    ambientTexture;   //!< The ambient texture of the Material.
68    Texture*    specularTexture;  //!< The specular texture of the Material.
69};
70#endif
Note: See TracBrowser for help on using the repository browser.