Linderdaum Engine: clGLSLShaderProgram Class Reference
Updated: Sun Feb 5 2012 22:59:50
clGLSLShaderProgram Class Reference

#include <GLSL.h>

List of all members.

Public Member Functions

 clGLSLShaderProgram ()
virtual ~clGLSLShaderProgram ()
virtual void AfterConstruction ()
virtual bool IsSameResource (iResource *Other)
virtual std::string GetCachingDir () const
virtual std::string GetCachedFileName ()
virtual void CacheTo (const std::string &FileName)
virtual bool CacheFrom (const std::string &FileName)
virtual bool RelinkShaderProgram ()
 Force shader program relink.
virtual void Bind ()
 binded to the context as a current shader program, used in AddBuffer()
virtual void UnBind () const
 unbinded from the context
virtual void BindUniforms ()
 must be called before any block of calls SetUniform*()
virtual Lint CreateUniform (const std::string &Name)
 return ID of the uniform. Create uniform if it doesnot exist
virtual void SetUniformInt (Lint Uniform, const int Int)
 assign int value to a variable
virtual void SetUniformIntArray (Lint Uniform, int Count, const int &Int)
virtual void SetUniformFloat (Lint Uniform, const float Float)
 assign float value to a variable
virtual void SetUniformFloatArray (Lint Uniform, int Count, const float &Float)
virtual void SetUniformVec3Array (Lint Uniform, int Count, const LVector3 &Vector)
 assign Count values to a vec3 array or variable. For vec3 variables Count should be set to 1
virtual void SetUniformVec4Array (Lint Uniform, int Count, const LVector4 &Vector)
 assign Count values to a vec4 array or variable. For vec4 variables Count should be set to 1
virtual void SetUniformMat3Array (Lint Uniform, int Count, const LMatrix3 &Matrix)
 assign Count values to a mat3 array or variable. For mat3 variables Count should be set to 1
virtual void SetUniformMat4Array (Lint Uniform, int Count, const LMatrix4 &Matrix)
 assign Count values to a mat4 array or variable. For mat4 variables Count should be set to 1
virtual void SetUniformNameInt (const std::string &Name, const int Int)
 assign int value to a variable
virtual void SetUniformNameIntArray (const std::string &Name, int Count, const int &Int)
virtual void SetUniformNameFloat (const std::string &Name, const float Float)
 assign float values to a variable
virtual void SetUniformNameFloatArray (const std::string &Name, int Count, const float &Float)
virtual void SetUniformNameVec3Array (const std::string &Name, int Count, const LVector3 &Vector)
 assign Count values to a vec3 array or variable. For vec3 variables Count should be set to 1
virtual void SetUniformNameVec4Array (const std::string &Name, int Count, const LVector4 &Vector)
 assign Count values to a vec4 array or variable. For vec4 variables Count should be set to 1
virtual void SetUniformNameMat3Array (const std::string &Name, int Count, const LMatrix3 &Matrix)
 assign Count values to a mat3 array or variable. For mat3 variables Count should be set to 1
virtual void SetUniformNameMat4Array (const std::string &Name, int Count, const LMatrix4 &Matrix)
 assign Count values to a mat4 array or variable. For mat4 variables Count should be set to 1
virtual void SetTransformationUniforms (const sMatrices &Matrices)
 update transformations
virtual void SetMaterialUniforms (const sMaterialDesc &Desc, bool ReceiveShadow)
 update material parameters
virtual void SetGUIUniforms (const LVector4 &GUIPos, float Opacity, float ViewLifeTime)
 update GUI parameters
virtual void SetSceneUniformsPerRigid (const sMaterialDesc &Desc, const LVector4 &PickingColor, const LVector4 &KeyFrame, bool Skinned, bool ReceiveShadow)
 update per-rigid scene parameters
virtual void SetLightUniformsPerShader (clScene *Scene)
 Load light parameters to shader.
virtual void SetSceneUniformsPerShader (bool UseShadowMatrix, const LMatrix4 &ShadowMatrix, float EnableClipPlane, bool UseClipPlane, const LVector4 &ClipPlane, bool ShowNormals)
 update per-shader scene parameters
virtual void BindConsoleVariableType (const std::string &Name, clCVar *CVar, LVariantType VarType)
 Internal variable bind routine.
virtual void SetFragDataLocationName (int Location, const std::string &Name)
 assign symbolic name to an output fragment data location
virtual void SetAttribLocationName (int Location, const std::string &Name)
 assign symbolic name to an input attribute location
virtual int GetActiveAttribStreams () const
 return the number of active vertex attrib streams used in this shader program
virtual void SetInputPrimitiveType (const std::string &Type)
virtual void SetOutputPrimitiveType (const std::string &Type)
virtual void SetOutputVerticesCount (Luint OutputVerticesCount)
virtual bool IsTesselationEnabled () const
 returns true if tesselation control & evaluation shaders are attached
virtual void SetDefinesList (const std::string &DefinesList)
virtual std::string GetDefinesList () const
virtual void Event_SURFACE_DETACHED (LEvent Event, const LEventArgs &Args)
virtual void Event_SURFACE_ATTACHED (LEvent Event, const LEventArgs &Args)

Private Member Functions

void BindDefaultLocations (Luint ProgramID)
Lint FindUniformLocation (const std::string &Name)
Luint AttachShaderID (Luint Target, const std::string &ShaderCode, Luint OldShaderID)
bool CheckStatus (Luint ObjectID, Lenum Target, const std::string &Message) const
bool IsLinked () const
void RebindAllUniforms ()

Private Attributes

std::vector< sUniformFUniforms
std::vector< sUniformFCVarsBindedUniforms
std::vector< sUniformFFragDataLocations
std::vector< sUniformFAttribsLocations
Luint FProgramID
 OpenGL shader program ID.
std::vector< LuintFShaderID
 OpenGL shader IDs.
bool FTesselation
bool FAlreadyLoaded
std::string FInputType
std::string FOutputType
Luint FOutputVertices
std::string FDefinesList
Lint FMatricesBlockIndex
Lint FMatricesBlockSize
Lint FActiveAttribStreams
 how many vertex attribs are actually used in this shader program
clCVarFProgramRebinds
 stats

Constructor & Destructor Documentation

clGLSLShaderProgram::clGLSLShaderProgram ( )
clGLSLShaderProgram::~clGLSLShaderProgram ( ) [virtual]

Member Function Documentation

void clGLSLShaderProgram::AfterConstruction ( ) [virtual]

Reimplemented from iResource.

Luint clGLSLShaderProgram::AttachShaderID ( Luint  Target,
const std::string &  ShaderCode,
Luint  OldShaderID 
) [private]
void clGLSLShaderProgram::Bind ( ) [virtual]

binded to the context as a current shader program, used in AddBuffer()

Implements iShaderProgram.

void clGLSLShaderProgram::BindConsoleVariableType ( const std::string &  Name,
clCVar CVar,
LVariantType  VarType 
) [virtual]

Internal variable bind routine.

Implements iShaderProgram.

void clGLSLShaderProgram::BindDefaultLocations ( Luint  ProgramID) [private]
void clGLSLShaderProgram::BindUniforms ( ) [virtual]

must be called before any block of calls SetUniform*()

Implements iShaderProgram.

bool clGLSLShaderProgram::CacheFrom ( const std::string &  FileName) [virtual]

Reimplemented from iResource.

void clGLSLShaderProgram::CacheTo ( const std::string &  FileName) [virtual]

Reimplemented from iResource.

bool clGLSLShaderProgram::CheckStatus ( Luint  ObjectID,
Lenum  Target,
const std::string &  Message 
) const [private]
Lint clGLSLShaderProgram::CreateUniform ( const std::string &  Name) [virtual]

return ID of the uniform. Create uniform if it doesnot exist

Implements iShaderProgram.

void clGLSLShaderProgram::Event_SURFACE_ATTACHED ( LEvent  Event,
const LEventArgs Args 
) [virtual]
void clGLSLShaderProgram::Event_SURFACE_DETACHED ( LEvent  Event,
const LEventArgs Args 
) [virtual]
Lint clGLSLShaderProgram::FindUniformLocation ( const std::string &  Name) [private]
virtual int clGLSLShaderProgram::GetActiveAttribStreams ( ) const [inline, virtual]

return the number of active vertex attrib streams used in this shader program

Reimplemented from iShaderProgram.

std::string clGLSLShaderProgram::GetCachedFileName ( ) [virtual]

Reimplemented from iResource.

std::string clGLSLShaderProgram::GetCachingDir ( ) const [virtual]

Reimplemented from iShaderProgram.

virtual std::string clGLSLShaderProgram::GetDefinesList ( ) const [inline, virtual]

Implements iShaderProgram.

bool clGLSLShaderProgram::IsLinked ( ) const [private]
bool clGLSLShaderProgram::IsSameResource ( iResource Other) [virtual]

Reimplemented from iResource.

virtual bool clGLSLShaderProgram::IsTesselationEnabled ( ) const [inline, virtual]

returns true if tesselation control & evaluation shaders are attached

Reimplemented from iShaderProgram.

void clGLSLShaderProgram::RebindAllUniforms ( ) [private]
bool clGLSLShaderProgram::RelinkShaderProgram ( ) [virtual]

Force shader program relink.

Reimplemented from iShaderProgram.

void clGLSLShaderProgram::SetAttribLocationName ( int  Location,
const std::string &  Name 
) [virtual]

assign symbolic name to an input attribute location

Implements iShaderProgram.

virtual void clGLSLShaderProgram::SetDefinesList ( const std::string &  DefinesList) [inline, virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetFragDataLocationName ( int  Location,
const std::string &  Name 
) [virtual]

assign symbolic name to an output fragment data location

Implements iShaderProgram.

void clGLSLShaderProgram::SetGUIUniforms ( const LVector4 GUIPos,
float  Opacity,
float  ViewLifeTime 
) [virtual]

update GUI parameters

Implements iShaderProgram.

void clGLSLShaderProgram::SetInputPrimitiveType ( const std::string &  Type) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetLightUniformsPerShader ( clScene Scene) [virtual]

Load light parameters to shader.

Implements iShaderProgram.

void clGLSLShaderProgram::SetMaterialUniforms ( const sMaterialDesc Desc,
bool  ReceiveShadow 
) [virtual]

update material parameters

Implements iShaderProgram.

void clGLSLShaderProgram::SetOutputPrimitiveType ( const std::string &  Type) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetOutputVerticesCount ( Luint  OutputVerticesCount) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetSceneUniformsPerRigid ( const sMaterialDesc Desc,
const LVector4 PickingColor,
const LVector4 KeyFrame,
bool  Skinned,
bool  ReceiveShadow 
) [virtual]

update per-rigid scene parameters

Implements iShaderProgram.

void clGLSLShaderProgram::SetSceneUniformsPerShader ( bool  UseShadowMatrix,
const LMatrix4 ShadowMatrix,
float  EnableClipPlane,
bool  UseClipPlane,
const LVector4 ClipPlane,
bool  ShowNormals 
) [virtual]

update per-shader scene parameters

Implements iShaderProgram.

void clGLSLShaderProgram::SetTransformationUniforms ( const sMatrices Matrices) [virtual]

update transformations

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformFloat ( Lint  Uniform,
const float  Float 
) [virtual]

assign float value to a variable

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformFloatArray ( Lint  Uniform,
int  Count,
const float Float 
) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformInt ( Lint  Uniform,
const int  Int 
) [virtual]

assign int value to a variable

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformIntArray ( Lint  Uniform,
int  Count,
const int Int 
) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformMat3Array ( Lint  Uniform,
int  Count,
const LMatrix3 Matrix 
) [virtual]

assign Count values to a mat3 array or variable. For mat3 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformMat4Array ( Lint  Uniform,
int  Count,
const LMatrix4 Matrix 
) [virtual]

assign Count values to a mat4 array or variable. For mat4 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameFloat ( const std::string &  Name,
const float  Float 
) [virtual]

assign float values to a variable

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameFloatArray ( const std::string &  Name,
int  Count,
const float Float 
) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameInt ( const std::string &  Name,
const int  Int 
) [virtual]

assign int value to a variable

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameIntArray ( const std::string &  Name,
int  Count,
const int Int 
) [virtual]

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameMat3Array ( const std::string &  Name,
int  Count,
const LMatrix3 Matrix 
) [virtual]

assign Count values to a mat3 array or variable. For mat3 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameMat4Array ( const std::string &  Name,
int  Count,
const LMatrix4 Matrix 
) [virtual]

assign Count values to a mat4 array or variable. For mat4 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameVec3Array ( const std::string &  Name,
int  Count,
const LVector3 Vector 
) [virtual]

assign Count values to a vec3 array or variable. For vec3 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformNameVec4Array ( const std::string &  Name,
int  Count,
const LVector4 Vector 
) [virtual]

assign Count values to a vec4 array or variable. For vec4 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformVec3Array ( Lint  Uniform,
int  Count,
const LVector3 Vector 
) [virtual]

assign Count values to a vec3 array or variable. For vec3 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::SetUniformVec4Array ( Lint  Uniform,
int  Count,
const LVector4 Vector 
) [virtual]

assign Count values to a vec4 array or variable. For vec4 variables Count should be set to 1

Implements iShaderProgram.

void clGLSLShaderProgram::UnBind ( ) const [virtual]

unbinded from the context

Implements iShaderProgram.


Member Data Documentation

how many vertex attribs are actually used in this shader program

std::string clGLSLShaderProgram::FDefinesList [private]
std::string clGLSLShaderProgram::FInputType [private]
std::string clGLSLShaderProgram::FOutputType [private]

OpenGL shader program ID.

std::vector<Luint> clGLSLShaderProgram::FShaderID [private]

OpenGL shader IDs.

std::vector<sUniform> clGLSLShaderProgram::FUniforms [private]

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