|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
#include <SpringBoneSystem.hpp>
Public Member Functions | |
| SpringBoneSystem ()=default | |
| void | update (ecs::Registry ®istry, 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 ®istry, 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. | |
Definition at line 30 of file SpringBoneSystem.hpp.
|
default |
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.
| 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.
| 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.
|
inline |
How many chains the last update simulated.
Definition at line 47 of file SpringBoneSystem.hpp.
| 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.
| void esengine::springbone::SpringBoneSystem::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.
Definition at line 94 of file SpringBoneSystem.cpp.
References esengine::ecs::Registry::activeView(), esengine::springbone::StepParams::drag, esengine::ecs::TransformSystem::ensureComposed(), esengine::ecs::Transform::ensureDecomposed(), esengine::ecs::Registry::get(), esengine::springbone::StepParams::gravity, esengine::ecs::invalidateTransformComposition(), esengine::springbone::kMaxStep, esengine::ecs::Registry::markChanged(), esengine::ecs::Registry::onDestroy(), esengine::springbone::Particle::parent, esengine::springbone::StepParams::radius, esengine::springbone::reset(), esengine::springbone::Particle::restLength, esengine::springbone::shortestArc(), esengine::springbone::step(), esengine::springbone::StepParams::stiffness, esengine::springbone::Particle::target, esengine::springbone::StepParams::time, esengine::ecs::Registry::tryGet(), esengine::ecs::Registry::valid(), esengine::springbone::StepParams::wind, esengine::springbone::StepParams::windFrequency, and esengine::springbone::StepParams::windGust.