Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/water/src/lib/graphics/importer/material.h @ 7982

Last change on this file since 7982 was 7982, checked in by stefalie, 18 years ago

branches/water: light!

File size: 3.0 KB
RevLine 
[2842]1/*!
[7785]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 */
[2842]7
[2776]8#ifndef _MATERIAL_H
9#define _MATERIAL_H
[4584]10#include "base_object.h"
[2804]11
[7785]12
[4584]13#if HAVE_CONFIG_H
14#include <config.h>
[3140]15#endif /* HAVE_CONFIG_H */
16
[7785]17#include <vector>
18#include "SDL_image.h"
[3894]19
[6769]20#include "texture.h"
21
[5405]22// FORWARD DECLARATIONS //
[3140]23
[2842]24//! Class to handle Materials.
[4584]25class Material : public BaseObject
[2776]26{
[7785]27  public:
28    Material (const std::string& mtlName = "");
29    virtual ~Material ();
[2778]30
[7785]31    Material& operator=(const Material& material);
[6622]32
[7785]33    bool select () const;
[7982]34    static void unselect();
[2778]35
[7785]36    void setIllum (int illum);
37    int getIllumModel() const { return this->illumModel; };
38    void setDiffuse (float r, float g, float b);
39    void setAmbient (float r, float g, float b);
40    void setSpecular (float r, float g, float b);
41    void setShininess (float shini);
42    void setTransparency (float trans);
43    void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; };
[2776]44
[3070]45
[7785]46    // TODO Move them out of here
47    void setIllum (char* illum);
48    void setDiffuse (char* rgb);
49    void setAmbient (char* rgb);
50    void setSpecular (char* rgb);
51    void setShininess (char* shini);
52    void setTransparency (char* trans);
[4466]53
[7785]54
55    // MAPPING //
[7788]56    void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0);
[7785]57    void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
58    void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
59
60    void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
61    void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);
62    void setBump(const std::string& bump);
[7788]63    GLuint getDiffuseTexture(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i].getTexture() : 0; };
[7785]64
65    static void addTexturePath(const std::string& pathName);
66
67  public:
68    static const GLenum glTextureArbs[];  //!< The Texture ARB's
69
70    static int getMaxTextureUnits();
71
[5866]72  private:
[7785]73    static const Material* selectedMaterial; //!< The currently selected material.
[6622]74
[7785]75    int              illumModel;       //!< The IlluminationModel is either flat or smooth.
76    float            diffuse [4];      //!< The diffuse color of the Material.
77    float            ambient [4];      //!< The ambient color of the Material.
78    float            specular [4];     //!< The specular color of the Material.
79    float            shininess;        //!< The shininess of the Material.
80    float            transparency;     //!< The transperency of the Material.
81    GLenum           sFactor;
82    GLenum           tFactor;
83
[7788]84    std::vector<Texture> textures;    //!< An Array of Textures.
[7785]85
86    Texture*         ambientTexture;   //!< The ambient texture of the Material.
87    Texture*         specularTexture;  //!< The specular texture of the Material.
88
89
[2776]90};
91#endif
Note: See TracBrowser for help on using the repository browser.