Cg shader manager and loader. More...
#include <shaderLoader.h>
Public Member Functions | |
ShaderProgram * | getProgram (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 ShaderLoader * | getShaderLoader () |
Return the one and only instance of the ShaderLoader. |
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.
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.
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.
name | name of the shader program that we query |
ShaderLoader * ShaderLoader::getShaderLoader | ( | ) | [static] |
Return the one and only instance of the ShaderLoader.
bool ShaderLoader::isActive | ( | ShaderProgram * | shaderProgram | ) | [inline] |
Returns whether the specified program is currently the active shader.
shaderProgram | pointer to the shader program against which we want to test. |
void ShaderLoader::setActive | ( | ShaderProgram * | shaderProgram | ) |
Sets the program as currently active and ready for rendering.
shaderProgram | non-NULL pointer to a ShaderProgram class that encapsulates the shader we're about to use. |