ork::UniformBlock Class Reference
[render]

A named block of uniforms. More...

#include <Uniform.h>

Inheritance diagram for ork::UniformBlock:
ork::Object

List of all members.

Public Member Functions

virtual ~UniformBlock ()
 Deletes this uniform block.
string getName () const
 Returns the name of this uniform block.
ptr< GPUBuffergetBuffer () const
 Returns the GPUBuffer that stores the values of the uniforms of this block.
ptr< UniformgetUniform (const string &name) const
 Returns the uniform of this block whose name is given.
ptr< Uniform1fgetUniform1f (const string &name)
 Returns the uniform1f of this block whose name is given.
ptr< Uniform1dgetUniform1d (const string &name)
 Returns the uniform1d of this block whose name is given.
ptr< Uniform1igetUniform1i (const string &name)
 Returns the uniform1i of this block whose name is given.
ptr< Uniform1uigetUniform1ui (const string &name)
 Returns the uniform1ui of this block whose name is given.
ptr< Uniform1bgetUniform1b (const string &name)
 Returns the uniform1b of this block whose name is given.
ptr< Uniform2fgetUniform2f (const string &name)
 Returns the uniform2f of this block whose name is given.
ptr< Uniform2dgetUniform2d (const string &name)
 Returns the uniform2d of this block whose name is given.
ptr< Uniform2igetUniform2i (const string &name)
 Returns the uniform2i of this block whose name is given.
ptr< Uniform2uigetUniform2ui (const string &name)
 Returns the uniform2ui of this block whose name is given.
ptr< Uniform2bgetUniform2b (const string &name)
 Returns the uniform2b of this block whose name is given.
ptr< Uniform3fgetUniform3f (const string &name)
 Returns the uniform3f of this block whose name is given.
ptr< Uniform3dgetUniform3d (const string &name)
 Returns the uniform3d of this block whose name is given.
ptr< Uniform3igetUniform3i (const string &name)
 Returns the uniform3i of this block whose name is given.
ptr< Uniform3uigetUniform3ui (const string &name)
 Returns the uniform3ui of this block whose name is given.
ptr< Uniform3bgetUniform3b (const string &name)
 Returns the uniform3b of this block whose name is given.
ptr< Uniform4fgetUniform4f (const string &name)
 Returns the uniform4f of this block whose name is given.
ptr< Uniform4dgetUniform4d (const string &name)
 Returns the uniform4d of this block whose name is given.
ptr< Uniform4igetUniform4i (const string &name)
 Returns the uniform4i of this block whose name is given.
ptr< Uniform4uigetUniform4ui (const string &name)
 Returns the uniform4ui of this block whose name is given.
ptr< Uniform4bgetUniform4b (const string &name)
 Returns the uniform4b of this block whose name is given.
ptr< UniformMatrix2fgetUniformMatrix2f (const string &name)
 Returns the uniformMatrix2f of this block whose name is given.
ptr< UniformMatrix2dgetUniformMatrix2d (const string &name)
 Returns the uniformMatrix2d of this block whose name is given.
ptr< UniformMatrix3fgetUniformMatrix3f (const string &name)
 Returns the uniformMatrix3f of this block whose name is given.
ptr< UniformMatrix3dgetUniformMatrix3d (const string &name)
 Returns the uniformMatrix3d of this block whose name is given.
ptr< UniformMatrix4fgetUniformMatrix4f (const string &name)
 Returns the uniformMatrix4f of this block whose name is given.
ptr< UniformMatrix4dgetUniformMatrix4d (const string &name)
 Returns the uniformMatrix4d of this block whose name is given.
ptr< UniformMatrix2x3fgetUniformMatrix2x3f (const string &name)
 Returns the uniformMatrix2x3f of this block whose name is given.
ptr< UniformMatrix2x3dgetUniformMatrix2x3d (const string &name)
 Returns the uniformMatrix2x3d of this block whose name is given.
ptr< UniformMatrix2x4fgetUniformMatrix2x4f (const string &name)
 Returns the uniformMatrix2x4f of this block whose name is given.
ptr< UniformMatrix2x4dgetUniformMatrix2x4d (const string &name)
 Returns the uniformMatrix2x4d of this block whose name is given.
ptr< UniformMatrix3x2fgetUniformMatrix3x2f (const string &name)
 Returns the uniformMatrix3x2f of this block whose name is given.
ptr< UniformMatrix3x2dgetUniformMatrix3x2d (const string &name)
 Returns the uniformMatrix3x2d of this block whose name is given.
ptr< UniformMatrix3x4fgetUniformMatrix3x4f (const string &name)
 Returns the uniformMatrix3x4f of this block whose name is given.
ptr< UniformMatrix3x4dgetUniformMatrix3x4d (const string &name)
 Returns the uniformMatrix3x4d of this block whose name is given.
ptr< UniformMatrix4x2fgetUniformMatrix4x2f (const string &name)
 Returns the uniformMatrix4x2f of this block whose name is given.
ptr< UniformMatrix4x2dgetUniformMatrix4x2d (const string &name)
 Returns the uniformMatrix4x2d of this block whose name is given.
ptr< UniformMatrix4x3fgetUniformMatrix4x3f (const string &name)
 Returns the uniformMatrix4x3f of this block whose name is given.
ptr< UniformMatrix4x3dgetUniformMatrix4x3d (const string &name)
 Returns the uniformMatrix4x2d of this block whose name is given.
ptr< UniformSamplergetUniformSampler (const string &name)
 Returns the uniform sampler of this block whose name is given.
void setBuffer (ptr< GPUBuffer > buffer)
 Sets the GPUBuffer to store the values of the uniforms of this block.

Protected Member Functions

 UniformBlock (Program *program, const string &name, GLuint index, GLuint size)
 Creates a new uniform block.
bool isMapped () const
 Returns true if the GPUBuffer associated with this block is currently mapped in client memory.
volatile void * mapBuffer (GLint offset)
 Maps the GPUBuffer associated with this block in client memory.
void unmapBuffer ()
 Unmaps the GPUBuffer associated with this block in client memory.

Static Protected Member Functions

static ptr< GPUBuffernewBuffer (string name)
 Callback method to create a new buffer.

Protected Attributes

Programprogram
 The Program to which this uniform block belongs.
string name
 The name of this uniform block.
GLuint index
 The index of this uniform block in its program.
GLuint size
 The total size of this uniform block's uniforms.
ptr< GPUBufferbuffer
 The GPUBuffer that stores the values of the uniforms of this block.
map< string, ptr< Uniform > > uniforms
 The uniforms of this block.

Static Protected Attributes

static static_ptr< Factory
< string, ptr< GPUBuffer > > > 
buffers
 The buffers associated to each uniform blocks.

Detailed Description

A named block of uniforms.

The values of the uniforms in a uniform block are stored in a GPUBuffer. Different Programs having identical uniform blocks have different UniformBlock objects, but these objects can share the same GPUBuffer to store their values. Hence, changing values inside this GPUBuffer changes the uniform values in all the programs that use this GPUBuffer. You don't have to manipulate the GPUBuffer content yourself to change the uniforms inside a uniform block: this is automatically managed by the Uniform and UniformBlock classes. In particular, these classes know the offset of each uniform in the buffer, and map and unmap this buffer in client memory when necessary. Initially the GPUBuffer associated with a UniformBlock is NULL. You must set it with setBuffer() before using the uniforms of this block.


Constructor & Destructor Documentation

virtual ork::UniformBlock::~UniformBlock (  )  [virtual]

Deletes this uniform block.

ork::UniformBlock::UniformBlock ( Program program,
const string &  name,
GLuint  index,
GLuint  size 
) [protected]

Creates a new uniform block.

Parameters:
program the program to which this uniform block belongs.
name the name of this uniform block in the GLSL code.
index the index of this uniform block in its program.
size the minimum buffer size to store the uniforms of this block.

Member Function Documentation

ptr<GPUBuffer> ork::UniformBlock::getBuffer (  )  const

Returns the GPUBuffer that stores the values of the uniforms of this block.

string ork::UniformBlock::getName (  )  const

Returns the name of this uniform block.

ptr<Uniform> ork::UniformBlock::getUniform ( const string &  name  )  const

Returns the uniform of this block whose name is given.

Parameters:
name a uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform1b > ork::UniformBlock::getUniform1b ( const string &  name  )  [inline]

Returns the uniform1b of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform1d > ork::UniformBlock::getUniform1d ( const string &  name  )  [inline]

Returns the uniform1d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform1f > ork::UniformBlock::getUniform1f ( const string &  name  )  [inline]

Returns the uniform1f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform1i > ork::UniformBlock::getUniform1i ( const string &  name  )  [inline]

Returns the uniform1i of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform1ui > ork::UniformBlock::getUniform1ui ( const string &  name  )  [inline]

Returns the uniform1ui of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform2b > ork::UniformBlock::getUniform2b ( const string &  name  )  [inline]

Returns the uniform2b of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform2d > ork::UniformBlock::getUniform2d ( const string &  name  )  [inline]

Returns the uniform2d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform2f > ork::UniformBlock::getUniform2f ( const string &  name  )  [inline]

Returns the uniform2f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform2i > ork::UniformBlock::getUniform2i ( const string &  name  )  [inline]

Returns the uniform2i of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform2ui > ork::UniformBlock::getUniform2ui ( const string &  name  )  [inline]

Returns the uniform2ui of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform3b > ork::UniformBlock::getUniform3b ( const string &  name  )  [inline]

Returns the uniform3b of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform3d > ork::UniformBlock::getUniform3d ( const string &  name  )  [inline]

Returns the uniform3d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform3f > ork::UniformBlock::getUniform3f ( const string &  name  )  [inline]

Returns the uniform3f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform3i > ork::UniformBlock::getUniform3i ( const string &  name  )  [inline]

Returns the uniform3i of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform3ui > ork::UniformBlock::getUniform3ui ( const string &  name  )  [inline]

Returns the uniform3ui of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform4b > ork::UniformBlock::getUniform4b ( const string &  name  )  [inline]

Returns the uniform4b of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform4d > ork::UniformBlock::getUniform4d ( const string &  name  )  [inline]

Returns the uniform4d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform4f > ork::UniformBlock::getUniform4f ( const string &  name  )  [inline]

Returns the uniform4f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform4i > ork::UniformBlock::getUniform4i ( const string &  name  )  [inline]

Returns the uniform4i of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< Uniform4ui > ork::UniformBlock::getUniform4ui ( const string &  name  )  [inline]

Returns the uniform4ui of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix2d > ork::UniformBlock::getUniformMatrix2d ( const string &  name  )  [inline]

Returns the uniformMatrix2d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix2f > ork::UniformBlock::getUniformMatrix2f ( const string &  name  )  [inline]

Returns the uniformMatrix2f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix2x3d > ork::UniformBlock::getUniformMatrix2x3d ( const string &  name  )  [inline]

Returns the uniformMatrix2x3d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix2x3f > ork::UniformBlock::getUniformMatrix2x3f ( const string &  name  )  [inline]

Returns the uniformMatrix2x3f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix2x4d > ork::UniformBlock::getUniformMatrix2x4d ( const string &  name  )  [inline]

Returns the uniformMatrix2x4d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix2x4f > ork::UniformBlock::getUniformMatrix2x4f ( const string &  name  )  [inline]

Returns the uniformMatrix2x4f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix3d > ork::UniformBlock::getUniformMatrix3d ( const string &  name  )  [inline]

Returns the uniformMatrix3d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix3f > ork::UniformBlock::getUniformMatrix3f ( const string &  name  )  [inline]

Returns the uniformMatrix3f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix3x2d > ork::UniformBlock::getUniformMatrix3x2d ( const string &  name  )  [inline]

Returns the uniformMatrix3x2d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix3x2f > ork::UniformBlock::getUniformMatrix3x2f ( const string &  name  )  [inline]

Returns the uniformMatrix3x2f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix3x4d > ork::UniformBlock::getUniformMatrix3x4d ( const string &  name  )  [inline]

Returns the uniformMatrix3x4d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix3x4f > ork::UniformBlock::getUniformMatrix3x4f ( const string &  name  )  [inline]

Returns the uniformMatrix3x4f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix4d > ork::UniformBlock::getUniformMatrix4d ( const string &  name  )  [inline]

Returns the uniformMatrix4d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix4f > ork::UniformBlock::getUniformMatrix4f ( const string &  name  )  [inline]

Returns the uniformMatrix4f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix4x2d > ork::UniformBlock::getUniformMatrix4x2d ( const string &  name  )  [inline]

Returns the uniformMatrix4x2d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix4x2f > ork::UniformBlock::getUniformMatrix4x2f ( const string &  name  )  [inline]

Returns the uniformMatrix4x2f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix4x3d > ork::UniformBlock::getUniformMatrix4x3d ( const string &  name  )  [inline]

Returns the uniformMatrix4x2d of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformMatrix4x3f > ork::UniformBlock::getUniformMatrix4x3f ( const string &  name  )  [inline]

Returns the uniformMatrix4x3f of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
ptr< UniformSampler > ork::UniformBlock::getUniformSampler ( const string &  name  )  [inline]

Returns the uniform sampler of this block whose name is given.

Parameters:
name a GLSL uniform name.
Returns:
the uniform of this block whose name is given, or NULL if there is no such uniform.
bool ork::UniformBlock::isMapped (  )  const [protected]

Returns true if the GPUBuffer associated with this block is currently mapped in client memory.

volatile void* ork::UniformBlock::mapBuffer ( GLint  offset  )  [protected]

Maps the GPUBuffer associated with this block in client memory.

This method also returns the address in client memory of the value at the given offset in the buffer.

Parameters:
offset an offset in bytes from the start of the buffer.
Returns:
a pointer to the value at 'offset' in the mapped buffer.
static ptr<GPUBuffer> ork::UniformBlock::newBuffer ( string  name  )  [static, protected]

Callback method to create a new buffer.

For use with buffers.

void ork::UniformBlock::setBuffer ( ptr< GPUBuffer buffer  ) 

Sets the GPUBuffer to store the values of the uniforms of this block.

Parameters:
buffer a GPUBuffer. This buffer can be shared between different UniformBlock instances corresponding to the same uniform block declaration.
void ork::UniformBlock::unmapBuffer (  )  [protected]

Unmaps the GPUBuffer associated with this block in client memory.


Member Data Documentation

The GPUBuffer that stores the values of the uniforms of this block.

static_ptr<Factory<string, ptr<GPUBuffer> > > ork::UniformBlock::buffers [static, protected]

The buffers associated to each uniform blocks.

When creating a new uniform block, the user should check if a buffer was already created for that UB name. Otherwise, he may create a new one.

GLuint ork::UniformBlock::index [protected]

The index of this uniform block in its program.

string ork::UniformBlock::name [protected]

The name of this uniform block.

The Program to which this uniform block belongs.

GLuint ork::UniformBlock::size [protected]

The total size of this uniform block's uniforms.

map<string, ptr<Uniform> > ork::UniformBlock::uniforms [protected]

The uniforms of this block.


Generated on Mon Oct 18 09:36:10 2010 for ork by  doxygen 1.6.1