6 #ifndef COGS_SKELETON_H 7 #define COGS_SKELETON_H 9 #include <Utils/GeometryStructures.h> 10 #include <COGS/SkeletonPose.h> 73 std::string GetName()
const;
76 void SetName(
const std::string &new_name);
79 std::vector<Bone *> GetAllBones()
const;
82 std::vector<std::string> GetAllBoneCaptions()
const;
85 std::vector<Bone *> GetBones(
const std::vector<std::string> &bone_captions)
const;
88 Bone *GetBone(
const uint32_t
id)
const;
91 Bone *GetBone(
const std::string &bone_caption)
const;
94 std::vector<Bone *> GetRootBones()
const;
100 unsigned GetBoneCount()
const;
103 Bone *AddBone(
const std::string &name,
const std::string &parent_name,
const glm::vec3 &tail_position);
106 Bone *AddBone(
const std::string &name,
const std::string &parent_name,
const BoneTransform &transform);
109 Bone *AddBoneToRoot(
const std::string &name,
const glm::vec3 &tail_position);
112 Bone *AddBoneToRoot(
const std::string &name,
const BoneTransform &transform);
115 void RollBasis(
const std::string &bone_name,
const float roll_angle);
118 void ApplyBoneLengths(
const std::vector<float> &bone_lengths);
146 SkeletonPose GetCurrentPose(
const std::vector<std::string> &bone_order)
const;
149 void ApplyPose(
const SkeletonPose &pose,
bool ignore_root_transform =
false);
152 void ApplyBindpose();
155 void ApplyCurrentPoseAsBindpose();
159 BaseProperty *GetProperty(
const std::string &prop)
const;
166 assert(HasProperty(prop));
167 return ((
Property<T> *)(properties_.at(prop)))->GetData();
175 if (HasProperty(prop))
177 delete properties_[prop];
184 bool HasProperty(
const std::string &prop)
const;
195 std::unordered_map<std::string, BaseProperty *> properties_;
197 std::map <std::string, Bone *> bone_for_name_;
198 std::vector<Bone *> bones_;
199 std::vector<Bone *> root_bones_;
200 unsigned bone_count_ = 0;
202 Bone *CreateNewBone(
const std::string &caption);
203 Bone *CreateBoneClone(
const cogs::Bone *bone);
204 void MakeCloneOf(
const Skeleton &skeleton);
206 void OnTransformChange();
Namespace of "Computer Graphic Structures" library, which implement many core classes and structures...
Definition: AabbHierarchy.h:8
Abstract helper class used for storage of skeleton properties.
Definition: Skeleton.h:27
const T GetData() const
Returns stored data.
Definition: Skeleton.h:52
3D Graph structure, usually representing topology of a 3D model.
Definition: Skeleton.h:22
void SetProperty(const std::string &prop, const T &value)
Sets specific skeleton property. If property do not exist yet, creates new property record...
Definition: Skeleton.h:173
COGS_API std::vector< cogs::Skeleton > SplitIntoSingleBoneSkeletons(const cogs::Skeleton &skeleton)
Splits skeleton into one bone skeletons.
Structure used for storage of specific configuration of bone transformations in a skeleton...
Definition: SkeletonPose.h:8
cogs::Transform transform
Transformation of the entire skeleton.
Definition: Skeleton.h:187
T GetProperty(const std::string &prop) const
Returns specific skeleton property.
Definition: Skeleton.h:164
COGS_API geom::Aabb3 GetAabb3(const Skeleton &skeleton)
Returns bounding box wrapping all skeleton bones.
Template class used for storage of skeleton properties.
Definition: Skeleton.h:43
COGS_API std::vector< geom::LineSegment3 > ToLineSegments(const cogs::Skeleton &skeleton)
Converts bones of skeleton to the array of line segments ordered by bone ids.