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> 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;
87 bool setProgram(std::shared_ptr<Program> program)
override;
89 std::shared_ptr<Program>
getProgram()
const override;
116 const std::string& vertexShaderName,
117 const std::string& fragmentShaderName);
123 #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
osg::ref_ptr< osg::StateSet > m_stateSet
OSG state set which provides material properties in the scenegraph.
Definition: OsgMaterial.h:102
Definition: CompoundShapeToGraphics.cpp:29
bool removeUniform(std::shared_ptr< UniformBase > uniform) override
Removes a uniform from this material.
Definition: OsgMaterial.cpp:84
std::shared_ptr< OsgProgram > m_program
Shader used by this material.
Definition: OsgMaterial.h:108
std::vector< std::shared_ptr< OsgUniformBase > > m_uniforms
Uniforms used by this material.
Definition: OsgMaterial.h:105
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
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgMaterial)
std::shared_ptr< UniformBase > getUniform(size_t index) const override
Gets a uniform in this material.
Definition: OsgMaterial.cpp:116
std::shared_ptr< OsgMaterial > buildMaterial(const std::string &vertexShaderName, const std::string &fragmentShaderName)
Utility function to build the material.
Definition: OsgMaterial.cpp:215
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:210
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