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

#include <TransformSystem.hpp>

Inheritance diagram for esengine::ecs::TransformSystem:

Public Member Functions

 TransformSystem ()
void init (Registry &registry) override
 Called once when the system is added to a group.
void update (World &world) override
 Called every frame to execute system logic.
void ensureComposed (Registry &registry)
 Compose if anything changed since the last one; O(1) if not.
u32 composedEpoch () const
u32 compositionSerial () const
 How many compositions have RUN.
void setChangeTracking (bool on)
 Collect which entities' composed OUTPUT changed, from now on.
bool changeTracking () const
const std::vector< Entity > & pendingChanges () const
 What every composition since the last acknowledgement changed.
bool changesOverflowed () const
 Whether the pending set was dropped for being bigger than a rebuild.
void takeChanges ()
 Acknowledge the pending set: it is applied, and starts again.
u32 visited () const
 How many entities the last composition wrote, changed or not.
Public Member Functions inherited from esengine::ecs::System
virtual ~System ()=default
 Virtual destructor for proper cleanup.
virtual void shutdown (Registry &registry)
 Called once when the system is removed.
void setEnabled (bool enabled)
 Enables or disables the system.
bool isEnabled () const
 Checks if the system is enabled.
void setPriority (i32 priority)
 Sets the system's execution priority.
i32 getPriority () const
 Gets the system's execution priority.

Additional Inherited Members

Protected Attributes inherited from esengine::ecs::System
bool enabled_ = true
 Whether the system is enabled.
i32 priority_ = 0
 Execution priority (lower = earlier).

Detailed Description

Definition at line 29 of file TransformSystem.hpp.

Constructor & Destructor Documentation

◆ TransformSystem()

esengine::ecs::TransformSystem::TransformSystem ( )
inline

Definition at line 31 of file TransformSystem.hpp.

References esengine::ecs::System::setPriority().

Member Function Documentation

◆ changesOverflowed()

bool esengine::ecs::TransformSystem::changesOverflowed ( ) const
inline

Whether the pending set was dropped for being bigger than a rebuild.

Once more entities have changed than there are Transforms, reading them all again is cheaper than replaying the list — so it is dropped and the consumer is told to rebuild instead of handed a set that costs more than the thing it saves.

Definition at line 89 of file TransformSystem.hpp.

◆ changeTracking()

bool esengine::ecs::TransformSystem::changeTracking ( ) const
inline

Definition at line 72 of file TransformSystem.hpp.

◆ composedEpoch()

u32 esengine::ecs::TransformSystem::composedEpoch ( ) const
inline

Definition at line 54 of file TransformSystem.hpp.

◆ compositionSerial()

u32 esengine::ecs::TransformSystem::compositionSerial ( ) const
inline

How many compositions have RUN.

A consumer compares it with the serial at its last acknowledgement to answer "has anything composed since?" without looking at a set.

Definition at line 61 of file TransformSystem.hpp.

◆ ensureComposed()

void esengine::ecs::TransformSystem::ensureComposed ( Registry & registry)
inline

Compose if anything changed since the last one; O(1) if not.

Consumers call this rather than update(), so a renderer and a replication sample in one generation pay for one composition.

Note
The registry's identity is part of the comparison — a second world holding the same epoch number has not been composed.

Definition at line 48 of file TransformSystem.hpp.

References esengine::ecs::Registry::instanceId(), and esengine::ecs::transformMutationEpoch().

Referenced by esengine::springbone::SpringBoneSystem::update().

◆ init()

void esengine::ecs::TransformSystem::init ( Registry & registry)
inlineoverridevirtual

Called once when the system is added to a group.

Parameters
registryReference to the ECS registry

Override to perform one-time initialization such as caching component pools or loading resources.

Reimplemented from esengine::ecs::System.

Definition at line 35 of file TransformSystem.hpp.

◆ pendingChanges()

const std::vector< Entity > & esengine::ecs::TransformSystem::pendingChanges ( ) const
inline

What every composition since the last acknowledgement changed.

ACCUMULATED, not per-composition: a renderer composes each frame and a consumer samples every few. Duplicates are kept, because applying an entity twice is idempotent for every consumer.

Definition at line 80 of file TransformSystem.hpp.

◆ setChangeTracking()

void esengine::ecs::TransformSystem::setChangeTracking ( bool on)
inline

Collect which entities' composed OUTPUT changed, from now on.

Note
One consumer. The pending set is a mailbox, not a per-reader journal: whoever acknowledges empties it for everyone.

Definition at line 68 of file TransformSystem.hpp.

References takeChanges().

◆ takeChanges()

void esengine::ecs::TransformSystem::takeChanges ( )
inline

Acknowledge the pending set: it is applied, and starts again.

Definition at line 92 of file TransformSystem.hpp.

Referenced by setChangeTracking().

◆ update()

void esengine::ecs::TransformSystem::update ( World & world)
inlineoverridevirtual

Called every frame to execute system logic.

Parameters
worldThe world context (registry, services, deltaTime)

Pure virtual - must be overridden. This is where the main system logic goes.

Implements esengine::ecs::System.

Definition at line 39 of file TransformSystem.hpp.

Referenced by esengine::transform_update().

◆ visited()

u32 esengine::ecs::TransformSystem::visited ( ) const
inline

How many entities the last composition wrote, changed or not.

Definition at line 95 of file TransformSystem.hpp.


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