16 #ifndef SURGSIM_GRAPHICS_OSGPROGRAM_H 17 #define SURGSIM_GRAPHICS_OSGPROGRAM_H 21 #include <osg/Program> 22 #include <osg/StateSet> 32 class ApplicationData;
50 bool hasVertexShader()
const override;
52 void clearVertexShader()
override;
54 bool loadVertexShader(
const std::string& filePath)
override;
56 void setVertexShaderSource(
const std::string& source)
override;
58 bool getVertexShaderSource(std::string* source)
const override;
60 bool hasGeometryShader()
const override;
62 void clearGeometryShader()
override;
64 bool loadGeometryShader(
const std::string& filePath)
override;
66 void setGeometryShaderSource(
const std::string& source)
override;
68 bool getGeometryShaderSource(std::string* source)
const override;
70 bool hasFragmentShader()
const override;
72 void clearFragmentShader()
override;
74 bool loadFragmentShader(
const std::string& filePath)
override;
76 void setFragmentShaderSource(
const std::string& source)
override;
78 bool getFragmentShaderSource(std::string* source)
const override;
80 void setGlobalScope(
bool val)
override;
82 bool isGlobalScope()
const override;
85 osg::ref_ptr<osg::Program> getOsgProgram()
const;
89 void addToStateSet(osg::StateSet* stateSet);
93 void removeFromStateSet(osg::StateSet* stateSet);
102 SHADER_TYPE_VERTEX = 0,
114 bool hasShader(
int shaderType)
const;
118 void clearShader(
int shaderType);
124 bool loadShaderSource(
const std::string& filePath,
int shaderType);
129 virtual void setShaderSource(
const std::string& source,
int shaderType);
133 virtual bool getShaderSource(
int shaderType, std::string* source)
const;
138 osg::ref_ptr<osg::Shader> getOrCreateOsgShader(
int shaderType);
150 const std::string& name);
158 const std::string& vertexShaderName,
const std::string& fragmentShaderName);
164 #endif // SURGSIM_GRAPHICS_OSGPROGRAM_H Definition: CompoundShapeToGraphics.cpp:29
Enable searching for files in a given list of paths, give access to the current directory and wrap bo...
Definition: ApplicationData.h:39
Definition: OsgProgram.h:103
ShaderType
Definition: OsgProgram.h:100
OSG-based implementation of a graphics shader.
Definition: OsgProgram.h:43
osg::ref_ptr< osg::Program > m_program
OSG program attribute.
Definition: OsgProgram.h:97
Definition: OsgProgram.h:104
Base class that defines the interface for graphics programs.
Definition: Program.h:39
std::array< osg::ref_ptr< osg::Shader >, SHADER_TYPE_COUNT > m_osgShaders
Storage of the osg objects.
Definition: OsgProgram.h:109
bool m_globalScope
Is the shader supposed to be used globally.
Definition: OsgProgram.h:141
std::shared_ptr< OsgProgram > loadProgram(const SurgSim::Framework::ApplicationData &data, const std::string &name)
Utility function, load a program from a set of shader files.
Definition: OsgProgram.cpp:217