Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
AnimationSystem Class Reference

System that processes active skeletal animations, interpolating poses and resolving joint trees. More...

#include <AnimationSystem.hpp>

Inheritance diagram for AnimationSystem:
System

Classes

struct  JointPose
 Updates skeletal poses for all animated entities. More...

Public Member Functions

 AnimationSystem (Registry &reg, VulkanRenderer &renderer, EditorModeState &editorMode)
void update (float dt) override
 Updates skeletal poses for all animated entities.
Public Member Functions inherited from System
virtual ~System ()=default
 Virtual destructor.
void addEntity (Entity e)
 Adds an entity to the system tracking list.
void removeEntity (Entity e)
 Removes an entity from system tracking.

Private Member Functions

void updateController (AnimationControllerComponent &controller, AnimatorComponent &animator, float dt)
 Updates high-level state machine progression and checks transitions.
const AnimationClip * findClip (const AnimatorComponent &animator, const std::string &name)
void sampleClip (const AnimationClip &clip, float time, const SkeletonComponent &skeleton, std::vector< JointPose > &outPose)
void blendPoses (const std::vector< JointPose > &poseA, const std::vector< JointPose > &poseB, float weight, std::vector< JointPose > &outPose)
void evaluateStatePose (const AnimationControllerComponent &controller, const AnimationState &state, float stateTime, const AnimatorComponent &animator, const SkeletonComponent &skeleton, std::vector< JointPose > &outPose)
int findJointIndex (const SkeletonComponent &skeleton, const std::string &name)
glm::quat rotationBetweenVectors (glm::vec3 u, glm::vec3 v)
void solve2BoneIK (SkeletonComponent &skeleton, const IKSolverComponent &ik, std::vector< glm::mat4 > &globalTransforms)
void solveFABRIK (SkeletonComponent &skeleton, const IKSolverComponent &ik, std::vector< glm::mat4 > &globalTransforms)
void updateEntityAnimation (Entity entity, SkeletonComponent &skeleton, AnimatorComponent &animator, float dt)
 Updates the animation timing and calculates local/global joint matrices for an entity.
glm::vec3 interpolateTranslation (const std::vector< Keyframe > &keys, float time, const glm::vec3 &defaultValue)
glm::quat interpolateRotation (const std::vector< KeyframeRot > &keys, float time, const glm::quat &defaultValue)
glm::vec3 interpolateScale (const std::vector< Keyframe > &keys, float time, const glm::vec3 &defaultValue)
glm::vec4 interpolateProperty (const std::vector< PropertyKeyframe > &keys, float time, const glm::vec4 &defaultValue)
std::string sampleStringProperty (const std::vector< PropertyKeyframe > &keys, float time)
void sampleAndApplyProperties (Entity entity, AnimatorComponent &animator)
void updateGenericAnimation (Entity entity, AnimatorComponent &animator, float dt)

Private Attributes

Registry & registry
VulkanRenderer & renderer
EditorModeState & editorMode
std::vector< Entity > controllerEntities
std::vector< Entity > animatedEntities
std::vector< Entity > genericAnimatedEntities

Additional Inherited Members

Protected Attributes inherited from System
std::vector< Entity > entities
 List of entities tracked by this system.

Detailed Description

System that processes active skeletal animations, interpolating poses and resolving joint trees.

Constructor & Destructor Documentation

◆ AnimationSystem()

AnimationSystem::AnimationSystem ( Registry & reg,
VulkanRenderer & renderer,
EditorModeState & editorMode )
inline

Member Function Documentation

◆ blendPoses()

void AnimationSystem::blendPoses ( const std::vector< JointPose > & poseA,
const std::vector< JointPose > & poseB,
float weight,
std::vector< JointPose > & outPose )
inlineprivate

◆ evaluateStatePose()

void AnimationSystem::evaluateStatePose ( const AnimationControllerComponent & controller,
const AnimationState & state,
float stateTime,
const AnimatorComponent & animator,
const SkeletonComponent & skeleton,
std::vector< JointPose > & outPose )
inlineprivate

◆ findClip()

const AnimationClip * AnimationSystem::findClip ( const AnimatorComponent & animator,
const std::string & name )
inlineprivate

◆ findJointIndex()

int AnimationSystem::findJointIndex ( const SkeletonComponent & skeleton,
const std::string & name )
inlineprivate

◆ interpolateProperty()

glm::vec4 AnimationSystem::interpolateProperty ( const std::vector< PropertyKeyframe > & keys,
float time,
const glm::vec4 & defaultValue )
inlineprivate

◆ interpolateRotation()

glm::quat AnimationSystem::interpolateRotation ( const std::vector< KeyframeRot > & keys,
float time,
const glm::quat & defaultValue )
inlineprivate

◆ interpolateScale()

glm::vec3 AnimationSystem::interpolateScale ( const std::vector< Keyframe > & keys,
float time,
const glm::vec3 & defaultValue )
inlineprivate

◆ interpolateTranslation()

glm::vec3 AnimationSystem::interpolateTranslation ( const std::vector< Keyframe > & keys,
float time,
const glm::vec3 & defaultValue )
inlineprivate

◆ rotationBetweenVectors()

glm::quat AnimationSystem::rotationBetweenVectors ( glm::vec3 u,
glm::vec3 v )
inlineprivate

◆ sampleAndApplyProperties()

void AnimationSystem::sampleAndApplyProperties ( Entity entity,
AnimatorComponent & animator )
inlineprivate

◆ sampleClip()

void AnimationSystem::sampleClip ( const AnimationClip & clip,
float time,
const SkeletonComponent & skeleton,
std::vector< JointPose > & outPose )
inlineprivate

◆ sampleStringProperty()

std::string AnimationSystem::sampleStringProperty ( const std::vector< PropertyKeyframe > & keys,
float time )
inlineprivate

◆ solve2BoneIK()

void AnimationSystem::solve2BoneIK ( SkeletonComponent & skeleton,
const IKSolverComponent & ik,
std::vector< glm::mat4 > & globalTransforms )
inlineprivate

◆ solveFABRIK()

void AnimationSystem::solveFABRIK ( SkeletonComponent & skeleton,
const IKSolverComponent & ik,
std::vector< glm::mat4 > & globalTransforms )
inlineprivate

◆ update()

void AnimationSystem::update ( float dt)
inlineoverridevirtual

Updates skeletal poses for all animated entities.

Parameters
dtDelta time in seconds.

Implements System.

◆ updateController()

void AnimationSystem::updateController ( AnimationControllerComponent & controller,
AnimatorComponent & animator,
float dt )
inlineprivate

Updates high-level state machine progression and checks transitions.

◆ updateEntityAnimation()

void AnimationSystem::updateEntityAnimation ( Entity entity,
SkeletonComponent & skeleton,
AnimatorComponent & animator,
float dt )
inlineprivate

Updates the animation timing and calculates local/global joint matrices for an entity.

◆ updateGenericAnimation()

void AnimationSystem::updateGenericAnimation ( Entity entity,
AnimatorComponent & animator,
float dt )
inlineprivate

Member Data Documentation

◆ animatedEntities

std::vector<Entity> AnimationSystem::animatedEntities
private

◆ controllerEntities

std::vector<Entity> AnimationSystem::controllerEntities
private

◆ editorMode

EditorModeState& AnimationSystem::editorMode
private

◆ genericAnimatedEntities

std::vector<Entity> AnimationSystem::genericAnimatedEntities
private

◆ registry

Registry& AnimationSystem::registry
private

◆ renderer

VulkanRenderer& AnimationSystem::renderer
private

The documentation for this class was generated from the following file: