Developer Documentation
GLSL::UniformPool Class Reference

GLSL uniform pool. More...

#include <ACG/ShaderUtils/UniformPool.hh>

Classes

struct  UniformBase
 
struct  UniformBuf
 
struct  UniformMat
 
struct  UniformVecf
 
struct  UniformVeci
 
struct  UniformVecui
 

Public Member Functions

 UniformPool ()
 Constructor.
 
 UniformPool (const UniformPool &_pool)
 Copy Constructor.
 
virtual ~UniformPool ()
 Destructor.
 
void bind (PtrProgram _prog) const
 Send all stored uniforms to program. More...
 
void bind (GLuint _prog) const
 Send all stored uniforms to program. More...
 
void setUniform (const char *_name, GLint _value)
 Set int uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec2i &_value)
 Set ivec2 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec3i &_value)
 Set ivec3 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec4i &_value)
 Set ivec4 uniform to specified value. More...
 
void setUniform (const char *_name, GLuint _value)
 Set uint uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec2ui &_value)
 Set uvec2 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec3ui &_value)
 Set uvec3 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec4ui &_value)
 Set uvec4 uniform to specified value. More...
 
void setUniform (const char *_name, GLfloat _value)
 Set float uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec2f &_value)
 Set vec2 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec3f &_value)
 Set vec3 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::Vec4f &_value)
 Set vec4 uniform to specified value. More...
 
void setUniform (const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false)
 Set 4x4fMatrix uniform to specified value. More...
 
void setUniformMat3 (const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false)
 Set 3x3fMatrix uniform to specified value. More...
 
void setUniform (const char *_name, GLint *_values, int _count)
 Set int array uniform to specified values. More...
 
void setUniform (const char *_name, GLfloat *_values, int _count)
 Set float array uniform to specified values. More...
 
void addPool (const UniformPool &_src)
 Add all uniforms of a pool to this pool. More...
 
void clear ()
 Clear the pool. More...
 
bool empty () const
 returns if the pool is empty More...
 

Private Types

typedef std::list< UniformBase * > UniformList
 
typedef UniformList::iterator UniformListIt
 

Private Member Functions

UniformListIt findEntry (std::string _name)
 Search the pool for an existing value for a uniform name. More...
 
void addVecf (const UniformVecf &_vec)
 Add or update a vector type uniform in pool. More...
 
void addVeci (const UniformVeci &_vec)
 Add or update a vector type uniform in pool. More...
 
void addVecui (const UniformVecui &_vec)
 Add or update a vector type uniform in pool. More...
 
void addMatrix (const UniformMat &_mat)
 Add or update a matrix type uniform in pool. More...
 
void addBuf (const char *_name, void *_values, int _count, bool _integer)
 Add or update an array type uniform in pool. More...
 

Private Attributes

UniformList pool_
 list of uniform params
 

Detailed Description

GLSL uniform pool.

A uniform pool collects values for shader uniforms

Definition at line 71 of file UniformPool.hh.

Member Function Documentation

void GLSL::UniformPool::addBuf ( const char *  _name,
void *  _values,
int  _count,
bool  _integer 
)
private

Add or update an array type uniform in pool.

Parameters
_nameUniform name
_valuesarray data
_countarray size (in dwords)
_integerinteger/float array

Definition at line 468 of file UniformPool.cc.

void GLSL::UniformPool::addMatrix ( const UniformMat _mat)
private

Add or update a matrix type uniform in pool.

Parameters
_matuniform specifier

Definition at line 432 of file UniformPool.cc.

void GLSL::UniformPool::addPool ( const UniformPool _src)

Add all uniforms of a pool to this pool.

Parameters
_srcsource uniform pool

Definition at line 136 of file UniformPool.cc.

void GLSL::UniformPool::addVecf ( const UniformVecf _vec)
private

Add or update a vector type uniform in pool.

Parameters
_vecuniform specifier

Definition at line 333 of file UniformPool.cc.

void GLSL::UniformPool::addVeci ( const UniformVeci _vec)
private

Add or update a vector type uniform in pool.

Parameters
_vecuniform specifier

Definition at line 366 of file UniformPool.cc.

void GLSL::UniformPool::addVecui ( const UniformVecui _vec)
private

Add or update a vector type uniform in pool.

Parameters
_vecuniform specifier

Definition at line 399 of file UniformPool.cc.

void GLSL::UniformPool::bind ( PtrProgram  _prog) const

Send all stored uniforms to program.

Parameters
_progreceiving GLSL program

Definition at line 103 of file UniformPool.cc.

void GLSL::UniformPool::bind ( GLuint  _prog) const

Send all stored uniforms to program.

Parameters
_progopengl program id

Definition at line 111 of file UniformPool.cc.

void GLSL::UniformPool::clear ( void  )

Clear the pool.

Definition at line 86 of file UniformPool.cc.

bool GLSL::UniformPool::empty ( ) const

returns if the pool is empty

Returns
empty pool?

Definition at line 95 of file UniformPool.cc.

UniformPool::UniformListIt GLSL::UniformPool::findEntry ( std::string  _name)
private

Search the pool for an existing value for a uniform name.

Parameters
_nameName of the uniform
Returns
iterator of uniform entry

Definition at line 122 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
GLint  _value 
)

Set int uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 512 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec2i _value 
)

Set ivec2 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 528 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec3i _value 
)

Set ivec3 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 545 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec4i _value 
)

Set ivec4 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 563 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
GLuint  _value 
)

Set uint uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 579 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec2ui _value 
)

Set uvec2 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 595 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec3ui _value 
)

Set uvec3 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 612 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec4ui _value 
)

Set uvec4 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 630 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
GLfloat  _value 
)

Set float uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 647 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec2f _value 
)

Set vec2 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 663 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec3f _value 
)

Set vec3 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 680 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::Vec4f _value 
)

Set vec4 uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 698 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
const ACG::GLMatrixf _value,
bool  _transposed = false 
)

Set 4x4fMatrix uniform to specified value.

Parameters
_nameName of the uniform
_valueMatrix to be set
_transposedIs the matrix transposed?

Definition at line 715 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
GLint *  _values,
int  _count 
)

Set int array uniform to specified values.

Parameters
_nameName of the uniform to be set
_valuesPointer to an array with the new values
_countNumber of values in the given array

Definition at line 751 of file UniformPool.cc.

void GLSL::UniformPool::setUniform ( const char *  _name,
GLfloat *  _values,
int  _count 
)

Set float array uniform to specified values.

Parameters
_nameName of the uniform to be set
_valuesPointer to an array with the new values
_countNumber of values in the given array

Definition at line 762 of file UniformPool.cc.

void GLSL::UniformPool::setUniformMat3 ( const char *  _name,
const ACG::GLMatrixf _value,
bool  _transposed = false 
)

Set 3x3fMatrix uniform to specified value.

Parameters
_nameName of the uniform
_valueMatrix to be set
_transposedIs the matrix transposed?

Definition at line 733 of file UniformPool.cc.


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