20 #ifndef ANTKEEPER_ANIMATION_SKELETON_HPP
21 #define ANTKEEPER_ANIMATION_SKELETON_HPP
27 #include <unordered_map>
42 explicit skeleton(std::size_t bone_count);
150 return m_bone_parents.size();
162 return m_bone_parents[child_index];
194 std::vector<bone_index_type> m_bone_parents;
200 std::unordered_map<hash::fnv1a32_t, bone_index_type> m_bone_map;
203 std::unordered_map<hash::fnv1a32_t, animation_pose> m_pose_map;
std::uint16_t bone_index_type
Bone index type.
Animatable skeleton pose.
void set_relative_transform(bone_index_type index, const bone_transform_type &transform)
Sets the relative transform describing a bone pose.
Skeletal animation skeleton.
void set_bone_transform(bone_index_type index, const bone_transform_type &transform)
Sets the transform of a bone, relative to its parent bone.
bone_index_type get_bone_parent(bone_index_type child_index) const
Returns the index of the parent of a bone.
void remove_poses()
Removes all poses from the skeleton, excluding the rest pose.
std::optional< bone_index_type > get_bone_index(hash::fnv1a32_t name) const
Finds the index of a bone from the bone's name.
bone_index_type add_bones(std::size_t bone_count)
Add one or more bones to the skeleton.
void update_rest_pose()
Updates the rest pose of the skeleton.
void remove_bones()
Removes all bones from the skeleton.
const animation_pose * get_pose(hash::fnv1a32_t name) const
Finds a pose from the poses's name.
void set_bone_parent(bone_index_type child_index, bone_index_type parent_index)
Sets the parent of a bone.
std::size_t get_bone_count() const noexcept
Returns the number of bones in the skeleton.
void set_bone_name(bone_index_type index, hash::fnv1a32_t name)
Sets the name of a bone.
bone_index_type add_bone()
Adds a single bone to the skeleton.
skeleton()
Constructs an empty skeleton.
animation_pose & add_pose(hash::fnv1a32_t name)
Adds a pose to the skeleton.
void remove_pose(hash::fnv1a32_t name)
Removes a pose from the skeleton.
const rest_pose & get_rest_pose() const noexcept
Returns the skeleton's rest pose.
32-bit FNV-1a hash value.