Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Graphics::Uniform Class Reference

Class for shader uniform. More...

#include <uniform.h>

Public Types

enum  UniformTypes {
  UniformTypes::FLOAT, UniformTypes::VEC2, UniformTypes::VEC3, UniformTypes::VEC4,
  UniformTypes::INT, UniformTypes::IVEC2, UniformTypes::IVEC3, UniformTypes::IVEC4,
  UniformTypes::UINT, UniformTypes::UVEC2, UniformTypes::UVEC3, UniformTypes::UVEC4,
  UniformTypes::BOOL, UniformTypes::BVEC2, UniformTypes::BVEC3, UniformTypes::BVEC4,
  UniformTypes::MAT2, UniformTypes::MAT3, UniformTypes::MAT4, UniformTypes::MAT23,
  UniformTypes::MAT32, UniformTypes::MAT24, UniformTypes::MAT42, UniformTypes::MAT34,
  UniformTypes::MAT43
}
 

Public Member Functions

 Uniform ()
 Uniform constructor. More...
 
template<typename T >
void setData (const std::string &name, const T &data)
 Sets the data. More...
 
UniformTypes getType () const noexcept
 Gets the type. More...
 
std::string getName () const noexcept
 Gets the name. More...
 
bool isDirty () const noexcept
 Determines if dirty. More...
 
void clean () noexcept
 dirty = false More...
 
template<typename T >
getData () const noexcept
 Gets the data. More...
 
bool operator< (const Uniform &right) const noexcept
 < operator using name More...
 
bool operator== (const Uniform &right) const noexcept
 == operator More...
 
bool operator!= (const Uniform &right) const noexcept
 != operator More...
 
std::string to_string () const noexcept
 Returns a string representation of the object. More...
 
template<>
void setData (const std::string &name, const float &data)
 
template<>
void setData (const std::string &name, const int &data)
 
template<>
void setData (const std::string &name, const unsigned int &data)
 
template<>
void setData (const std::string &name, const bool &data)
 
template<>
float getData () const noexcept
 
template<>
int getData () const noexcept
 
template<>
unsigned int getData () const noexcept
 
template<>
bool getData () const noexcept
 

Detailed Description

Class for shader uniform.

Member Enumeration Documentation

Enum describing the different types that can be held in a uniform.

Enumerator
FLOAT 
VEC2 
VEC3 
VEC4 
INT 
IVEC2 
IVEC3 
IVEC4 
UINT 
UVEC2 
UVEC3 
UVEC4 
BOOL 
BVEC2 
BVEC3 
BVEC4 
MAT2 
MAT3 
MAT4 
MAT23 
MAT32 
MAT24 
MAT42 
MAT34 
MAT43 

Constructor & Destructor Documentation

Graphics::Uniform::Uniform ( )

Uniform constructor.

Member Function Documentation

void Graphics::Uniform::clean ( )
noexcept

dirty = false

template<typename T >
T Graphics::Uniform::getData ( ) const
noexcept

Gets the data.

Template Parameters
TType of data to get
Returns
The data.

Referenced by Graphics::Shader::setUniform().

template<>
float Graphics::Uniform::getData ( ) const
noexcept
template<>
int Graphics::Uniform::getData ( ) const
noexcept
template<>
unsigned int Graphics::Uniform::getData ( ) const
noexcept
template<>
bool Graphics::Uniform::getData ( ) const
noexcept
std::string Graphics::Uniform::getName ( ) const
noexcept

Gets the name.

Returns
The name.

Referenced by Graphics::Shader::setUniform(), and to_string().

Uniform::UniformTypes Graphics::Uniform::getType ( ) const
noexcept

Gets the type.

Returns
The type.

Referenced by Graphics::Shader::setUniform().

bool Graphics::Uniform::isDirty ( ) const
noexcept

Determines if dirty.

Returns
True if dirty, False otherwise.

Referenced by to_string().

bool Graphics::Uniform::operator!= ( const Uniform right) const
noexcept

!= operator

Parameters
[in]rightThe right
Returns
True if not the same uniform
bool Graphics::Uniform::operator< ( const Uniform right) const
noexcept

< operator using name

Parameters
[in]rightThe right
Returns
true if right.name is alphabetically higher than this.name
bool Graphics::Uniform::operator== ( const Uniform right) const
noexcept

== operator

Parameters
[in]rightThe right
Returns
True if same uniform
template<>
void Graphics::Uniform::setData ( const std::string &  name,
const float &  data 
)
template<>
void Graphics::Uniform::setData ( const std::string &  name,
const int &  data 
)
template<typename T >
void Graphics::Uniform::setData ( const std::string &  name,
const T &  data 
)
template<>
void Graphics::Uniform::setData ( const std::string &  name,
const unsigned int &  data 
)
template<>
void Graphics::Uniform::setData ( const std::string &  name,
const bool &  data 
)
std::string Graphics::Uniform::to_string ( ) const
noexcept

Returns a string representation of the object.

Returns
String representation of the object.

References getName(), and isDirty().


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