16 #ifndef SURGSIM_GRAPHICS_OSGMATERIAL_H 17 #define SURGSIM_GRAPHICS_OSGMATERIAL_H 19 #include <boost/any.hpp> 20 #include <osg/Material> 21 #include <osg/StateSet> 24 #include "SurgSim/Graphics/Material.h" 57 void addUniform(std::shared_ptr<UniformBase> uniform)
override;
59 void addUniform(
const std::string& type,
const std::string& name)
override;
65 void addUniform(
const std::string& type,
const std::string& name,
const boost::any& value);
71 bool removeUniform(std::shared_ptr<UniformBase> uniform)
override;
77 std::shared_ptr<UniformBase>
getUniform(
size_t index)
const override;
79 std::shared_ptr<UniformBase>
getUniform(
const std::string& name)
const override;
81 bool hasUniform(
const std::string& name)
const override;
83 void loadProgram(
const std::string& nameTuple)
override;
89 bool setProgram(std::shared_ptr<Program> program)
override;
91 std::shared_ptr<Program>
getProgram()
const override;
105 osg::ref_ptr<osg::StateSet> m_stateSet;
108 std::vector<std::shared_ptr<OsgUniformBase>> m_uniforms;
111 std::shared_ptr<OsgProgram> m_program;
118 std::shared_ptr<OsgMaterial> buildMaterial(
119 const std::string& vertexShaderName,
120 const std::string& fragmentShaderName);
126 #endif // SURGSIM_GRAPHICS_OSGMATERIAL_H size_t getNumUniforms() const override
Returns the number of uniforms in this material.
Definition: OsgMaterial.cpp:111
std::shared_ptr< Program > getProgram() const override
Gets the program used by this material.
Definition: OsgMaterial.cpp:182
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
bool removeUniform(std::shared_ptr< UniformBase > uniform) override
Removes a uniform from this material.
Definition: OsgMaterial.cpp:84
Base class that defines the interface for graphics materials.
Definition: Material.h:39
bool setProgram(std::shared_ptr< Program > program) override
Sets the shader used by this material.
Definition: OsgMaterial.cpp:163
bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: OsgMaterial.cpp:205
void addUniform(std::shared_ptr< UniformBase > uniform) override
Adds a uniform to this material.
Definition: OsgMaterial.cpp:46
std::shared_ptr< UniformBase > getUniform(size_t index) const override
Gets a uniform in this material.
Definition: OsgMaterial.cpp:116
bool hasUniform(const std::string &name) const override
Checks if this material has a uniform with the given name.
Definition: OsgMaterial.cpp:158
osg::ref_ptr< osg::StateSet > getOsgStateSet() const
Definition: OsgMaterial.cpp:217
void clearProgram() override
Removes the shader from the material, falling back to fixed-function pipeline.
Definition: OsgMaterial.cpp:187
OsgMaterial(const std::string &name)
Constructor.
Definition: OsgMaterial.cpp:39
OSG-based implementation of a graphics material.
Definition: OsgMaterial.h:45
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: OsgMaterial.cpp:196