Skeletal animation skeleton.
More...
#include <skeleton.hpp>
Skeletal animation skeleton.
Definition at line 34 of file skeleton.hpp.
◆ skeleton() [1/2]
skeleton::skeleton |
( |
std::size_t |
bone_count | ) |
|
|
explicit |
Constructs a skeleton.
- Parameters
-
bone_count | Number of bones in the skeleton. |
Definition at line 23 of file skeleton.cpp.
◆ skeleton() [2/2]
Constructs an empty skeleton.
Definition at line 28 of file skeleton.cpp.
◆ add_bone() [1/2]
Adds a single bone to the skeleton.
- Returns
- Index of the added bone.
Definition at line 66 of file skeleton.hpp.
◆ add_bone() [2/2]
Adds a single named bone to the skeleton.
- Parameters
-
- Returns
- Index of the added bone.
- Exceptions
-
std::invalid_argument | Duplicate bone name. |
Definition at line 47 of file skeleton.cpp.
◆ add_bones()
Add one or more bones to the skeleton.
- Parameters
-
bone_count | Number of bones to add. |
- Returns
- Index of the first added bone.
Definition at line 37 of file skeleton.cpp.
◆ add_pose()
Adds a pose to the skeleton.
- Parameters
-
- Returns
- Reference to the added pose.
- Exceptions
-
std::invalid_argument | Duplicate pose name. |
Definition at line 63 of file skeleton.cpp.
◆ get_bone_count()
std::size_t skeleton::get_bone_count |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of bones in the skeleton.
Definition at line 148 of file skeleton.hpp.
◆ get_bone_index()
Finds the index of a bone from the bone's name.
- Parameters
-
- Returns
- Index of the bone, or
std::nullopt
if no bone with the given name was found.
Definition at line 113 of file skeleton.cpp.
◆ get_bone_parent()
Returns the index of the parent of a bone.
- Parameters
-
child_index | Index of the child bone. |
- Returns
- Index of the child bone's parent, or
index
if the child bone has no parent.
Definition at line 160 of file skeleton.hpp.
◆ get_pose() [1/2]
Finds a pose from the poses's name.
- Parameters
-
- Returns
- Non-owning pointer to the pose, or
nullptr
if no pose with the given name was found.
Definition at line 133 of file skeleton.cpp.
◆ get_pose() [2/2]
Finds a pose from the poses's name.
- Parameters
-
- Returns
- Non-owning pointer to the pose, or
nullptr
if no pose with the given name was found.
Definition at line 123 of file skeleton.cpp.
◆ get_rest_pose()
const rest_pose& skeleton::get_rest_pose |
( |
| ) |
const |
|
inlinenoexcept |
Returns the skeleton's rest pose.
Definition at line 187 of file skeleton.hpp.
◆ remove_bones()
void skeleton::remove_bones |
( |
| ) |
|
Removes all bones from the skeleton.
Definition at line 56 of file skeleton.cpp.
◆ remove_pose()
Removes a pose from the skeleton.
- Parameters
-
name | Name of the pose to remove. |
- Exceptions
-
std::invalid_argument | Pose not found. |
Definition at line 75 of file skeleton.cpp.
◆ remove_poses()
void skeleton::remove_poses |
( |
| ) |
|
Removes all poses from the skeleton, excluding the rest pose.
Definition at line 83 of file skeleton.cpp.
◆ set_bone_name()
Sets the name of a bone.
- Parameters
-
index | Index of a bone. |
name | Name of the bone. |
- Exceptions
-
std::invalid_argument | Duplicate bone name. |
Definition at line 98 of file skeleton.cpp.
◆ set_bone_parent()
Sets the parent of a bone.
- Parameters
-
child_index | Index of the child bone. |
parent_index | Index of the parent bone. |
- Warning
- The index of a child bone must be greater than the index of its parent.
- Exceptions
-
std::invalid_argument | Child bone index precedes parent bone index. |
Definition at line 88 of file skeleton.cpp.
◆ set_bone_transform()
Sets the transform of a bone, relative to its parent bone.
- Parameters
-
index | Index of a bone. |
transform | Bone transform, relative to the parent bone. |
Definition at line 130 of file skeleton.hpp.
◆ update_rest_pose()
void skeleton::update_rest_pose |
( |
| ) |
|
Updates the rest pose of the skeleton.
Definition at line 32 of file skeleton.cpp.
The documentation for this class was generated from the following files: