Radium Engine  1.5.0
Skeleton.hpp
1 #pragma once
2 
3 #include <Core/Animation/HandleArray.hpp>
4 #include <Core/Containers/AdjacencyList.hpp>
5 
6 namespace Ra {
7 namespace Core {
8 namespace Animation {
9 
24 class RA_CORE_API Skeleton : public HandleArray
25 {
26  public:
29  enum Manipulation {
30  FORWARD = 0,
31  PSEUDO_IK
32  };
33 
34  Skeleton();
35  explicit Skeleton( const uint n );
36  Skeleton( const Skeleton& skeleton ) = default;
37 
38  ~Skeleton() override = default;
39 
40  inline uint size() const override { return m_graph.size(); }
41  void clear() override;
42  const Pose& getPose( const SpaceType MODE ) const override;
43  void setPose( const Pose& pose, const SpaceType MODE ) override;
44  const Transform& getTransform( const uint i, const SpaceType MODE ) const override;
45 
50  void setTransform( const uint i, const Transform& T, const SpaceType MODE ) override;
51 
58  uint addRoot( const Transform& T = Transform::Identity(), const Label label = "" );
59 
68  uint addBone( const uint parent,
69  const Transform& T = Transform::Identity(),
70  const SpaceType MODE = SpaceType::LOCAL,
71  const Label label = "" );
72 
81  void getBonePoints( uint i, Vector3& startOut, Vector3& endOut ) const;
82 
84  Vector3 projectOnBone( uint boneIdx, const Vector3& pos ) const;
85 
87  friend std::ostream& operator<<( std::ostream& os, const Skeleton& skeleton );
88 
89  protected:
95  void setLocalTransform( uint i, const Transform& T );
96 
102  void setModelTransform( uint i, const Transform& T );
103 
104  public:
107 
109  Manipulation m_manipulation { FORWARD };
110 
111  protected:
113  ModelPose m_modelSpace;
114 };
115 
116 } // namespace Animation
117 } // Namespace Core
118 } // Namespace Ra
ModelPose m_modelSpace
Skeleton pose in MODEL space.
Definition: Skeleton.hpp:113
uint size() const override
Definition: Skeleton.hpp:40
AdjacencyList m_graph
The Joint hierarchy.
Definition: Skeleton.hpp:106
Definition: Cage.cpp:3