PixelLightAPI  .
Public Member Functions
PLRenderer::ProgramWrapper Class Reference

Comfort renderer program wrapper. More...

#include <ProgramWrapper.h>

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

List of all members.

Public Member Functions

void Get (const PLCore::String &sUniformName, int &nX)
void Get (const PLCore::String &sUniformName, float &fX)
void Get (const PLCore::String &sUniformName, double &fX)
void Set (const PLCore::String &sUniformName, int nX)
void Set (const PLCore::String &sUniformName, float fX)
void Set (const PLCore::String &sUniformName, double fX)
void Get (const PLCore::String &sUniformName, int &nX, int &nY)
void Get (const PLCore::String &sUniformName, float &fX, float &fY)
void Get (const PLCore::String &sUniformName, double &fX, double &fY)
void Get (const PLCore::String &sUniformName, PLMath::Vector2i &vVector)
void Get (const PLCore::String &sUniformName, PLMath::Vector2 &vVector)
void Get2 (const PLCore::String &sUniformName, int *pnComponents)
void Get2 (const PLCore::String &sUniformName, float *pfComponents)
void Get2 (const PLCore::String &sUniformName, double *pfComponents)
void Set (const PLCore::String &sUniformName, int nX, int nY)
void Set (const PLCore::String &sUniformName, float fX, float fY)
void Set (const PLCore::String &sUniformName, double fX, double fY)
void Set (const PLCore::String &sUniformName, const PLMath::Vector2i &vVector)
void Set (const PLCore::String &sUniformName, const PLMath::Vector2 &vVector)
void Set2 (const PLCore::String &sUniformName, const int *pnComponents)
void Set2 (const PLCore::String &sUniformName, const float *pfComponents)
void Set2 (const PLCore::String &sUniformName, const double *pfComponents)
void Get (const PLCore::String &sUniformName, int &nX, int &nY, int &nZ)
void Get (const PLCore::String &sUniformName, float &fX, float &fY, float &fZ)
void Get (const PLCore::String &sUniformName, double &fX, double &fY, double &fZ)
void Get (const PLCore::String &sUniformName, PLMath::Vector3i &vVector)
void Get (const PLCore::String &sUniformName, PLMath::Vector3 &vVector)
void Get (const PLCore::String &sUniformName, PLGraphics::Color3 &cColor)
void Get3 (const PLCore::String &sUniformName, int *pnComponents)
void Get3 (const PLCore::String &sUniformName, float *pfComponents)
void Get3 (const PLCore::String &sUniformName, double *pfComponents)
void Set (const PLCore::String &sUniformName, int nX, int nY, int nZ)
void Set (const PLCore::String &sUniformName, float fX, float fY, float fZ)
void Set (const PLCore::String &sUniformName, double fX, double fY, double fZ)
void Set (const PLCore::String &sUniformName, const PLMath::Vector3i &vVector)
void Set (const PLCore::String &sUniformName, const PLMath::Vector3 &vVector)
void Set (const PLCore::String &sUniformName, const PLGraphics::Color3 &cColor)
void Set3 (const PLCore::String &sUniformName, const int *pnComponents)
void Set3 (const PLCore::String &sUniformName, const float *pfComponents)
void Set3 (const PLCore::String &sUniformName, const double *pfComponents)
void Get (const PLCore::String &sUniformName, int &nX, int &nY, int &nZ, int &nW)
void Get (const PLCore::String &sUniformName, float &fX, float &fY, float &fZ, float &fW)
void Get (const PLCore::String &sUniformName, double &fX, double &fY, double &fZ, double &fW)
void Get (const PLCore::String &sUniformName, PLMath::Vector4 &vVector)
void Get (const PLCore::String &sUniformName, PLGraphics::Color4 &cColor)
void Get (const PLCore::String &sUniformName, PLMath::Quaternion &qQuaternion)
void Get4 (const PLCore::String &sUniformName, int *pnComponents)
void Get4 (const PLCore::String &sUniformName, float *pfComponents)
void Get4 (const PLCore::String &sUniformName, double *pfComponents)
void Set (const PLCore::String &sUniformName, int nX, int nY, int nZ, int nW)
void Set (const PLCore::String &sUniformName, float fX, float fY, float fZ, float fW)
void Set (const PLCore::String &sUniformName, double fX, double fY, double fZ, double fW)
void Set (const PLCore::String &sUniformName, const PLMath::Vector4 &vVector)
void Set (const PLCore::String &sUniformName, const PLGraphics::Color4 &cColor)
void Set (const PLCore::String &sUniformName, const PLMath::Quaternion &qQuaternion)
void Set4 (const PLCore::String &sUniformName, const int *pnComponents)
void Set4 (const PLCore::String &sUniformName, const float *pfComponents)
void Set4 (const PLCore::String &sUniformName, const double *pfComponents)
void Get (const PLCore::String &sUniformName, PLMath::Matrix3x3 &mMatrix)
void Get (const PLCore::String &sUniformName, PLMath::Matrix4x4 &mMatrix)
void Set (const PLCore::String &sUniformName, const PLMath::Matrix3x3 &mMatrix, bool bTranspose=false)
void Set (const PLCore::String &sUniformName, const PLMath::Matrix4x4 &mMatrix, bool bTranspose=false)
int GetTextureUnit (const PLCore::String &sUniformName)
int Set (const PLCore::String &sUniformName, TextureBuffer *pTextureBuffer)
bool Set (const PLCore::String &sUniformBlockName, UniformBuffer *pUniformBuffer, PLCore::uint32 nBindingPoint)
 Sets the uniform buffer feeding the specified uniform block with data.
bool Set (const PLCore::String &sAttributeName, VertexBuffer *pVertexBuffer, PLCore::uint32 nIndex)
 Sets a attribute by using an index to reference the vertex buffer attribute to use.
bool Set (const PLCore::String &sAttributeName, VertexBuffer *pVertexBuffer, VertexBuffer::ESemantic nSemantic, PLCore::uint32 nChannel=0)
 Sets a attribute by using a semantic to reference the vertex buffer attribute to use.

Detailed Description

Comfort renderer program wrapper.

Remarks:
The "Program.h"-header is slim and the program interface is designed to be universal and efficient. While this is fine in general, it may feel to complicated in simple daily use. For example, in order to set a program attribute one has to write for instance ProgramAttribute *pProgramAttribute = pProgram->GetAttribute("VertexPosition"); if (pProgramAttribute) pProgramAttribute->Set(pVertexBuffer, VertexBuffer::Position);

The purpose of this "ProgramWrapper"-interface is to make simple usage as shown in the example above more compact and direct by allowing to write m_pProgram->Set("VertexPosition", m_pVertexBuffer, VertexBuffer::Position) instead.

Please note that "ProgramWrapper" is just an interface and no real class which can be instanced. All methods are inlined and simple. In order to use this interface write e.g. ProgramWrapper *pProgram = static_cast<ProgramWrapper*>(pShaderLanguage->CreateProgram(pVertexShader, pFragmentShader)); This means that it is actually a hack because one has to cast an class instance to a certain class, although the class instance is in fact not an instance of it. Due to the simplicity of "ProgramWrapper" and the fact that it doesn't introduce e.g. new variables, this is working.

Note:
  • In case you need the best possible performance when dealing with GPU programs, you may not want to use this program wrapper (see "Program"-class)

Member Function Documentation

void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
int &  nX 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
float &  fX 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
double &  fX 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
int  nX 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
float  fX 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
double  fX 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
int &  nX,
int &  nY 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
float &  fX,
float &  fY 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
double &  fX,
double &  fY 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Vector2i vVector 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Vector2 vVector 
) [inline]
void PLRenderer::ProgramWrapper::Get2 ( const PLCore::String sUniformName,
int *  pnComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get2 ( const PLCore::String sUniformName,
float *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get2 ( const PLCore::String sUniformName,
double *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
int  nX,
int  nY 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
float  fX,
float  fY 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
double  fX,
double  fY 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Vector2i vVector 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Vector2 vVector 
) [inline]
void PLRenderer::ProgramWrapper::Set2 ( const PLCore::String sUniformName,
const int *  pnComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set2 ( const PLCore::String sUniformName,
const float *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set2 ( const PLCore::String sUniformName,
const double *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
int &  nX,
int &  nY,
int &  nZ 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
float &  fX,
float &  fY,
float &  fZ 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
double &  fX,
double &  fY,
double &  fZ 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Vector3i vVector 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Vector3 vVector 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLGraphics::Color3 cColor 
) [inline]
void PLRenderer::ProgramWrapper::Get3 ( const PLCore::String sUniformName,
int *  pnComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get3 ( const PLCore::String sUniformName,
float *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get3 ( const PLCore::String sUniformName,
double *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
int  nX,
int  nY,
int  nZ 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
float  fX,
float  fY,
float  fZ 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
double  fX,
double  fY,
double  fZ 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Vector3i vVector 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Vector3 vVector 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLGraphics::Color3 cColor 
) [inline]
void PLRenderer::ProgramWrapper::Set3 ( const PLCore::String sUniformName,
const int *  pnComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set3 ( const PLCore::String sUniformName,
const float *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set3 ( const PLCore::String sUniformName,
const double *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
int &  nX,
int &  nY,
int &  nZ,
int &  nW 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
float &  fX,
float &  fY,
float &  fZ,
float &  fW 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
double &  fX,
double &  fY,
double &  fZ,
double &  fW 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Vector4 vVector 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLGraphics::Color4 cColor 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Quaternion qQuaternion 
) [inline]
void PLRenderer::ProgramWrapper::Get4 ( const PLCore::String sUniformName,
int *  pnComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get4 ( const PLCore::String sUniformName,
float *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get4 ( const PLCore::String sUniformName,
double *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
int  nX,
int  nY,
int  nZ,
int  nW 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
float  fX,
float  fY,
float  fZ,
float  fW 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
double  fX,
double  fY,
double  fZ,
double  fW 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Vector4 vVector 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLGraphics::Color4 cColor 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Quaternion qQuaternion 
) [inline]
void PLRenderer::ProgramWrapper::Set4 ( const PLCore::String sUniformName,
const int *  pnComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set4 ( const PLCore::String sUniformName,
const float *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Set4 ( const PLCore::String sUniformName,
const double *  pfComponents 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Matrix3x3 mMatrix 
) [inline]
void PLRenderer::ProgramWrapper::Get ( const PLCore::String sUniformName,
PLMath::Matrix4x4 mMatrix 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Matrix3x3 mMatrix,
bool  bTranspose = false 
) [inline]
void PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
const PLMath::Matrix4x4 mMatrix,
bool  bTranspose = false 
) [inline]
int PLRenderer::ProgramWrapper::GetTextureUnit ( const PLCore::String sUniformName) [inline]
int PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformName,
TextureBuffer pTextureBuffer 
) [inline]
bool PLRenderer::ProgramWrapper::Set ( const PLCore::String sUniformBlockName,
UniformBuffer pUniformBuffer,
PLCore::uint32  nBindingPoint 
) [inline]

Sets the uniform buffer feeding the specified uniform block with data.

Parameters:
[in]sUniformBlockNameUniform block name
[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.
bool PLRenderer::ProgramWrapper::Set ( const PLCore::String sAttributeName,
VertexBuffer pVertexBuffer,
PLCore::uint32  nIndex 
) [inline]

Sets a attribute by using an index to reference the vertex buffer attribute to use.

Parameters:
[in]sAttributeNameAttribute name
[in]pVertexBufferVertex buffer to use, can be a null pointer
[in]nIndexIndex of the vertex buffer attribute to connect with the vertex shader attribute
Returns:
'true' if all went fine, else 'false' (maybe there's no attribute with the given name?
Note:
  • Comfort method
bool PLRenderer::ProgramWrapper::Set ( const PLCore::String sAttributeName,
VertexBuffer pVertexBuffer,
VertexBuffer::ESemantic  nSemantic,
PLCore::uint32  nChannel = 0 
) [inline]

Sets a attribute by using a semantic to reference the vertex buffer attribute to use.

Parameters:
[in]sAttributeNameAttribute name
[in]pVertexBufferVertex buffer to use, can be a null pointer
[in]nSemanticSemantic of the vertex buffer attribute to connect with the vertex shader attribute
[in]nChannelPipeline channel (see ESemantic, maximum see MaxPipelineChannels)
Returns:
'true' if all went fine, else 'false' (maybe there's no attribute with the given name?
Note:
  • Comfort method

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