ShaderLoader Class Reference

Cg shader manager and loader. More...

#include <shaderLoader.h>

List of all members.

Public Member Functions

ShaderProgramgetProgram (string name)
 Returns a shader program by name.
void disableShaders ()
 Disables shaders.
void enableFragmentShaders ()
 Enables fragment shaders.
void enableVertexShaders ()
 Enables vertex shaders.
void setActive (ShaderProgram *shaderProgram)
 Sets the program as currently active and ready for rendering.
bool isActive (ShaderProgram *shaderProgram)
 Returns whether the specified program is currently the active shader.
void checkForCgError (const char *situation)
 Checks for a Cg related error.

Static Public Member Functions

static ShaderLoadergetShaderLoader ()
 Return the one and only instance of the ShaderLoader.

Detailed Description

Cg shader manager and loader.

Manages shaders. Has the ability to load them from a XML file along with a description of their parameters. This list of parameters and their types is used to check for parameter validity at runtime. Each shader is named and can be querried by this name, as well as it's parameters.

The class itself is a singleton (should be used as one). You can query the only instance by calling getShaderLoader.


Member Function Documentation

void ShaderLoader::checkForCgError ( const char *  situation  ) 

Checks for a Cg related error.

If no error is found, nothing happens. If an error is found, a message consisting of the situation's description from the first parameter and the actual Cg error is output to the logger.

Parameters:
situation Description of the situation, to be used for identification if an error was to occur.
void ShaderLoader::disableShaders (  ) 

Disables shaders.

void ShaderLoader::enableFragmentShaders (  ) 

Enables fragment shaders.

void ShaderLoader::enableVertexShaders (  ) 

Enables vertex shaders.

ShaderProgram * ShaderLoader::getProgram ( string  name  ) 

Returns a shader program by name.

Parameters:
name name of the shader program that we query
Returns:
pointer to the program or NULL if no program of such name was found.
ShaderLoader * ShaderLoader::getShaderLoader (  )  [static]

Return the one and only instance of the ShaderLoader.

Returns:
pointer to an instance of the ShaderLoader singleton, always non-NULL.
bool ShaderLoader::isActive ( ShaderProgram shaderProgram  )  [inline]

Returns whether the specified program is currently the active shader.

Parameters:
shaderProgram pointer to the shader program against which we want to test.
Returns:
true if it is the currently active program, false otherwise.
void ShaderLoader::setActive ( ShaderProgram shaderProgram  ) 

Sets the program as currently active and ready for rendering.

Parameters:
shaderProgram non-NULL pointer to a ShaderProgram class that encapsulates the shader we're about to use.

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

Generated on Wed Jan 20 17:20:25 2010 for FlowVis by  doxygen 1.6.1