#include <shaderprogram.h>
Public Member Functions | |
| ShaderProgram (const std::string &name) | |
| Construct an empty shader. | |
| const std::string & | GetName () const |
| Gets the name currently assigned to this shader. | |
| void | AddVertexShader (const std::string &fileName) |
| This method adds a shader source meant for vertex processing from the specified file name. | |
| const std::vector< std::string > & | GetVertexShaders () const |
| Gets the vertex shaders file names. | |
| const std::string & | GetVertexCacheKey () |
| Gets the vertex cache key. | |
| const std::string & | GetFragmentCacheKey () |
| Gets the fragment cache key. | |
| void | AddFragmentShader (const std::string &fileName) |
| This method adds a shader source meant for fragment processing from the specified file name. | |
| const std::vector< std::string > & | GetFragmentShaders () const |
| Gets the fragment shaders file names. | |
| void | AddParameter (ShaderParameter &newParam) |
| Binds a shader parameter to this shader. | |
| void | RemoveParameter (ShaderParameter ¶m) |
| Removes an existing parameter from the shader. | |
| void | RemoveParameter (const std::string &name) |
| Removes an existing parameter from this shader. | |
| void | RemoveAllParameters () |
| Clears this shaders list of parameters. | |
| const ShaderParameter * | FindParameter (const std::string &name) const |
| Looks up a shader parameter with the given name. | |
| ShaderParameter * | FindParameter (const std::string &name) |
| Looks up a shader parameter with the given name. | |
| unsigned int | GetNumParameters () const |
| Gets the number of parameters currently attached to this shader. | |
| void | GetParameterList (std::vector< dtCore::RefPtr< ShaderParameter > > &toFill) const |
| Fills the specified vector with all the shader parameters currently attached to this shader. | |
| virtual void | Update () |
| Updates any parameter state which may have changed on this shader since the last update. | |
| const osg::Program * | GetShaderProgram () const |
| Gets a pointer to the actual shader program constructed by the shader source code. | |
| osg::Program * | GetShaderProgram () |
| Gets a pointer to the actual shader program constructed by the shader source code. | |
| void | Reset () |
| Removes all shader source and compiler programs from this shader object. | |
| void | SetDirty (bool flag) |
| Marks this shader as dirty and informs its parent shader group that one of the shaders it contains has been marked as dirty. | |
| bool | IsDirty () const |
| Gets whether ot not this shader is dirty. | |
| dtCore::ShaderProgram * | Clone () const |
| Makes a deep copy of the shader and all its parameters. | |
Protected Member Functions | |
| virtual | ~ShaderProgram () |
| Destroys this shader object. | |
| ShaderProgram & | operator= (const ShaderProgram &rhs) |
| Hidden copy constructor and assignment operator. | |
| ShaderProgram (const ShaderProgram &rhs) | |
Friends | |
| class | ShaderManager |
| class | ShaderGroup |
It contains a vertex shader, fragment shader, and any sort of library shader support code that may exist.
If you are using this class, you should also be using the ShaderManager. If so, be sure you are modifying an instance of a Shader as opposed to a template.
Each shader has a list of parameters associated with it. These may be used by the shader and or the objects using the shader in any way they see fit.
| dtCore::ShaderProgram::ShaderProgram | ( | const std::string & | name | ) |
Construct an empty shader.
| name | Name to assign the new shader. Shader names must be unique. |
| dtCore::ShaderProgram::~ShaderProgram | ( | ) | [protected, virtual] |
Destroys this shader object.
| dtCore::ShaderProgram::ShaderProgram | ( | const ShaderProgram & | rhs | ) | [protected] |
| const std::string& dtCore::ShaderProgram::GetName | ( | ) | const [inline] |
Gets the name currently assigned to this shader.
| void dtCore::ShaderProgram::AddVertexShader | ( | const std::string & | fileName | ) |
This method adds a shader source meant for vertex processing from the specified file name.
| fileName | The path of the shader file source. This must be either the full path or a path relative to the Delta3d path list. |
| const std::vector<std::string>& dtCore::ShaderProgram::GetVertexShaders | ( | ) | const [inline] |
Gets the vertex shaders file names.
| const std::string & dtCore::ShaderProgram::GetVertexCacheKey | ( | ) |
Gets the vertex cache key.
| const std::string & dtCore::ShaderProgram::GetFragmentCacheKey | ( | ) |
Gets the fragment cache key.
| void dtCore::ShaderProgram::AddFragmentShader | ( | const std::string & | fileName | ) |
This method adds a shader source meant for fragment processing from the specified file name.
| fileName | The path of the shader file source. This must be either the full path or a path relative to the Delta3d path list. |
| const std::vector<std::string>& dtCore::ShaderProgram::GetFragmentShaders | ( | ) | const [inline] |
Gets the fragment shaders file names.
| void dtCore::ShaderProgram::AddParameter | ( | ShaderParameter & | newParam | ) |
Binds a shader parameter to this shader.
| newParam | The new shader parameter to bind or attach to the shader. |
| void dtCore::ShaderProgram::RemoveParameter | ( | ShaderParameter & | param | ) |
Removes an existing parameter from the shader.
| param | The parameter to remove. This results in a no-op if the parameter to remove is not owned by this shader. |
| void dtCore::ShaderProgram::RemoveParameter | ( | const std::string & | name | ) |
Removes an existing parameter from this shader.
| name | The name of the shader parameter to remove. If this parameter is not currently owned by this shader, this method is a no-op. |
| void dtCore::ShaderProgram::RemoveAllParameters | ( | ) |
Clears this shaders list of parameters.
| const ShaderParameter * dtCore::ShaderProgram::FindParameter | ( | const std::string & | name | ) | const |
Looks up a shader parameter with the given name.
(Const version).
| ShaderParameter * dtCore::ShaderProgram::FindParameter | ( | const std::string & | name | ) |
Looks up a shader parameter with the given name.
(Non-const version).
| unsigned int dtCore::ShaderProgram::GetNumParameters | ( | ) | const [inline] |
Gets the number of parameters currently attached to this shader.
| void dtCore::ShaderProgram::GetParameterList | ( | std::vector< dtCore::RefPtr< ShaderParameter > > & | toFill | ) | const |
Fills the specified vector with all the shader parameters currently attached to this shader.
| toFill | The vector to fill. Note, this is cleared first. |
| void dtCore::ShaderProgram::Update | ( | ) | [virtual] |
Updates any parameter state which may have changed on this shader since the last update.
| const osg::Program* dtCore::ShaderProgram::GetShaderProgram | ( | ) | const [inline] |
Gets a pointer to the actual shader program constructed by the shader source code.
| osg::Program* dtCore::ShaderProgram::GetShaderProgram | ( | ) | [inline] |
Gets a pointer to the actual shader program constructed by the shader source code.
| void dtCore::ShaderProgram::Reset | ( | ) |
Removes all shader source and compiler programs from this shader object.
| void dtCore::ShaderProgram::SetDirty | ( | bool | flag | ) |
Marks this shader as dirty and informs its parent shader group that one of the shaders it contains has been marked as dirty.
| flag | True to set dirty, false to clear the dirty bit. |
| bool dtCore::ShaderProgram::IsDirty | ( | ) | const [inline] |
Gets whether ot not this shader is dirty.
| dtCore::ShaderProgram * dtCore::ShaderProgram::Clone | ( | ) | const |
Makes a deep copy of the shader and all its parameters.
Used when a user assigns a shader to a node using ShaderManager::AssignShaderFromTempalte.
| ShaderProgram & dtCore::ShaderProgram::operator= | ( | const ShaderProgram & | rhs | ) | [protected] |
Hidden copy constructor and assignment operator.
friend class ShaderManager [friend] |
friend class ShaderGroup [friend] |