RavEngine
Loading...
Searching...
No Matches
RavEngine::AnimBlendTree Struct Reference

#include <AnimatorComponent.hpp>

Inheritance diagram for RavEngine::AnimBlendTree:
[legend]
Collaboration diagram for RavEngine::AnimBlendTree:
[legend]

Classes

struct  Node
 

Public Member Functions

void InsertNode (anim_id_t id, const Node &node)
 
void DeleteNode (anim_id_t id)
 
Node & GetNode (const anim_id_t id)
 
bool IsEmpty () const
 
void Clear ()
 
bool Sample (float t, float start, float speed, bool looping, ozz::vector< ozz::math::SoaTransform > &, ozz::animation::SamplingJob::Context &cache, const ozz::animation::Skeleton *skeleton) const override
 
constexpr void SetBlendPos (const clamped_vec2 &newPos)
 

Static Public Attributes

static constexpr uint16_t kmax_nodes = 64
 

Detailed Description

Blend trees enable blending by arranging graphable nodes in a 2D plane with a movable control point. Influence is defined as the distance from the node to the control point.

Member Function Documentation

◆ Clear()

void RavEngine::AnimBlendTree::Clear ( )
inline

Remove all nodes from the tree

◆ DeleteNode()

void RavEngine::AnimBlendTree::DeleteNode ( anim_id_t  id)
inline

Remove a node given an ID

Parameters
idthe id to remove

◆ GetNode()

Node & RavEngine::AnimBlendTree::GetNode ( const anim_id_t  id)
inline

Get a node reference to make modifications to it

Parameters
idthe ID to get a node for
Returns
node reference
Exceptions
ifno node exists at id

◆ InsertNode()

void RavEngine::AnimBlendTree::InsertNode ( anim_id_t  id,
const Node &  node 
)
inline

Insert a node into the tree at the id. If a node already exists at that ID, it is replaced.

Parameters
idthe identifier for the node. Recommended to create an enum to use here.
nodethe node to insert into the tree.

◆ IsEmpty()

bool RavEngine::AnimBlendTree::IsEmpty ( ) const
inline
Returns
true if there are no nodes in the blend tree

◆ Sample()

bool AnimBlendTree::Sample ( float  t,
float  start,
float  speed,
bool  looping,
ozz::vector< ozz::math::SoaTransform > &  output,
ozz::animation::SamplingJob::Context &  cache,
const ozz::animation::Skeleton *  skeleton 
) const
override

Sample the animation curves in this tree

Parameters
tthe time to sample
outputthe vector to write the output transforms to
cachea sampling cache, modified when used

◆ SetBlendPos()

constexpr void RavEngine::AnimBlendTree::SetBlendPos ( const clamped_vec2 &  newPos)
inlineconstexpr

Move the control point

Parameters
newPosthe position of the control point

The documentation for this struct was generated from the following files: