Atoms Crowd  7.0.0
Pose.impl.h
1 // ===========================================================================
2 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
3 //
4 // Use of this software is subject to the terms of the Toolchefs license
5 // agreement provided at the time of installation or download, or which
6 // otherwise accompanies this software in either electronic or hard copy form.
7 // ===========================================================================
8 
9 namespace AtomsCore
10 {
11 
12  unsigned short Pose::numJoints() const
13  {
14  return static_cast<unsigned short>(m_jointPose.size());
15  }
16 
17  JointPose& Pose::jointPose(unsigned short index)
18  {
19  assert(m_jointPose.size() > index);
20  return m_jointPose[index];
21  }
22 
23  const JointPose& Pose::jointPose(unsigned short index) const
24  {
25  assert(m_jointPose.size() > index);
26  return m_jointPose[index];
27  }
28 
29  void Pose::setJointPose(unsigned short index, const JointPose& jointPose)
30  {
31  m_jointPose[index] = jointPose;
32  }
33 
34  MapMetadata& Pose::jointMetadata(unsigned short index)
35  {
36  return m_jointMetadata[index];
37  }
38 
40  {
41  return m_jointMetadata;
42  }
43 
45  {
46  return m_jointMetadata;
47  }
48 
49  void Pose::setJointMetadata(unsigned short index, const MapMetadata& data)
50  {
51  m_jointMetadata[index] = data;
52  }
53 
54  void Pose::addJointMetadata(unsigned short index, const std::string& key, AtomsPtr<Metadata> data)
55  {
56  m_jointMetadata[index].addEntry(key, data);
57  }
58 
59  void Pose::addJointMetadata(unsigned short index, const std::string& key, Metadata *data)
60  {
61  m_jointMetadata[index].addEntry(key, data);
62  }
63 
65  {
66  m_jointMetadata.clear();
67  }
68 
70  {
71  m_jointPose.clear();
72  }
73 
74  void Pose::setDirection(const AtomsCore::Vector3& direction)
75  {
76  m_direction.setValue(direction);
77  }
78 
80  {
81  return m_direction;
82  }
83 
85  {
86  return m_poseMetadata;
87  }
88 
90  {
91  return m_poseMetadata;
92  }
93 
94  void Pose::addPoseMetadata(const std::string& key, Metadata *data)
95  {
96  m_poseMetadata.addEntry(key, data);
97  }
98 
100  {
101  m_poseMetadata.clear();
102  }
103 
104  void Pose::setInParentSpace(bool flag)
105  {
106  m_inParentSpace = flag;
107  }
108 
109  bool Pose::inParentSpace() const
110  {
111  return m_inParentSpace;
112  }
113 }
Joint pose.
Definition: JointPose.h:20
MapMetadata class.
Definition: MapMetadata.h:24
void addEntry(const Key &key, AtomsPtr< Metadata > &data, bool cloneData=true)
Add an entry.
void clear()
Clear map.
Base Metadata class.
Definition: Metadata.h:24
unsigned short numJoints() const
Gets the number of joints.
Definition: Pose.impl.h:12
JointPose & jointPose(unsigned short index)
Gets the joint pose.
Definition: Pose.impl.h:17
MapMetadata & jointMetadata(unsigned short index)
Gets the joint metadata.
Definition: Pose.impl.h:34
const AtomsCore::Vector3 & getDirection() const
Gets the pose direction.
Definition: Pose.impl.h:79
MapMetadata & poseMetadata()
Gets the pose metadata map.
Definition: Pose.impl.h:84
void setJointMetadata(unsigned short index, const MapMetadata &data)
Adds joint metadata.
Definition: Pose.impl.h:49
void setJointPose(unsigned short index, const JointPose &jointPose)
Sets the joint pose.
Definition: Pose.impl.h:29
void setInParentSpace(bool flag)
Sets use parent space flag.
Definition: Pose.impl.h:104
void clearAllPose()
Clears all pose.
Definition: Pose.impl.h:69
void clearJointsMetadata()
Clears all joint metadata.
Definition: Pose.impl.h:64
void addPoseMetadata(const std::string &key, Metadata *data)
Adds the pose metadata.
Definition: Pose.impl.h:94
bool inParentSpace() const
Gets the parent space flag.
Definition: Pose.impl.h:109
std::map< unsigned short, MapMetadata > JointMetadataMap
Joint metadata map.
Definition: Pose.h:36
void setDirection(const AtomsCore::Vector3 &direction)
Sets the pose direction.
Definition: Pose.impl.h:74
void clearPoseMetadata()
Clears the pose metadata.
Definition: Pose.impl.h:99
void addJointMetadata(unsigned short index, const std::string &key, Metadata *data)
Adds joint metadata.
Definition: Pose.impl.h:59
JointMetadataMap & jointsMetadata()
Gets the joints metadata map.
Definition: Pose.impl.h:39
AtomsCore namespace.
Definition: Agent.h:344
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57