Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8619 in orxonox.OLD for trunk/src/lib/graphics/importer/material.h


Ignore:
Timestamp:
Jun 20, 2006, 1:24:11 PM (18 years ago)
Author:
bensch
Message:

trunk: merged the gui-branche back.
merged with command:
svn merge -r8520:HEAD https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/material.h

    r8448 r8619  
    2424class Material : public BaseObject
    2525{
    26   public:
    27     Material (const std::string& mtlName = "");
    28     virtual ~Material ();
     26public:
     27  Material (const std::string& mtlName = "");
     28  virtual ~Material ();
    2929
    30     Material& operator=(const Material& material);
     30  void loadParams(const TiXmlElement* root);
    3131
    32     bool select () const;
    33     bool activateTextureUnit(unsigned int textureNumber);
    34     static void unselect();
     32  Material& operator=(const Material& material);
    3533
    36     void setIllum (int illum);
    37     int getIllumModel() const { return this->illumModel; };
     34  bool select () const;
     35  bool activateTextureUnit(unsigned int textureNumber);
     36  static void unselect();
    3837
    39     void setDiffuse (float r, float g, float b);
    40     void setDiffuseColor(const Color& diffuseColor) { this->diffuse = diffuseColor; };
    41     void setAmbient (float r, float g, float b);
    42     void setSpecular (float r, float g, float b);
    43     void setShininess (float shini);
    44     void setTransparency (float trans);
    45     void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; };
     38  void setIllum (int illum);
     39  int getIllumModel() const { return this->illumModel; };
    4640
    47     const Color& getDiffuseColor() const { return diffuse; };
     41  void setDiffuse (float r, float g, float b);
     42  void setDiffuseColor(const Color& diffuseColor) { this->diffuse = diffuseColor; };
     43  void setAmbient (float r, float g, float b);
     44  void setSpecular (float r, float g, float b);
     45  void setShininess (float shini);
     46  void setTransparency (float trans);
     47  void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; };
     48  void setBlendFuncS(const std::string& sFactor, const std::string& tFactor);
    4849
    49     // MAPPING //
    50     void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0);
    51     void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
    52     void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
    53     void renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
     50  Color& diffuseColor() { return diffuse; };
     51  const Color& diffuseColor() const { return diffuse; };
    5452
    55     void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
    56     void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);
    57     void setBump(const std::string& bump);
    58     GLuint getDiffuseTexture(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i].getTexture() : 0; };
     53  // MAPPING //
     54  void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0);
     55  void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     56  void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     57  void renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
    5958
    60     static void addTexturePath(const std::string& pathName);
     59  void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
     60  void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);
     61  void setBump(const std::string& bump);
    6162
    62   public:
    63     static const GLenum glTextureArbs[];  //!< The Texture ARB's
     63  GLuint diffuseTextureID(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i].getTexture() : 0; };
    6464
    65     static unsigned int getMaxTextureUnits();
     65  const Texture& diffuseTexture(unsigned int i = 0) const { return this->textures[i]; };
    6666
    67   private:
    68     static const Material* selectedMaterial; //!< The currently selected material.
     67  static void addTexturePath(const std::string& pathName);
    6968
    70     int              illumModel;       //!< The IlluminationModel is either flat or smooth.
    71     Color            diffuse;          //!< The diffuse color of the Material. (also transparency.)
    72     Color            ambient;          //!< The ambient color of the Material.
    73     Color            specular;         //!< The specular color of the Material.
    74     float            shininess;        //!< The shininess of the Material.
    75     GLenum           sFactor;          //!< The Blending Factor for the Source.
    76     GLenum           tFactor;          //!< The Blending Factor for the Destination.
     69  const std::string& blendFuncToString(GLenum blendFunc);
     70  GLenum stringToBlendFunc(const std::string& blendFuncString);
    7771
    78     std::vector<Texture> textures;     //!< An Array of Textures.
    7972
    80     Texture*         ambientTexture;   //!< The ambient texture of the Material.
    81     Texture*         specularTexture;  //!< The specular texture of the Material.
     73public:
     74  static const GLenum glTextureArbs[];  //!< The Texture ARB's
     75
     76  static const GLenum glBlendFuncParams[];
     77  static const std::string blendFuncNames[];
     78
     79  static unsigned int getMaxTextureUnits();
     80
     81private:
     82  static const Material* selectedMaterial; //!< The currently selected material.
     83
     84  int              illumModel;       //!< The IlluminationModel is either flat or smooth.
     85  Color            diffuse;          //!< The diffuse color of the Material. (also transparency.)
     86  Color            ambient;          //!< The ambient color of the Material.
     87  Color            specular;         //!< The specular color of the Material.
     88  float            shininess;        //!< The shininess of the Material.
     89  GLenum           sFactor;          //!< The Blending Factor for the Source.
     90  GLenum           tFactor;          //!< The Blending Factor for the Destination.
     91
     92  std::vector<Texture> textures;     //!< An Array of Textures.
     93
     94  Texture*         ambientTexture;   //!< The ambient texture of the Material.
     95  Texture*         specularTexture;  //!< The specular texture of the Material.
    8296};
    8397
Note: See TracChangeset for help on using the changeset viewer.