/usr/include/SurgSim/Graphics/OsgSkeletonRepresentation.h is in libopensurgsim-dev 0.7.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | // This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_GRAPHICS_OSGSKELETONREPRESENTATION_H
#define SURGSIM_GRAPHICS_OSGSKELETONREPRESENTATION_H
#include <boost/thread.hpp>
#include <map>
#include <osg/MatrixTransform>
#include <osg/ref_ptr>
#include <osgUtil/UpdateVisitor>
#include <string>
#include "SurgSim/Graphics/OsgRepresentation.h"
#include "SurgSim/Graphics/SkeletonRepresentation.h"
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif
namespace osg
{
class Node;
class Shader;
};
namespace SurgSim
{
namespace Graphics
{
struct BoneData;
class OsgModel;
/// Skeleton representation is used to move a mesh based on the movements of
/// pre-selected control points (bones).
class OsgSkeletonRepresentation : public OsgRepresentation, public SkeletonRepresentation
{
public:
/// Constructor.
/// \param name The name of the representation.
explicit OsgSkeletonRepresentation(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgSkeletonRepresentation);
void loadModel(const std::string& fileName) override;
void setModel(std::shared_ptr<SurgSim::Framework::Asset> model) override;
std::shared_ptr<Model> getModel() const override;
/// Set the file containing the skinning shader.
/// \param fileName The file containing the skinning shader.
void setSkinningShaderFileName(const std::string& fileName);
/// \return The file containing the skinning shader.
std::string getSkinningShaderFileName() const;
void setBonePose(const std::string& name, const SurgSim::Math::RigidTransform3d& pose) override;
SurgSim::Math::RigidTransform3d getBonePose(const std::string& name) const override;
void setNeutralBonePose(const std::string& name, const SurgSim::Math::RigidTransform3d& pose) override;
SurgSim::Math::RigidTransform3d getNeutralBonePose(const std::string& name) const override;
protected:
void setNeutralBonePoses(const std::map<std::string, SurgSim::Math::RigidTransform3d>& poses) override;
std::map<std::string, SurgSim::Math::RigidTransform3d> getNeutralBonePoses() const override;
void doUpdate(double dt) override;
bool doInitialize() override;
private:
/// Setup the bones with the model and skinning shader
bool setupBones();
/// The logger for this class.
std::shared_ptr<SurgSim::Framework::Logger> m_logger;
/// The model containing the bone and mesh information.
std::shared_ptr<OsgModel> m_model;
/// The named map of the bones in this skeleton.
std::shared_ptr<std::map<std::string, BoneData>> m_bones;
/// Mutex to access m_bones safely.
mutable boost::shared_mutex m_mutex;
/// The skeleton which is read from the mesh file.
osg::ref_ptr<osg::Node> m_skeleton;
/// The file containing the skinning shader.
std::string m_skinningShaderFileName;
/// The hardware skinning shader.
osg::ref_ptr<osg::Shader> m_skinningShader;
/// Tree updater which updates the position of the bones.
osg::ref_ptr<osgUtil::UpdateVisitor> m_updateVisitor;
/// Parameter to keep track of the skeleton's frame count. Set to the UpdateVisitor.
size_t m_frameCount;
/// The root node of the skeleton tree.
osg::ref_ptr<osg::Node> m_root;
/// The first MatrixTransform node
osg::ref_ptr<osg::MatrixTransform> m_base;
};
}; // namespace Graphics
}; // namespace SurgSim
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif // SURGSIM_GRAPHICS_OSGSKELETONREPRESENTATION_H
|