![]() |
OSG-based implementation of a graphics shader. More...
#include <SurgSim/Graphics/OsgShader.h>
Public Member Functions | |
OsgShader () | |
Constructor. More... | |
virtual void | addToStateSet (osg::StateSet *stateSet) |
Adds this shader to the OSG state set. More... | |
virtual void | removeFromStateSet (osg::StateSet *stateSet) |
Removes this uniform from the OSG state set. More... | |
virtual bool | hasVertexShader () const |
Returns true if the vertex shader has been set, otherwise false. More... | |
virtual void | clearVertexShader () |
Removes the vertex shader, returning that portion of the shader program to fixed-function. More... | |
virtual bool | loadVertexShaderSource (const std::string &filePath) |
Loads the vertex shader source code from a file. More... | |
virtual void | setVertexShaderSource (const std::string &source) |
Set the vertex shader source code. More... | |
virtual bool | getVertexShaderSource (std::string *source) const |
Gets the vertex shader source code. More... | |
virtual bool | hasGeometryShader () const |
Returns true if the geometry shader has been set, otherwise false. More... | |
virtual void | clearGeometryShader () |
Removes the geometry shader, returning that portion of the shader program to fixed-function. More... | |
virtual bool | loadGeometryShaderSource (const std::string &filePath) |
Loads the geometry shader source code from a file. More... | |
virtual void | setGeometryShaderSource (const std::string &source) |
Set the geometry shader source code. More... | |
virtual bool | getGeometryShaderSource (std::string *source) const |
Gets the geometry shader source code. More... | |
virtual bool | hasFragmentShader () const |
Returns true if the fragment shader has been set, otherwise false. More... | |
virtual void | clearFragmentShader () |
Removes the fragment shader, returning that portion of the shader program to fixed-function. More... | |
virtual bool | loadFragmentShaderSource (const std::string &filePath) |
Loads the fragment shader source code from a file. More... | |
virtual void | setFragmentShaderSource (const std::string &source) |
Set the fragment shader source code. More... | |
virtual bool | getFragmentShaderSource (std::string *source) const |
Gets the fragment shader source code. More... | |
osg::ref_ptr< osg::Program > | getOsgProgram () const |
Returns the OSG program attribute. More... | |
virtual void | setGlobalScope (bool val) override |
Enables the shader to override other material shaders. More... | |
virtual bool | isGlobalScope () const override |
Query if this object is global scope and overrides other lower level shaders. More... | |
![]() | |
virtual | ~Shader ()=0 |
Destructor. More... | |
virtual void | clear () |
Clears the entire shader, returning to fixed-function pipeline. More... | |
Private Attributes | |
osg::ref_ptr< osg::Program > | m_program |
OSG program attribute. More... | |
osg::ref_ptr< osg::Shader > | m_vertexShader |
OSG vertex shader. More... | |
osg::ref_ptr< osg::Shader > | m_geometryShader |
OSG geometry shader. More... | |
osg::ref_ptr< osg::Shader > | m_fragmentShader |
OSG fragment shader. More... | |
bool | m_globalScope |
Is the shader supposed to be used globally. More... | |
OSG-based implementation of a graphics shader.
Wraps an osg::Program which manages the geometry, vertex, and fragment shaders. The osg::Program is added to the osg::StateSet of an osg::Node to use the shaders for the rendering of that node's geometry.
OsgShader::OsgShader | ( | ) |
Constructor.
|
virtual |
Adds this shader to the OSG state set.
stateSet | OSG state set |
|
virtual |
Removes the fragment shader, returning that portion of the shader program to fixed-function.
Implements SurgSim::Graphics::Shader.
|
virtual |
Removes the geometry shader, returning that portion of the shader program to fixed-function.
Implements SurgSim::Graphics::Shader.
|
virtual |
Removes the vertex shader, returning that portion of the shader program to fixed-function.
Implements SurgSim::Graphics::Shader.
|
virtual |
Gets the fragment shader source code.
Implements SurgSim::Graphics::Shader.
|
virtual |
Gets the geometry shader source code.
Implements SurgSim::Graphics::Shader.
osg::ref_ptr< osg::Program > SurgSim::Graphics::OsgShader::getOsgProgram | ( | ) | const |
Returns the OSG program attribute.
|
virtual |
|
virtual |
Returns true if the fragment shader has been set, otherwise false.
Implements SurgSim::Graphics::Shader.
|
virtual |
Returns true if the geometry shader has been set, otherwise false.
Implements SurgSim::Graphics::Shader.
|
virtual |
Returns true if the vertex shader has been set, otherwise false.
Implements SurgSim::Graphics::Shader.
|
overridevirtual |
Query if this object is global scope and overrides other lower level shaders.
Implements SurgSim::Graphics::Shader.
|
virtual |
Loads the fragment shader source code from a file.
filePath | Path to file containing shader source code |
Implements SurgSim::Graphics::Shader.
|
virtual |
Loads the geometry shader source code from a file.
filePath | Path to file containing shader source code |
Implements SurgSim::Graphics::Shader.
|
virtual |
Loads the vertex shader source code from a file.
filePath | Path to file containing shader source code |
Implements SurgSim::Graphics::Shader.
|
virtual |
Removes this uniform from the OSG state set.
stateSet | OSG state set |
|
virtual |
Set the fragment shader source code.
source | Shader source code |
Implements SurgSim::Graphics::Shader.
|
virtual |
Set the geometry shader source code.
source | Shader source code |
Implements SurgSim::Graphics::Shader.
|
overridevirtual |
Enables the shader to override other material shaders.
val | if true the shader will replace other shaders in a lower hierarchy. |
Implements SurgSim::Graphics::Shader.
|
virtual |
Set the vertex shader source code.
source | Shader source code |
Implements SurgSim::Graphics::Shader.
|
private |
OSG fragment shader.
|
private |
OSG geometry shader.
|
private |
Is the shader supposed to be used globally.
|
private |
OSG program attribute.
|
private |
OSG vertex shader.