Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::springbone::SpringBoneSystem Class Reference

#include <SpringBoneSystem.hpp>

Public Member Functions

 SpringBoneSystem ()=default
void update (ecs::Registry &registry, ecs::TransformSystem *transforms, f32 dt)
 Advance every enabled chain by dt seconds. Composes world transforms first if the animation moved any.
void release (ecs::Registry &registry, Entity root)
 Give a chain's bones back as the animation had them and forget its state: what stops a preview in the editor, where nothing animates the bones and a chain left as the simulation last turned it would stay that way.
void reset (Entity root)
 Forget a chain's state: it starts again from the animated pose on its next frame (a teleport, a respawn).
u32 simulated () const
 How many chains the last update simulated.
const std::vector< Particle > * chain (Entity root) const
 The simulated world positions of a chain, root first, in the order its bones were found (tips last); null if it has no state.
void snapshot (Entity root, std::vector< f32 > &out) const
 A chain's particles as flat floats for the editor to draw: seven a particle, the simulated position, the position the animation gives, then the index of its parent (-1 for the root). Empty when the chain has no state.

Detailed Description

Definition at line 30 of file SpringBoneSystem.hpp.

Constructor & Destructor Documentation

◆ SpringBoneSystem()

esengine::springbone::SpringBoneSystem::SpringBoneSystem ( )
default

Member Function Documentation

◆ chain()

const std::vector< Particle > * esengine::springbone::SpringBoneSystem::chain ( Entity root) const

The simulated world positions of a chain, root first, in the order its bones were found (tips last); null if it has no state.

Definition at line 89 of file SpringBoneSystem.cpp.

◆ release()

void esengine::springbone::SpringBoneSystem::release ( ecs::Registry & registry,
Entity root )

Give a chain's bones back as the animation had them and forget its state: what stops a preview in the editor, where nothing animates the bones and a chain left as the simulation last turned it would stay that way.

Definition at line 68 of file SpringBoneSystem.cpp.

◆ reset()

void esengine::springbone::SpringBoneSystem::reset ( Entity root)

Forget a chain's state: it starts again from the animated pose on its next frame (a teleport, a respawn).

Definition at line 75 of file SpringBoneSystem.cpp.

◆ simulated()

u32 esengine::springbone::SpringBoneSystem::simulated ( ) const
inline

How many chains the last update simulated.

Definition at line 47 of file SpringBoneSystem.hpp.

◆ snapshot()

void esengine::springbone::SpringBoneSystem::snapshot ( Entity root,
std::vector< f32 > & out ) const

A chain's particles as flat floats for the editor to draw: seven a particle, the simulated position, the position the animation gives, then the index of its parent (-1 for the root). Empty when the chain has no state.

Definition at line 80 of file SpringBoneSystem.cpp.

◆ update()


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