16 #ifndef SURGSIM_GRAPHICS_OSGPROGRAM_H 17 #define SURGSIM_GRAPHICS_OSGPROGRAM_H 19 #include "SurgSim/Graphics/Program.h" 21 #include <osg/Program> 22 #include <osg/StateSet> 32 class ApplicationData;
38 SURGSIM_STATIC_REGISTRATION(OsgProgram);
54 bool hasVertexShader()
const override;
56 void clearVertexShader()
override;
58 bool loadVertexShader(
const std::string& filePath)
override;
60 void setVertexShaderSource(
const std::string& source)
override;
62 bool getVertexShaderSource(std::string* source)
const override;
64 bool hasGeometryShader()
const override;
66 void clearGeometryShader()
override;
68 bool loadGeometryShader(
const std::string& filePath)
override;
70 void setGeometryShaderSource(
const std::string& source)
override;
72 bool getGeometryShaderSource(std::string* source)
const override;
74 bool hasFragmentShader()
const override;
76 void clearFragmentShader()
override;
78 bool loadFragmentShader(
const std::string& filePath)
override;
80 void setFragmentShaderSource(
const std::string& source)
override;
82 bool getFragmentShaderSource(std::string* source)
const override;
84 void setGlobalScope(
bool val)
override;
86 bool isGlobalScope()
const override;
89 osg::ref_ptr<osg::Program> getOsgProgram()
const;
93 void addToStateSet(osg::StateSet* stateSet);
97 void removeFromStateSet(osg::StateSet* stateSet);
101 osg::ref_ptr<osg::Program> m_program;
106 SHADER_TYPE_VERTEX = 0,
107 SHADER_TYPE_FRAGMENT,
108 SHADER_TYPE_GEOMETRY,
113 std::array<osg::ref_ptr<osg::Shader>, SHADER_TYPE_COUNT> m_osgShaders;
118 bool hasShader(
int shaderType)
const;
122 void clearShader(
int shaderType);
128 bool loadShaderSource(
const std::string& filePath,
int shaderType);
133 virtual void setShaderSource(
const std::string& source,
int shaderType);
137 virtual bool getShaderSource(
int shaderType, std::string* source)
const;
142 osg::ref_ptr<osg::Shader> getOrCreateOsgShader(
int shaderType);
149 bool doLoad(
const std::string& filePath)
override;
158 const std::string& name);
166 const std::string& vertexShaderName,
const std::string& fragmentShaderName);
172 #endif // SURGSIM_GRAPHICS_OSGPROGRAM_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Enable searching for files in a given list of paths, give access to the current directory and wrap bo...
Definition: ApplicationData.h:39
OSG-based implementation of a graphics shader.
Definition: OsgProgram.h:45
Base class that defines the interface for graphics programs.
Definition: Program.h:40