10 #include <AtomsCore/Globals.h>
11 #include <AtomsCore/AtomsMath.h>
12 #include <AtomsCore/Joint.h>
13 #include <AtomsCore/Serialiser.h>
14 #include <AtomsCore/Metadata/Metadata.h>
15 #include <AtomsCore/Metadata/MapMetadata.h>
17 #include <unordered_map>
26 std::vector<short> activeJoints;
34 FootStruct(
unsigned short footIK,
unsigned short footRoot,
unsigned short footTip) :
35 footIK(footIK), footTip(footTip), footRoot(footRoot), pelvis(0), numJoints(3), poleVector(0.0, 0.0, 0.0), hasPoleVector(
false){};
37 unsigned short footIK, footTip, footRoot, pelvis, numJoints;
38 std::vector<unsigned short> midJoints;
39 std::vector<unsigned short> legJoints;
48 std::vector<unsigned int> chain;
97 inline unsigned short numJoints()
const;
110 inline Joint& operator[](
unsigned short index);
117 inline const Joint& operator[](
unsigned short index)
const;
153 inline void setRoot(
unsigned short id);
159 inline unsigned short numFeet()
const;
162 inline void clearFeet();
171 inline void addFoot(
unsigned short footIK,
unsigned short footRoot,
unsigned short footTip);
178 inline JointPtr footIK(
unsigned short id);
186 inline JointCPtr footIK(
unsigned short id)
const;
200 inline JointPtr footRoot(
unsigned short id);
208 inline JointCPtr footRoot(
unsigned short id)
const;
222 inline JointPtr footTip(
unsigned short id);
230 inline JointCPtr footTip(
unsigned short id)
const;
239 inline bool footHasPoleVector(
unsigned short id)
const;
253 inline unsigned short footPelvis(
unsigned short id)
const;
261 inline const std::vector<unsigned short>& midJoints(
unsigned short id)
const;
269 inline const std::vector<unsigned short>& legJoints(
unsigned short id)
const;
275 inline unsigned short numPelvises()
const;
278 inline void clearPelvises();
284 inline void addPelvis(
unsigned short pelvisJoint);
290 inline JointPtr pelvis(
unsigned short id);
296 inline JointCPtr pelvis(
unsigned short id)
const;
309 inline unsigned int numPelvisChains(
unsigned int id)
const;
331 inline const std::vector<unsigned short>& detachedJoints()
const;
350 inline int jointId(
const std::string& name)
const;
380 inline MapMetadata& jointMetadata(
unsigned short index);
394 inline void setJointMetadata(
unsigned short index,
const MapMetadata& data);
402 inline void addJointMetadata(
unsigned short index,
const std::string& key,
Metadata *data);
410 inline void addJointMetadata(
unsigned short index,
const std::string& key,
const AtomsPtr<Metadata> data);
419 inline void clearJointsMetadata();
425 inline std::vector<SkeletonLod>& lods();
428 inline const std::vector<SkeletonLod>& lods()
const;
445 std::unordered_map<std::string, int> m_jointNameIdMap;
452 std::vector<unsigned short> m_pelvises;
455 std::vector<std::vector<PelvisChain>> m_pelvisChains;
458 std::vector<unsigned short> m_detachedJoints;
461 std::vector<SkeletonLod> m_lods;
464 unsigned short m_root;
467 unsigned short m_numJoints;
473 ATOMSCORE_EXPORT std::ostream& operator<<(std::ostream& os,
const AtomsCore::Skeleton& skeleton);
484 #include "Skeleton.impl.h"
Archive class.
Definition: Serialiser.h:29
Joint class.
Definition: Joint.h:30
Skeleton class.
Definition: Skeleton.h:68
std::map< unsigned short, MapMetadata > JointMetadataMap
Joint metadata map.
Definition: Skeleton.h:72
Skeleton(const Skeleton &rhs)
Copy constructor.
void buildDetachedJointsList()
Build detached joints list.
void setNumJoints(unsigned int numJoints)
Sets the number of joints.
bool jointHasMetadata(unsigned short index)
Check if a joint has some metadata.
size_t memSize() const
Get the memory size.
bool isPelvis(unsigned short id) const
Check if a joint is a pelvis.
bool jointHasMetadata(unsigned short index) const
Check if a joint has some metadata.
bool isFootTip(unsigned short id) const
Check if a joint is a foot tip.
void buildIkData()
Build Ik data.
Skeleton(unsigned short numberOfJoints=1)
Constructor.
void buildJointNameMap()
Build Joint name -> id map.
PelvisChain * pelvisChain(unsigned int id, unsigned int chain)
Get a palvis chain.
void clearJointMetadata(unsigned short index)
Clears joint metadata.
void hash(MurmurHash3 &hash) const
Hash.
const MapMetadata & jointMetadata(unsigned short index) const
Gets joint metadata.
void sanitizeJointNames()
Sanitize joint names.
std::vector< unsigned short > jointMetadataIds() const
Gets the ids of the joints having some metadatas.
std::vector< FootStruct > FeetVector
Vector of pair foot-foot root.
Definition: Skeleton.h:75
bool isFootIK(unsigned short id) const
Check if a joint is a foot ik.
const Joint & joint(unsigned short index) const
Gets the joint.
const PelvisChain * pelvisChain(unsigned int id, unsigned int chain) const
Get a palvis chain.
Skeleton & operator=(const Skeleton &rhs)
Assign operator.
Joint & joint(unsigned short index)
Gets the joint.
bool isFootRoot(unsigned short id) const
Check if a joint is a foot root.
AtomsCore namespace.
Definition: Agent.h:344
const Skeleton * SkeletonCPtr
Skeleton const pointer.
Definition: Skeleton.h:55
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
Skeleton * SkeletonPtr
Skeleton pointer.
Definition: Skeleton.h:51
Definition: Skeleton.h:45
Definition: Skeleton.h:25