Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_OSGSKELETONREPRESENTATION_H
17 #define SURGSIM_GRAPHICS_OSGSKELETONREPRESENTATION_H
19 #include <boost/thread.hpp>
21 #include <osg/MatrixTransform>
22 #include <osg/ref_ptr>
23 #include <osgUtil/UpdateVisitor>
31 #pragma warning(disable:4250)
61 void setModel(std::shared_ptr<SurgSim::Framework::Asset> model)
override;
63 std::shared_ptr<Model>
getModel()
const override;
81 void setNeutralBonePoses(
const std::map<std::string, SurgSim::Math::RigidTransform3d>& poses)
override;
83 std::map<std::string, SurgSim::Math::RigidTransform3d>
getNeutralBonePoses()
const override;
94 std::shared_ptr<SurgSim::Framework::Logger>
m_logger;
100 std::shared_ptr<std::map<std::string, BoneData>>
m_bones;
124 osg::ref_ptr<osg::MatrixTransform>
m_base;
130 #if defined(_MSC_VER)
134 #endif // SURGSIM_GRAPHICS_OSGSKELETONREPRESENTATION_H
size_t m_frameCount
Parameter to keep track of the skeleton's frame count. Set to the UpdateVisitor.
Definition: OsgSkeletonRepresentation.h:118
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: OsgSkeletonRepresentation.cpp:343
bool setupBones()
Setup the bones with the model and skinning shader.
Definition: OsgSkeletonRepresentation.cpp:398
SurgSim::Math::RigidTransform3d getBonePose(const std::string &name) const override
Get the pose for a given bone.
Definition: OsgSkeletonRepresentation.cpp:248
void setSkinningShaderFileName(const std::string &fileName)
Set the file containing the skinning shader.
Definition: OsgSkeletonRepresentation.cpp:218
osg::ref_ptr< osg::Shader > m_skinningShader
The hardware skinning shader.
Definition: OsgSkeletonRepresentation.h:112
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Definition: OculusView.h:26
std::string m_skinningShaderFileName
The file containing the skinning shader.
Definition: OsgSkeletonRepresentation.h:109
Skeleton representation is used to move a mesh based on the movements of pre-selected control points ...
Definition: SkeletonRepresentation.h:37
std::string getSkinningShaderFileName() const
Definition: OsgSkeletonRepresentation.cpp:223
osg::ref_ptr< osg::Node > m_root
The root node of the skeleton tree.
Definition: OsgSkeletonRepresentation.h:121
void doUpdate(double dt) override
Definition: OsgSkeletonRepresentation.cpp:325
Definition: CompoundShapeToGraphics.cpp:30
osg::ref_ptr< osg::Node > m_skeleton
The skeleton which is read from the mesh file.
Definition: OsgSkeletonRepresentation.h:106
void setBonePose(const std::string &name, const SurgSim::Math::RigidTransform3d &pose) override
Set the pose for a given bone.
Definition: OsgSkeletonRepresentation.cpp:228
std::shared_ptr< SurgSim::Framework::Logger > m_logger
The logger for this class.
Definition: OsgSkeletonRepresentation.h:94
std::map< std::string, SurgSim::Math::RigidTransform3d > getNeutralBonePoses() const override
Get all the neutral poses.
Definition: OsgSkeletonRepresentation.cpp:313
std::shared_ptr< OsgModel > m_model
The model containing the bone and mesh information.
Definition: OsgSkeletonRepresentation.h:97
osg::ref_ptr< osg::MatrixTransform > m_base
The first MatrixTransform node.
Definition: OsgSkeletonRepresentation.h:124
void setNeutralBonePose(const std::string &name, const SurgSim::Math::RigidTransform3d &pose) override
Set the neutral pose for a given bone.
Definition: OsgSkeletonRepresentation.cpp:266
std::shared_ptr< Model > getModel() const override
Definition: OsgSkeletonRepresentation.cpp:213
OsgSkeletonRepresentation(const std::string &name)
Constructor.
Definition: OsgSkeletonRepresentation.cpp:184
Skeleton representation is used to move a mesh based on the movements of pre-selected control points ...
Definition: OsgSkeletonRepresentation.h:51
osg::ref_ptr< osgUtil::UpdateVisitor > m_updateVisitor
Tree updater which updates the position of the bones.
Definition: OsgSkeletonRepresentation.h:115
void setModel(std::shared_ptr< SurgSim::Framework::Asset > model) override
Set the current model to the model passed.
Definition: OsgSkeletonRepresentation.cpp:204
std::shared_ptr< std::map< std::string, BoneData > > m_bones
The named map of the bones in this skeleton.
Definition: OsgSkeletonRepresentation.h:100
void setNeutralBonePoses(const std::map< std::string, SurgSim::Math::RigidTransform3d > &poses) override
Set neutral poses for a set of bones.
Definition: OsgSkeletonRepresentation.cpp:305
void loadModel(const std::string &fileName) override
Convenience function to trigger the load of the model with the given filename, if successful,...
Definition: OsgSkeletonRepresentation.cpp:195
boost::shared_mutex m_mutex
Mutex to access m_bones safely.
Definition: OsgSkeletonRepresentation.h:103
SurgSim::Math::RigidTransform3d getNeutralBonePose(const std::string &name) const override
Get the neutral pose for a given bone.
Definition: OsgSkeletonRepresentation.cpp:287
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgSkeletonRepresentation)
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:56