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

Abstract renderer uniform buffer (UBO, aka "constant buffer") resource. More...

#include <UniformBuffer.h>

Inheritance diagram for PLRenderer::UniformBuffer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual PLRENDERER_API ~UniformBuffer ()
 Destructor.
PLRENDERER_API UniformBufferoperator= (const UniformBuffer &cSource)
 Copy operator.
void CopyFrom (const void *pData)
 Copies data from a given buffer into this uniform buffer.
void CopyTo (void *pData)
 Copies data from this uniform buffer into a given buffer.
virtual PLCore::String GetShaderLanguage () const =0
 Returns the name of the shader language the uniform buffer is using.
virtual PLRENDERER_API void * GetData () override
 Returns the buffer data.

Protected Member Functions

PLRENDERER_API UniformBuffer (Renderer &cRenderer)
 Constructor.

Detailed Description

Abstract renderer uniform buffer (UBO, aka "constant buffer") resource.


Constructor & Destructor Documentation

virtual PLRENDERER_API PLRenderer::UniformBuffer::~UniformBuffer ( ) [virtual]

Destructor.

PLRENDERER_API PLRenderer::UniformBuffer::UniformBuffer ( Renderer cRenderer) [protected]

Constructor.

Parameters:
[in]cRendererOwner renderer

Member Function Documentation

PLRENDERER_API UniformBuffer& PLRenderer::UniformBuffer::operator= ( const UniformBuffer cSource)

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
Reference to this object
void PLRenderer::UniformBuffer::CopyFrom ( const void *  pData) [inline]

Copies data from a given buffer into this uniform buffer.

Parameters:
[in]pDataData to copy into this uniform buffer, must be valid and must have at least "GetSize()" bytes
Remarks:
This ease of use method locks the uniform buffer, copies the given data into it and unlocks the uniform buffer when done.
void PLRenderer::UniformBuffer::CopyTo ( void *  pData) [inline]

Copies data from this uniform buffer into a given buffer.

Parameters:
[out]pDataBuffer to copy into, must be valid and must have at least "GetSize()" bytes
Remarks:
This ease of use method locks the uniform buffer, copies the uniform buffer data into the given buffer and unlocks the uniform buffer when done.

Returns the name of the shader language the uniform buffer is using.

Returns:
The name of the shader language the uniform buffer is using (for example "GLSL" or "Cg")
Remarks:
In theory, the uniform buffer is independent of the used shader language because it's just a buffer. In practice, e.g. the Cg shader language comes with it's own way how to create and use uniform buffers, that's the only reason PixelLight connects an uniform buffer with a shader language.
virtual PLRENDERER_API void* PLRenderer::UniformBuffer::GetData ( ) [override, virtual]

Returns the buffer data.

Returns:
The data of the locked buffer, a null pointer on error (Maybe the buffer isn't locked?)
Note:
  • This function will only work if the buffer is locked (see Lock())
  • Note that the vertex element type size depends on the used API. For instance color, OpenGL will use 4*float to save the color value, but Direct3D will handle colors as PLCore::uint32! Therefore you should use this function carefully! We recommend to use the special functions provided by the vertex buffer interface to manipulate the vertex buffer data.
  • Do NOT delete the returned data!

Implements PLRenderer::Buffer.


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:39
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported