#include <ShaderObject.h>
Public Types | |
enum | StateMatrix { MODEL_VIEW_PROJ, MODEL_VIEW, MODEL_VIEW_INV, MODEL_VIEW_INV_TRANS, TEXTURE } |
Public Member Functions | |
void | setActiveStateMatrix (const std::string &name, StateMatrix type) |
void | setUniform1d (const std::string &name, double value) |
void | setUniform2d (const std::string &name, const Eigen::Vector2d &value) |
void | setUniform3d (const std::string &name, const Eigen::Vector3d &value) |
void | setUniform4d (const std::string &name, const Eigen::Vector4d &value) |
void | setUniformMatrix3d (const std::string &name, const Eigen::Matrix3d &value) |
void | setUniformMatrix4d (const std::string &name, const Eigen::Matrix4d &value) |
void | setUniformTexture (const std::string &name, GLuint value) |
Protected Member Functions | |
void | enable (CGprofile vertexProfile, CGprofile fragmentProfile) const |
void | setFragmentShader (CGprogram &program) |
void | setVertexShader (CGprogram &program) |
ShaderObject (void) | |
~ShaderObject (void) | |
Friends | |
class | ShaderManager |
enumeration of state matrices which can be activated in setActiveStateMatrix.
VolVis::Shader::ShaderObject::ShaderObject | ( | void | ) | [protected] |
Constructor. Sets the programs to 0.
VolVis::Shader::ShaderObject::~ShaderObject | ( | void | ) | [protected] |
Destructor. Destroys the cg programs.
void VolVis::Shader::ShaderObject::enable | ( | CGprofile | vertexProfile, | |
CGprofile | fragmentProfile | |||
) | const [protected] |
Enables the passed profiles and binds the programs defined in this shader. If a program is undefined, the according profile is not activated (fixed function pipeline is active) If a state matrix has been activated the according parameter will be updated. This method usually is called by the ShaderManager
vertexProfile | profile in which the vertex program should run | |
fragmentProfile | profile in which the fragment program should run |
void VolVis::Shader::ShaderObject::setActiveStateMatrix | ( | const std::string & | name, | |
StateMatrix | type | |||
) |
Activates a state matrix (e.g. the modelview-matrix). The matrix is updated when the shader is enabled.
name | name defined in the shader | |
type | type of the state matrix is an entry of the StateMatrix enumeration |
void VolVis::Shader::ShaderObject::setFragmentShader | ( | CGprogram & | program | ) | [protected] |
Sets a new program for the fragment shader. If already a program is defined, it is destroyed. This method is usually called by the ShaderManager.
program | the new program |
void VolVis::Shader::ShaderObject::setUniform1d | ( | const std::string & | name, | |
double | value | |||
) |
Defines a uniform parameter of type double. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setUniform2d | ( | const std::string & | name, | |
const Eigen::Vector2d & | value | |||
) |
Defines a uniform parameter with the type of a two-dimensional vector. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setUniform3d | ( | const std::string & | name, | |
const Eigen::Vector3d & | value | |||
) |
Defines a uniform parameter with the type of a three-dimensional vector. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setUniform4d | ( | const std::string & | name, | |
const Eigen::Vector4d & | value | |||
) |
Defines a uniform parameter with the type of a four-dimensional vector. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setUniformMatrix3d | ( | const std::string & | name, | |
const Eigen::Matrix3d & | value | |||
) |
Defines a uniform parameter with the type of a three-by-three-dimensional matrix. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setUniformMatrix4d | ( | const std::string & | name, | |
const Eigen::Matrix4d & | value | |||
) |
Defines a uniform parameter with the type of a four-by-four-dimensional matrix. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setUniformTexture | ( | const std::string & | name, | |
GLuint | value | |||
) |
Defines a uniform parameter for a texture. If the name is found in one of the programs, the uniform parameter is set, otherwise nothing is done.
name | name defined in the shader | |
value | value which should be set for the shader parameter |
void VolVis::Shader::ShaderObject::setVertexShader | ( | CGprogram & | program | ) | [protected] |
Sets a new program for the vertex shader. If already a program is defined, it is destroyed. This method is usually called by the ShaderManager.
program | the new program |