Developer Documentation
GLSL::UniformPool Class Reference

GLSL uniform pool. More...

#include <OpenFlipper/libs_required/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...
 
QString toString () const
 print to string for debugging More...
 
UniformPooloperator= (const UniformPool &_other)
 copy 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 64 of file UniformPool.hh.

Member Function Documentation

◆ addBuf()

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 570 of file UniformPool.cc.

◆ addMatrix()

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

Add or update a matrix type uniform in pool.

Parameters
_matuniform specifier

Definition at line 534 of file UniformPool.cc.

◆ addPool()

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

Add all uniforms of a pool to this pool.

Parameters
_srcsource uniform pool

Definition at line 149 of file UniformPool.cc.

◆ addVecf()

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

Add or update a vector type uniform in pool.

Parameters
_vecuniform specifier

Definition at line 435 of file UniformPool.cc.

◆ addVeci()

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

Add or update a vector type uniform in pool.

Parameters
_vecuniform specifier

Definition at line 468 of file UniformPool.cc.

◆ addVecui()

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

Add or update a vector type uniform in pool.

Parameters
_vecuniform specifier

Definition at line 501 of file UniformPool.cc.

◆ bind() [1/2]

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

Send all stored uniforms to program.

Parameters
_progreceiving GLSL program

Definition at line 116 of file UniformPool.cc.

◆ bind() [2/2]

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

Send all stored uniforms to program.

Parameters
_progopengl program id

Definition at line 124 of file UniformPool.cc.

◆ clear()

void GLSL::UniformPool::clear ( )

Clear the pool.

Definition at line 86 of file UniformPool.cc.

◆ empty()

bool GLSL::UniformPool::empty ( ) const

returns if the pool is empty

Returns
empty pool?

Definition at line 95 of file UniformPool.cc.

◆ findEntry()

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 135 of file UniformPool.cc.

◆ operator=()

UniformPool & GLSL::UniformPool::operator= ( const UniformPool _other)

copy

Definition at line 81 of file UniformPool.cc.

◆ setUniform() [1/15]

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 614 of file UniformPool.cc.

◆ setUniform() [2/15]

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 630 of file UniformPool.cc.

◆ setUniform() [3/15]

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 647 of file UniformPool.cc.

◆ setUniform() [4/15]

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 665 of file UniformPool.cc.

◆ setUniform() [5/15]

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 681 of file UniformPool.cc.

◆ setUniform() [6/15]

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 697 of file UniformPool.cc.

◆ setUniform() [7/15]

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 714 of file UniformPool.cc.

◆ setUniform() [8/15]

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 732 of file UniformPool.cc.

◆ setUniform() [9/15]

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 749 of file UniformPool.cc.

◆ setUniform() [10/15]

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 765 of file UniformPool.cc.

◆ setUniform() [11/15]

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 782 of file UniformPool.cc.

◆ setUniform() [12/15]

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 800 of file UniformPool.cc.

◆ setUniform() [13/15]

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 817 of file UniformPool.cc.

◆ setUniform() [14/15]

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 853 of file UniformPool.cc.

◆ setUniform() [15/15]

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 864 of file UniformPool.cc.

◆ setUniformMat3()

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 835 of file UniformPool.cc.

◆ toString()

QString GLSL::UniformPool::toString ( ) const

print to string for debugging

Definition at line 100 of file UniformPool.cc.


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