A properties object caches data to pass to a shader (such as matrices, vectors and scalars) and can be associated with a drawable object. More...

#include <Properties.h>

Public Types

typedef std::map< std::string, vmml::Matrix4f > Matrix4x4Map
 
typedef std::map< std::string, vmml::Matrix3f > Matrix3x3Map
 
typedef std::map< std::string, vmml::Vector4f > Vector4Map
 
typedef std::map< std::string, vmml::Vector3f > Vector3Map
 
typedef std::map< std::string, GLfloat > ScalarMap
 

Public Member Functions

virtual ~Properties ()
 Virtual destructor. More...
 
const Matrix4x4MapgetMatrices4x4 ()
 Returns all 4x4 matrices. More...
 
vmml::Matrix4f getMatrix4x4 (const std::string &name)
 Returns a 4x4 matrix. More...
 
const Matrix3x3MapgetMatrices3x3 ()
 Returns all 3x3 matrices. More...
 
vmml::Matrix3f getMatrix3x3 (const std::string &name)
 Returns a 3x3 matrix. More...
 
const Vector4MapgetVectors4 ()
 Returns all 4x1 vectors. More...
 
vmml::Vector4f getVector4 (const std::string &name)
 Returns a 4x1 vector. More...
 
const Vector3MapgetVectors3 ()
 Returns all 3x1 vectors. More...
 
vmml::Vector3f getVector3 (const std::string &name)
 Returns a 3x1 vector. More...
 
const ScalarMapgetScalars ()
 Returns all scalars. More...
 
GLfloat getScalar (const std::string &name)
 Returns a scalar. More...
 
void setMatrices4x4 (const Matrix4x4Map &arg)
 Sets all 4x4 matrices. More...
 
void setMatrix (const std::string &name, const vmml::Matrix4f &arg)
 Sets a 4x4 matrix. More...
 
void setMatrices3x3 (const Matrix3x3Map &arg)
 Sets all 3x3 matrices. More...
 
void setMatrix (const std::string &name, const vmml::Matrix3f &arg)
 Sets a 3x3 matrix. More...
 
void setVectors4 (const Vector4Map &arg)
 Sets all 4x1 vectors. More...
 
void setVector (const std::string &name, const vmml::Vector4f &arg)
 Sets a 4x1 vector. More...
 
void setVectors3 (const Vector3Map &arg)
 Sets all 3x1 vectors. More...
 
void setVector (const std::string &name, const vmml::Vector3f &arg)
 Sets a 3x1 vector. More...
 
void setScalars (const ScalarMap &arg)
 Sets all scalars. More...
 
void setScalar (const std::string &name, GLfloat arg)
 Sets a scalar. More...
 
const std::string & getName ()
 Returns the name of the properties. More...
 
void setName (const std::string &arg)
 Sets the name of the properties. More...
 
void passToShader (ShaderPtr shader)
 Pass properties to specified shader. More...
 
void clear ()
 Clear all properties. More...
 

Detailed Description

A properties object caches data to pass to a shader (such as matrices, vectors and scalars) and can be associated with a drawable object.

The properties may be passed to the shader as uniforms. The names of the stored objects should therefore be chosen to match the names of the uniforms in the shader.

Author
Benjamin Buergisser

Member Typedef Documentation

typedef std::map<std::string, vmml::Matrix3f> Properties::Matrix3x3Map
typedef std::map<std::string, vmml::Matrix4f> Properties::Matrix4x4Map
typedef std::map<std::string, GLfloat> Properties::ScalarMap
typedef std::map<std::string, vmml::Vector3f> Properties::Vector3Map
typedef std::map<std::string, vmml::Vector4f> Properties::Vector4Map

Constructor & Destructor Documentation

virtual Properties::~Properties ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

void Properties::clear ( )
inline

Clear all properties.

const Matrix3x3Map& Properties::getMatrices3x3 ( )
inline

Returns all 3x3 matrices.

const Matrix4x4Map& Properties::getMatrices4x4 ( )
inline

Returns all 4x4 matrices.

vmml::Matrix3f Properties::getMatrix3x3 ( const std::string &  name)
inline

Returns a 3x3 matrix.

Parameters
[in]nameName of the matrix
vmml::Matrix4f Properties::getMatrix4x4 ( const std::string &  name)
inline

Returns a 4x4 matrix.

Parameters
[in]nameName of the matrix
const std::string& Properties::getName ( )
inline

Returns the name of the properties.

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

Returns a scalar.

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

Returns all scalars.

vmml::Vector3f Properties::getVector3 ( const std::string &  name)
inline

Returns a 3x1 vector.

Parameters
[in]nameName of the vector
vmml::Vector4f Properties::getVector4 ( const std::string &  name)
inline

Returns a 4x1 vector.

Parameters
[in]nameName of the vector
const Vector3Map& Properties::getVectors3 ( )
inline

Returns all 3x1 vectors.

const Vector4Map& Properties::getVectors4 ( )
inline

Returns all 4x1 vectors.

void Properties::passToShader ( ShaderPtr  shader)
inline

Pass properties to specified shader.

Parameters
[in]shaderThe shader the properties are passed to
void Properties::setMatrices3x3 ( const Matrix3x3Map arg)
inline

Sets all 3x3 matrices.

Parameters
[in]arg3x3 matrices
void Properties::setMatrices4x4 ( const Matrix4x4Map arg)
inline

Sets all 4x4 matrices.

Parameters
[in]arg4x4 matrices
void Properties::setMatrix ( const std::string &  name,
const vmml::Matrix4f &  arg 
)
inline

Sets a 4x4 matrix.

Parameters
[in]nameName of the matrix
[in]arg4x4 matrix
void Properties::setMatrix ( const std::string &  name,
const vmml::Matrix3f &  arg 
)
inline

Sets a 3x3 matrix.

Parameters
[in]nameName of the matrix
[in]arg3x3 matrix
void Properties::setName ( const std::string &  arg)
inline

Sets the name of the properties.

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

Sets a scalar.

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

Sets all scalars.

Parameters
[in]argScalar
void Properties::setVector ( const std::string &  name,
const vmml::Vector4f &  arg 
)
inline

Sets a 4x1 vector.

Parameters
[in]nameName of the vector
[in]arg4x1 vector
void Properties::setVector ( const std::string &  name,
const vmml::Vector3f &  arg 
)
inline

Sets a 3x1 vector.

Parameters
[in]nameName of the vector
[in]arg3x1 vector
void Properties::setVectors3 ( const Vector3Map arg)
inline

Sets all 3x1 vectors.

Parameters
[in]arg3x1 vectors
void Properties::setVectors4 ( const Vector4Map arg)
inline

Sets all 4x1 vectors.

Parameters
[in]arg4x1 Vectors