A material is associated with textures and a shader to define the look of an object. More...

#include <Material.h>

Public Types

typedef std::unordered_map< std::string, TexturePtrTextureMap
 
typedef std::unordered_map< std::string, vmml::Vector3f > Vector3Map
 
typedef std::unordered_map< std::string, GLfloat > ScalarMap
 

Public Member Functions

 Material ()
 Constructor. More...
 
virtual ~Material ()
 Virtual destructor. More...
 
virtual void initialize (ObjectManager *o, const MaterialData &materialData, ShaderPtr shader)
 Initializes the geometry object based on material data and a shader. More...
 
virtual void bind ()
 Bind the shader and pass the attributes of the material. More...
 
const TextureMapgetTextures ()
 Returns the textures associated with the material. More...
 
TexturePtr getTexture (const std::string &name)
 Returns a texture associated with the material. More...
 
const Vector3MapgetVectors ()
 Returns the vectors associated with the material. More...
 
vmml::Vector3f getVector (const std::string &name)
 Returns a vector associated with the material. More...
 
const ScalarMapgetScalars ()
 Returns the scalars associated with the material. More...
 
GLfloat getScalar (const std::string &name)
 Returns a scalar associated with the material. More...
 
void setTextures (const TextureMap &arg)
 Sets all textures for the material. More...
 
void setTexture (const std::string &name, TexturePtr arg)
 Sets a texture for the material. More...
 
void setVectors (const Vector3Map &arg)
 Sets all vectors for the material. More...
 
void setVector (const std::string &name, const vmml::Vector3f &arg)
 Sets a vector for the material. More...
 
void setScalars (const ScalarMap &arg)
 Sets all scalars for the material. More...
 
void setScalar (const std::string &name, GLfloat arg)
 Sets a scalar for the material. More...
 
ShaderPtr getShader ()
 Returns the shader of the material. More...
 
void setShader (ShaderPtr arg)
 Sets the shader of the material. More...
 
const std::string & getName ()
 Returns the name of the material. More...
 
void setName (const std::string &arg)
 Sets the name of the material. More...
 

Detailed Description

A material is associated with textures and a shader to define the look of an object.

Author
David Steiner

Member Typedef Documentation

typedef std::unordered_map<std::string, GLfloat> Material::ScalarMap
typedef std::unordered_map<std::string, TexturePtr> Material::TextureMap
typedef std::unordered_map<std::string, vmml::Vector3f> Material::Vector3Map

Constructor & Destructor Documentation

Material::Material ( )
inline

Constructor.

virtual Material::~Material ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

void Material::bind ( )
virtual

Bind the shader and pass the attributes of the material.

const std::string& Material::getName ( )
inline

Returns the name of the material.

GLfloat Material::getScalar ( const std::string &  name)
inline

Returns a scalar associated with the material.

Parameters
[in]nameName of the scalar
const ScalarMap& Material::getScalars ( )
inline

Returns the scalars associated with the material.

ShaderPtr Material::getShader ( )
inline

Returns the shader of the material.

TexturePtr Material::getTexture ( const std::string &  name)
inline

Returns a texture associated with the material.

Parameters
[in]nameName of the texture
const TextureMap& Material::getTextures ( )
inline

Returns the textures associated with the material.

vmml::Vector3f Material::getVector ( const std::string &  name)
inline

Returns a vector associated with the material.

Parameters
[in]nameName of the vector
const Vector3Map& Material::getVectors ( )
inline

Returns the vectors associated with the material.

void Material::initialize ( ObjectManager o,
const MaterialData materialData,
ShaderPtr  shader 
)
virtual

Initializes the geometry object based on material data and a shader.

Parameters
[in]oObject management
[in]materialData
[in]shader
void Material::setName ( const std::string &  arg)
inline

Sets the name of the material.

Parameters
[in]argName for the material
void Material::setScalar ( const std::string &  name,
GLfloat  arg 
)
inline

Sets a scalar for the material.

Parameters
[in]nameName of the scalar
[in]argScalar for the material
void Material::setScalars ( const ScalarMap arg)
inline

Sets all scalars for the material.

Parameters
[in]argScalar for the material
void Material::setShader ( ShaderPtr  arg)
inline

Sets the shader of the material.

Parameters
[in]argShader for the material
void Material::setTexture ( const std::string &  name,
TexturePtr  arg 
)
inline

Sets a texture for the material.

Parameters
[in]nameName of the texture
[in]argTexture for the material
void Material::setTextures ( const TextureMap arg)
inline

Sets all textures for the material.

Parameters
[in]argTextures for the material
void Material::setVector ( const std::string &  name,
const vmml::Vector3f &  arg 
)
inline

Sets a vector for the material.

Parameters
[in]nameName of the vector
[in]argVector for the material
void Material::setVectors ( const Vector3Map arg)
inline

Sets all vectors for the material.

Parameters
[in]argVectors for the material