Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_OSGLIGHT_H
17 #define SURGSIM_GRAPHICS_OSGLIGHT_H
21 #include <unordered_map>
26 #include <osg/ref_ptr>
30 #pragma warning(disable:4250)
50 SURGSIM_STATIC_REGISTRATION(OsgLight);
67 bool setGroup(std::shared_ptr<SurgSim::Graphics::Group> group)
override;
73 std::shared_ptr<SurgSim::Graphics::Group>
getGroup()
override;
100 void apply(osg::ref_ptr<osg::StateSet> stateSet);
103 void remove(osg::ref_ptr<osg::StateSet> stateSet);
120 std::unordered_map<int, osg::ref_ptr<osg::Uniform>>
m_uniforms;
138 #if defined(_MSC_VER)
SurgSim::Math::Vector4d m_diffuseColor
The actual diffuse color that was set.
Definition: OsgLight.h:122
virtual ~OsgLight()
Definition: OsgLight.cpp:93
@ CONSTANT_ATTENUATION
Definition: OsgLight.h:111
SurgSim::Math::Vector4d getDiffuseColor() override
Gets diffuse color.
Definition: OsgLight.cpp:145
SurgSim::Math::Vector4d m_specularColor
The actual specular color that was set.
Definition: OsgLight.h:123
SurgSim::Math::Vector4d getSpecularColor() override
Gets specular color.
Definition: OsgLight.cpp:159
double m_linearAttenuation
The actual linear attenuation value that was set.
Definition: OsgLight.h:126
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgLight)
friend class OsgLightTests
If we use the uniforms map, to check for all the uniforms that should be set in the stateset,...
Definition: OsgLight.h:59
Definition: OculusView.h:26
std::shared_ptr< OsgGroup > m_group
The group for this light.
Definition: OsgLight.h:117
void doUpdate(double dt) override
Definition: OsgLight.cpp:200
std::unordered_map< int, osg::ref_ptr< osg::Uniform > > m_uniforms
Map for managing all uniforms that this object owns.
Definition: OsgLight.h:120
Abstract interface for a light, a light needs to be assigned to a group to be active,...
Definition: Light.h:49
bool setGroup(std::shared_ptr< SurgSim::Graphics::Group > group) override
Sets the group for this light, setting nullptr here will remove the light from its current group.
Definition: OsgLight.cpp:100
Definition: CompoundShapeToGraphics.cpp:30
@ DIFFUSE_COLOR
Definition: OsgLight.h:109
double getQuadraticAttenuation() override
Gets quadratic attenuation.
Definition: OsgLight.cpp:195
void apply(osg::ref_ptr< osg::StateSet > stateSet)
Applies all the lights variables to the given StateSet.
Definition: OsgLight.cpp:208
@ SPECULAR_COLOR
Definition: OsgLight.h:110
@ LINEAR_ATTENUATION
Definition: OsgLight.h:112
double getConstantAttenuation() override
Gets constant attenuation.
Definition: OsgLight.cpp:171
OsgLight(const std::string &name)
Constructor.
Definition: OsgLight.cpp:50
OpenScenegraph implementation for the Light interface.
Definition: OsgLight.h:54
std::string m_groupReference
Name of the group that this light should shine on...
Definition: OsgLight.h:135
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:61
double getLinearAttenuation() override
Gets linear attenuation.
Definition: OsgLight.cpp:183
osg::ref_ptr< osg::Light > m_light
Definition: OsgLight.h:131
void remove(osg::ref_ptr< osg::StateSet > stateSet)
Removes all the lights variable from the given StateSet.
Definition: OsgLight.cpp:216
std::shared_ptr< SurgSim::Graphics::Group > getGroup() override
Gets the group that this light has been assigned to.
Definition: OsgLight.cpp:131
double m_quadraticAttenuation
The actual quadratic attenuation value that was set.
Definition: OsgLight.h:127
void setSpecularColor(const SurgSim::Math::Vector4d &color) override
Sets specular color of this light.
Definition: OsgLight.cpp:150
void setDiffuseColor(const SurgSim::Math::Vector4d &color) override
Sets diffuse color of this light.
Definition: OsgLight.cpp:136
osg::ref_ptr< osg::LightSource > m_lightSource
Definition: OsgLight.h:132
std::string getLightGroupReference() override
Gets the name of the group this light should operate on.
Definition: OsgLight.cpp:230
void setLightGroupReference(const std::string &name) override
Sets the name of the group that this light should work on.
Definition: OsgLight.cpp:224
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
@ POSITION
Definition: OsgLight.h:108
void setConstantAttenuation(double val) override
Sets constant attenuation.
Definition: OsgLight.cpp:164
@ QUADRATIC_ATTENUATION
Definition: OsgLight.h:113
void setQuadraticAttenuation(double val) override
Sets quadratic attenuation.
Definition: OsgLight.cpp:188
UniformType
Internal for managing uniforms.
Definition: OsgLight.h:107
double m_constantAttenuation
The actual constant attenuation value that was set.
Definition: OsgLight.h:125
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:56
void setLinearAttenuation(double val) override
Sets linear attenuation.
Definition: OsgLight.cpp:176