PixelLightAPI  .
Public Member Functions | Protected Member Functions
PLRenderer::ProgramUniformBlock Class Reference

Abstract renderer program uniform block. More...

#include <ProgramUniformBlock.h>

List of all members.

Public Member Functions

virtual bool SetUniformBuffer (UniformBuffer *pUniformBuffer, PLCore::uint32 nBindingPoint)=0
 Sets the uniform buffer feeding this uniform block with data.
virtual PLCore::uint32 GetIndex () const =0
 Returns the uniform block index.
virtual PLCore::uint32 GetSize () const =0
 Returns the uniform block data size (in bytes)
virtual PLCore::uint32 GetUniformOffset (const PLCore::String &sUniformName) const =0
 Returns the offset (in bytes) of an uniform inside the uniform block.
virtual PLCore::uint32 GetUniformSize (const PLCore::String &sUniformName) const =0
 Returns the size (in bytes) of an uniform inside the uniform block.
virtual PLCore::uint32 GetUniformNumOfArrayElements (const PLCore::String &sUniformName) const =0
 Returns the number of array elements of an uniform inside the uniform block.

Protected Member Functions

PLRENDERER_API ProgramUniformBlock ()
 Constructor.
virtual PLRENDERER_API ~ProgramUniformBlock ()
 Destructor.

Detailed Description

Abstract renderer program uniform block.

Remarks:
The behavior of the "SetUniformBuffer()"-method depends on the used internal shader API. When using Cg, a call of the "SetUniformBuffer()"-method has only an effect when then program is going to be set in the near future - meaning it has no effect when the program, the uniform block is part of, is already the program currently used for rendering. When using GLSL, the "SetUniformBuffer()"-method is accessing a global UBO binding point, meaning that it doesn't matter whether or not the program, the uniform block is part of, is currently used for rendering. For performance reasons, this abstract program uniform block interface can't compensate those differences. It has to be as lightweight as possible in order to keep the interface performance impact as low as possible. So, to be on the safe side, do only call the "SetUniformBuffer()"-method if the program, the uniform block is part of, is currently not used for rendering.
Note:
  • Do only call the "SetUniformBuffer()"-method when the program, the uniform block is part of, is currently not used for rendering

Constructor & Destructor Documentation

Constructor.

virtual PLRENDERER_API PLRenderer::ProgramUniformBlock::~ProgramUniformBlock ( ) [protected, virtual]

Destructor.


Member Function Documentation

virtual bool PLRenderer::ProgramUniformBlock::SetUniformBuffer ( UniformBuffer pUniformBuffer,
PLCore::uint32  nBindingPoint 
) [pure virtual]

Sets the uniform buffer feeding this uniform block with data.

Parameters:
[in]pUniformBufferThe uniform buffer feeding this uniform block with data, can be a null pointer
[in]nBindingPointBinding point to use
Returns:
'true' if all went fine, else 'false' (maybe the number of bytes within the given uniform buffer is less than the number of bytes within this uniform block or there's a shader language mismatch)
Remarks:
The binding point is somewhat similar a texture unit. The total number of binding points which can be used at the same time during rendering are limited to e.g. 45 (just an example!) binding points.
virtual PLCore::uint32 PLRenderer::ProgramUniformBlock::GetIndex ( ) const [pure virtual]

Returns the uniform block index.

Returns:
The uniform block index
virtual PLCore::uint32 PLRenderer::ProgramUniformBlock::GetSize ( ) const [pure virtual]

Returns the uniform block data size (in bytes)

Returns:
The uniform block data size (in bytes)
virtual PLCore::uint32 PLRenderer::ProgramUniformBlock::GetUniformOffset ( const PLCore::String sUniformName) const [pure virtual]

Returns the offset (in bytes) of an uniform inside the uniform block.

Parameters:
[in]sUniformNameName of the uniform
Returns:
The offset (in bytes) of an uniform inside the uniform block
virtual PLCore::uint32 PLRenderer::ProgramUniformBlock::GetUniformSize ( const PLCore::String sUniformName) const [pure virtual]

Returns the size (in bytes) of an uniform inside the uniform block.

Returns:
The size (in bytes) of an uniform inside the uniform block
virtual PLCore::uint32 PLRenderer::ProgramUniformBlock::GetUniformNumOfArrayElements ( const PLCore::String sUniformName) const [pure virtual]

Returns the number of array elements of an uniform inside the uniform block.

Returns:
The number of array elements of an uniform inside the uniform block, 1 for none array uniforms

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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:23
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported