Changeset 7785 in orxonox.OLD for trunk/src/lib/graphics/importer/material.h
- Timestamp:
- May 24, 2006, 3:17:19 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/material.h
r7221 r7785 1 1 /*! 2 \file material.h3 \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 */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 7 8 8 #ifndef _MATERIAL_H … … 10 10 #include "base_object.h" 11 11 12 12 13 #if HAVE_CONFIG_H 13 14 #include <config.h> 14 15 #endif /* HAVE_CONFIG_H */ 15 16 16 #ifndef NULL 17 #define NULL 0 //!< a pointer to NULL 18 #endif 17 #include <vector> 18 #include "SDL_image.h" 19 19 20 20 #include "texture.h" … … 25 25 class Material : public BaseObject 26 26 { 27 public:28 Material (const std::string& mtlName = "");29 virtual ~Material ();27 public: 28 Material (const std::string& mtlName = ""); 29 virtual ~Material (); 30 30 31 Material& operator=(const Material& material);31 Material& operator=(const Material& material); 32 32 33 bool select () const;33 bool select () const; 34 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 void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; }; 35 void setIllum (int illum); 36 int getIllumModel() const { return this->illumModel; }; 37 void setDiffuse (float r, float g, float b); 38 void setAmbient (float r, float g, float b); 39 void setSpecular (float r, float g, float b); 40 void setShininess (float shini); 41 void setTransparency (float trans); 42 void setBlendFunc(GLenum sFactor, GLenum tFactor) { this->sFactor = sFactor; this->tFactor = tFactor; }; 49 43 50 // MAPPING //51 void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D);52 void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);53 void setSpecularMap(const std::string& sMap, GLenum target = GL_TEXTURE_2D);54 void setBump(const std::string& bump);55 GLuint getDiffuseTexture() const { return (this->diffuseTexture)? this->diffuseTexture->getTexture() : 0; };56 44 57 static void addTexturePath(const std::string& pathName); 45 // TODO Move them out of here 46 void setIllum (char* illum); 47 void setDiffuse (char* rgb); 48 void setAmbient (char* rgb); 49 void setSpecular (char* rgb); 50 void setShininess (char* shini); 51 void setTransparency (char* trans); 52 53 54 // MAPPING // 55 void setDiffuseMap(Texture* texture, unsigned int textureNumber = 0); 56 void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 57 void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 58 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); 62 GLuint getDiffuseTexture(unsigned int i = 0) const { return (this->textures.size() > i)? this->textures[i]->getTexture() : 0; }; 63 64 static void addTexturePath(const std::string& pathName); 65 66 public: 67 static const GLenum glTextureArbs[]; //!< The Texture ARB's 68 69 static int getMaxTextureUnits(); 58 70 59 71 private: 60 int illumModel; //!< The IlluminationModel is either flat or smooth. 61 float diffuse [4]; //!< The diffuse color of the Material. 62 float ambient [4]; //!< The ambient color of the Material. 63 float specular [4]; //!< The specular color of the Material. 64 float shininess; //!< The shininess of the Material. 65 float transparency; //!< The transperency of the Material. 66 GLenum sFactor; 67 GLenum tFactor; 72 static const Material* selectedMaterial; //!< The currently selected material. 68 73 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. 74 int illumModel; //!< The IlluminationModel is either flat or smooth. 75 float diffuse [4]; //!< The diffuse color of the Material. 76 float ambient [4]; //!< The ambient color of the Material. 77 float specular [4]; //!< The specular color of the Material. 78 float shininess; //!< The shininess of the Material. 79 float transparency; //!< The transperency of the Material. 80 GLenum sFactor; 81 GLenum tFactor; 82 83 std::vector<Texture*> textures; //!< An Array of Textures. 84 85 Texture* ambientTexture; //!< The ambient texture of the Material. 86 Texture* specularTexture; //!< The specular texture of the Material. 87 88 72 89 }; 73 90 #endif
Note: See TracChangeset
for help on using the changeset viewer.