Ocular Engine
Ocular::Graphics::Uniform Class Reference

Public Member Functions

 Uniform (Uniform const &)
 
void operator= (Uniform const &)
 
void setData (float data)
 
void setData (Math::Vector4f const &data)
 
void setData (Math::Matrix3x3 const &data)
 
void setData (Math::Matrix4x4 const &data)
 
bool setData (uint32_t size, float const *data)
 
uint32_t getSize () const
 
float getElement (uint32_t index) const
 
float const * getData () const
 
void setName (std::string const &name)
 
std::string const & getName () const
 
void setType (std::string const &type)
 
std::string const & getType () const
 
void setRegister (uint32_t index)
 
uint32_t getRegister () const
 

Static Public Attributes

static const uint32_t MaxDataSize = 16
 Maximum size of the m_Data array.
 

Protected Attributes

std::string m_Name
 
std::string m_Type
 
uint32_t m_Register
 
uint32_t m_Size
 
std::array< float, Uniform::MaxDataSizem_Data
 

Member Function Documentation

float const * Ocular::Graphics::Uniform::getData ( ) const
Returns
A pointer to the internal data. Guaranteed to be (MaxDataSize * sizeof(float)) in size, though only part of the data array may actually be in use (see getSize()). Unused portions may be anything as the array is only cleared to zero once during creation.
float Ocular::Graphics::Uniform::getElement ( uint32_t  index) const

Retrieves the data at the specified index.

Parameters
[in]indexIndex of data to retrieve. Depending on the type of underlying uniform (float, vector, matrix), this may be on the range of [0,16).
Returns
The data at the specified index. If index or underlying data is invalid, will return 0.0.
std::string const & Ocular::Graphics::Uniform::getName ( ) const
Returns
The string name of this Uniform.
uint32_t Ocular::Graphics::Uniform::getRegister ( ) const
Returns
The register index of this Uniform.
uint32_t Ocular::Graphics::Uniform::getSize ( ) const
Returns
Number of data elements stored in this uniform.
std::string const & Ocular::Graphics::Uniform::getType ( ) const
Returns
The superficial type of this Uniform.
void Ocular::Graphics::Uniform::setData ( float  data)

Sets the uniform data.

Parameters
[in]dataSingle float value for the Uniform to represent.
void Ocular::Graphics::Uniform::setData ( Math::Vector4f const &  data)

Sets the uniform data.

Parameters
[in]dataA four-component vector for the Uniform to represent.
void Ocular::Graphics::Uniform::setData ( Math::Matrix3x3 const &  data)

Sets the uniform data.

Parameters
[in]dataA 3x3 matrix for the Uniform to represent.
void Ocular::Graphics::Uniform::setData ( Math::Matrix4x4 const &  data)

Sets the uniform data.

Parameters
[in]dataA 4x4 matrix for the Uniform to represent.
bool Ocular::Graphics::Uniform::setData ( uint32_t  size,
float const *  data 
)

Sets the uniform data.

Parameters
[in]sizeNumber of elements being passed. Valid values are: 1, 4, 12, 16.
[in]dataUniform data to set.
Returns
TRUE if successful. May return false if size is invalid, or elements is NULL.
void Ocular::Graphics::Uniform::setName ( std::string const &  name)

Sets the name of this Uniform.

Parameters
[in]name
void Ocular::Graphics::Uniform::setRegister ( uint32_t  index)

Sets the register index of this Uniform.

Parameters
[in]index
void Ocular::Graphics::Uniform::setType ( std::string const &  type)

Sets the superficial type of this Uniform (float, Color, Vector4f, Matrix4x4)

Parameters
[in]typeString representation of the type (see Utils::TypeName<T>::name)

The documentation for this class was generated from the following files: