Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Assets::Animation Class Reference

Animation clip loaded from glTF animation data. More...

#include <AnimationAsset.h>

Inheritance diagram for Engine::Assets::Animation:
Collaboration diagram for Engine::Assets::Animation:

Public Member Functions

 Animation ()
 Creates a loaded animation clip with no channels.
float getDuration () const
 Gets the clip duration in seconds.
const std::string & getName () const
 Gets the imported animation name.
const std::vector< Engine::Animation::AnimationChannel > & getChannels () const
 Gets all animation channels in this clip.
void sample (uint32_t channelIndex, float time, glm::vec3 &outTranslation, glm::quat &outRotation, glm::vec3 &outScale) const
 Sample a specific channel at the given time.
Public Member Functions inherited from Asset::AssetBase
 AssetBase (bool initializeDefaultEntity=false)
 Creates a base asset and optionally allocates its default ECS entity.
virtual ~AssetBase ()
 Releases base asset resources.
CpuLoadingState getLoadingState ()
 Gets the loading state of this asset.
void requestLoad ()
 If this asset is in the UNLOADED state it will get added to the assets to load.
virtual void unload ()
 Base function for unloading the ecs data.
entt::entity getEntity () const
 Getter for data.

Public Attributes

std::string name_
 Imported animation name.
float duration_ = 0.0f
 Clip duration in seconds.
std::vector< Engine::Animation::AnimationChannel > channels_
 Channels sampled by this clip.

Additional Inherited Members

Protected Member Functions inherited from Asset::AssetBase
virtual void updateLoadingState ()
 Updates loadingState from derived asset data.
Protected Attributes inherited from Asset::AssetBase
CpuLoadingState loadingState = UNLOADED
 Current CPU loading state.
entt::registry & mainRegistry
 Registry that owns this asset's ECS data.
entt::entity data
 Entity containing the asset's component data.

Detailed Description

Animation clip loaded from glTF animation data.

Contains keyframe tracks for joint transforms. Supports linear, step, and cubic spline interpolation. One AnimationAsset can be shared by multiple entity instances.

Definition at line 60 of file AnimationAsset.h.

Constructor & Destructor Documentation

◆ Animation()

Engine::Assets::Animation::Animation ( )

Creates a loaded animation clip with no channels.

Member Function Documentation

◆ getChannels()

const std::vector< Engine::Animation::AnimationChannel > & Engine::Assets::Animation::getChannels ( ) const
inlinenodiscard

Gets all animation channels in this clip.

Definition at line 87 of file AnimationAsset.h.

References channels_.

◆ getDuration()

float Engine::Assets::Animation::getDuration ( ) const
inlinenodiscard

Gets the clip duration in seconds.

Definition at line 71 of file AnimationAsset.h.

References duration_.

◆ getName()

const std::string & Engine::Assets::Animation::getName ( ) const
inlinenodiscard

Gets the imported animation name.

Definition at line 79 of file AnimationAsset.h.

References name_.

◆ sample()

void Engine::Assets::Animation::sample ( uint32_t channelIndex,
float time,
glm::vec3 & outTranslation,
glm::quat & outRotation,
glm::vec3 & outScale ) const

Sample a specific channel at the given time.

Performs binary search on keyframes and interpolates based on the channel's interpolation type.

Parameters
channelIndexIndex into the channels vector
timePlayback time in seconds
outTranslationOutput translation (only valid for Translation channels)
outRotationOutput rotation (only valid for Rotation channels)
outScaleOutput scale (only valid for Scale channels)

Member Data Documentation

◆ channels_

std::vector<Engine::Animation::AnimationChannel> Engine::Assets::Animation::channels_

Channels sampled by this clip.

Definition at line 116 of file AnimationAsset.h.

Referenced by getChannels().

◆ duration_

float Engine::Assets::Animation::duration_ = 0.0f

Clip duration in seconds.

Definition at line 114 of file AnimationAsset.h.

Referenced by getDuration().

◆ name_

std::string Engine::Assets::Animation::name_

Imported animation name.

Definition at line 113 of file AnimationAsset.h.

Referenced by getName().


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Animation/AnimationAsset.h