19 typedef std::unordered_map<std::string, TexturePtr>
TextureMap;
20 typedef std::unordered_map<std::string, vmml::Vector3f>
Vector3Map;
21 typedef std::unordered_map<std::string, GLfloat>
ScalarMap;
60 vmml::Vector3f
getVector(
const std::string &name) {
return _vectors[name]; }
69 GLfloat
getScalar(
const std::string &name) {
return _scalars[name]; }
85 void setVectors(
const Vector3Map& arg) { _vectors = arg; }
91 void setVector(
const std::string &name,
const vmml::Vector3f &arg) { _vectors[name] = arg; }
96 void setScalars(
const ScalarMap &arg) { _scalars = arg; }
102 void setScalar(
const std::string &name, GLfloat arg) { _scalars[name] = arg; }
115 const std::string &
getName() {
return _name; }
120 void setName(
const std::string &arg) { _name = arg; }
126 TextureMap _textures;
void setVector(const std::string &name, const vmml::Vector3f &arg)
Sets a vector for the material.
Definition: Material.h:91
void setShader(ShaderPtr arg)
Sets the shader of the material.
Definition: Material.h:111
const TextureMap & getTextures()
Returns the textures associated with the material.
Definition: Material.h:46
std::shared_ptr< Texture > TexturePtr
Definition: Texture.h:67
std::shared_ptr< Shader > ShaderPtr
Definition: Shader.h:211
virtual void bind()
Bind the shader and pass the attributes of the material.
Definition: Material.cpp:32
void setScalars(const ScalarMap &arg)
Sets all scalars for the material.
Definition: Material.h:96
Material()
Constructor.
Definition: Material.h:27
const ScalarMap & getScalars()
Returns the scalars associated with the material.
Definition: Material.h:64
const Vector3Map & getVectors()
Returns the vectors associated with the material.
Definition: Material.h:55
std::unordered_map< std::string, GLfloat > ScalarMap
Definition: Material.h:21
void setVectors(const Vector3Map &arg)
Sets all vectors for the material.
Definition: Material.h:85
GLfloat getScalar(const std::string &name)
Returns a scalar associated with the material.
Definition: Material.h:69
void setTextures(const TextureMap &arg)
Sets all textures for the material.
Definition: Material.h:74
A material is associated with textures and a shader to define the look of an object.
Definition: Material.h:15
const std::string & getName()
Returns the name of the material.
Definition: Material.h:115
std::unordered_map< std::string, vmml::Vector3f > Vector3Map
Definition: Material.h:20
void setName(const std::string &arg)
Sets the name of the material.
Definition: Material.h:120
TexturePtr getTexture(const std::string &name)
Returns a texture associated with the material.
Definition: Material.h:51
void setTexture(const std::string &name, TexturePtr arg)
Sets a texture for the material.
Definition: Material.h:80
virtual ~Material()
Virtual destructor.
Definition: Material.h:31
std::unordered_map< std::string, TexturePtr > TextureMap
Definition: Material.h:19
This class manages all objects in a project and makes sure no object is created twice.
Definition: ObjectManager.h:32
virtual void initialize(ObjectManager *o, const MaterialData &materialData, ShaderPtr shader)
Initializes the geometry object based on material data and a shader.
Definition: Material.cpp:5
vmml::Vector3f getVector(const std::string &name)
Returns a vector associated with the material.
Definition: Material.h:60
ShaderPtr getShader()
Returns the shader of the material.
Definition: Material.h:106
The underlying data of a material.
Definition: MaterialData.h:10
void setScalar(const std::string &name, GLfloat arg)
Sets a scalar for the material.
Definition: Material.h:102
std::shared_ptr< Material > MaterialPtr
Definition: Material.h:135