Provides data structures for representing various animation types and their essential components.
More...
Provides data structures for representing various animation types and their essential components.
This file defines structures for various animation types found in 3D models, including skeletal animations, visibility animations, and texture coordinate animations. These structures facilitate the conversion of animation data between various common exchange formats (such as FBX and glTF) and in-game formats.
- See also
- nnl::SAnimation
-
nnl::SVisibilityAnimation
-
nnl::SUVAnimation
◆ nnl::SKeyFrame
template<typename T>
struct nnl::SKeyFrame< T >
Represents a single keyframe in an animation.
This template structure holds the time at which the keyframe occurs in the animation timeline along with a new value set at that time.
- Template Parameters
-
| T | The type of value associated with the keyframe. |
- See also
- nnl::SBoneChannel
-
nnl::SVisibilityChannel
-
nnl::SUVChannel
Public Attributes |
| u16 | time = 0 |
| | The timestamp in ticks (1 tick ~ 1 frame).
|
| T | value {} |
| | The new value at the specified time.
|
◆ time
The timestamp in ticks (1 tick ~ 1 frame).
◆ value
The new value at the specified time.
◆ nnl::SBoneChannel
Represents the animation tracks for a single bone.
This structure defines how a bone transforms over time during animation.
- Note
- Linear interpolation of keyframes and a constant rate of 30 ticks per second are assumed. Keyframes must be in ascending order and should not contain duplicate timestamps. Additionally, the time values of keyframes must not exceed the duration of the animation they belong to.
- See also
- nnl::SAnimation
◆ rotation_keys
| std::vector<SKeyFrame<glm::quat> > nnl::SBoneChannel::rotation_keys |
Rotation transformations.
◆ scale_keys
| std::vector<SKeyFrame<glm::vec3> > nnl::SBoneChannel::scale_keys |
◆ translation_keys
| std::vector<SKeyFrame<glm::vec3> > nnl::SBoneChannel::translation_keys |
Translation transformations.
◆ nnl::SAnimation
Represents a skeletal animation.
This struct consists of channels that specify the transformations over time for each bone of a skeleton.
- See also
- nnl::animation::Animation
-
nnl::SSkeleton
-
nnl::SModel
-
nnl::SAsset3D
◆ Bake()
| void nnl::SAnimation::Bake |
( |
| ) |
|
Bakes the animation.
This method generates keyframes for every frame of the animation, creating a complete set of keyframes.
◆ Unbake()
| void nnl::SAnimation::Unbake |
( |
float | tolerance = 1.0e-4f | ) |
|
Removes redundant keyframes.
This function removes keyframes that are identical or may be calculated via interpolation.
- Parameters
-
| tolerance | The maximum allowed deviation from the original key value |
◆ bone_channels
Animation channels for bones of the skeleton. The size of this vector must match the total number of bones in the skeleton.
◆ duration
| u16 nnl::SAnimation::duration = 0 |
Duration of the animation in ticks. It must be >= (last keyframe time + 1).
◆ extras
| SValue nnl::SAnimation::extras |
Any additional data for custom use.
◆ name
| std::string nnl::SAnimation::name |
An optional name of the animation.
◆ nnl::SVisibilityAnimation
| struct nnl::SVisibilityAnimation |
Represents a visibility animation of mesh groups.
This structure consists of channels that control the visibility of mesh groups over time. Up to 16 groups are supported.
- Note
- Constant interpolation of keyframes and a constant rate of 30 ticks per second are assumed. Keyframes must be in ascending order and should not contain duplicate timestamps. Unlike game visibility animations, which may use 2 channels (left and right) for each mesh group, the channels in this struct strictly correspond to 1 group, and the values in them are absolute - there's no need for additional bitwise operations.
- See also
- nnl::visanimation::Animation
-
nnl::SMesh
-
nnl::SAsset3D
◆ name
| std::string nnl::SVisibilityAnimation::name |
An optional name for the animation.
◆ visibility_channels
Channels for 16 mesh groups.
◆ nnl::SUVChannel
A single animation track for UV coordinates.
- See also
- nnl::SUVAnimation
◆ interpolation
The method used to interpolate between keyframes.
◆ keys
| std::vector<SKeyFrame<glm::vec2> > nnl::SUVChannel::keys |
◆ nnl::SUVAnimation
Represents a texture coordinate animation.
- Note
- Constant or Linear interpolation of keyframes may be used. Keyframes must be in ascending order and should not contain duplicate timestamps.
Unlike the UVAnimation config defined in the model namespace, this struct can represent any offset transformations over time. Only a subset of these can be converted into the UVAnimation structure.
- See also
- nnl::model::UVAnimation
-
nnl::SModel
◆ extras
| SValue nnl::SUVAnimation::extras |
Any additional data for custom use.
◆ name
| std::string nnl::SUVAnimation::name |
An optional name for the animation.
◆ translation_channels
| std::map<std::size_t, SUVChannel> nnl::SUVAnimation::translation_channels |
A map where the key is the id of the target material and the value is an animation channel that controls UV offsets of the material's texture.
◆ SVisibilityChannel
◆ SInterpolationMode
Enumeration of interpolation modes for animations.
This enum defines the modes of interpolation for keyframes in animations.
- Note
- Currently, these modes are only applicable to UV animations. For other animation types, the interpolation method is pre-defined and fixed.
- See also
- nnl::SUVAnimation