Skip to main content

SceneSyncSystem Class

System that synchronizes TransformComponents with SceneNodes. More...

Declaration

class helios::engine::modules::scene::systems::SceneSyncSystem { ... }

Public Member Typedefs Index

usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors Index

SceneSyncSystem (helios::engine::modules::scene::types::SceneToViewportMap &sceneToViewportMap)

Constructs the system with the scene-to-viewport map. More...

Public Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept

Synchronizes gameplay transforms with the scene graph. More...

Public Member Attributes Index

helios::engine::modules::scene::types::SceneToViewportMap &sceneToViewportMap_

Reference to the scene-to-viewport mapping for scene iteration. More...

Description

System that synchronizes TransformComponents with SceneNodes.

This system bridges the gameplay simulation and the rendering scene graph. It propagates local transformations from dirty ComposeTransformComponents to their corresponding SceneNodes, triggers a scene graph update, and then reads back the computed world transforms into the ComposeTransformComponents.

The system runs in two passes: 1. **Write pass**: Dirty local transforms are pushed to SceneNodes 2. **Scene update**: All scenes update their node hierarchies 3. **Read pass**: Computed world transforms are read back to components

See Also

ComposeTransformComponent

See Also

SceneNodeComponent

See Also

SceneToViewportMap

Definition at line 47 of file SceneSyncSystem.ixx.

Public Member Typedefs

EngineRoleTag

using helios::engine::modules::scene::systems::SceneSyncSystem::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors

SceneSyncSystem()

helios::engine::modules::scene::systems::SceneSyncSystem::SceneSyncSystem (helios::engine::modules::scene::types::SceneToViewportMap & sceneToViewportMap)
inline explicit

Constructs the system with the scene-to-viewport map.

Parameters
sceneToViewportMap

Reference to the scene mapping for accessing all scenes.

Definition at line 63 of file SceneSyncSystem.ixx.

64 : sceneToViewportMap_(sceneToViewportMap) {}

Reference sceneToViewportMap_.

Public Member Functions

update()

void helios::engine::modules::scene::systems::SceneSyncSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Synchronizes gameplay transforms with the scene graph.

Performs a two-pass synchronization: 1. Writes dirty local transforms to SceneNodes 2. Updates all scene hierarchies 3. Reads computed world transforms back to components

Parameters
updateContext

The current frame's update context.

Definition at line 76 of file SceneSyncSystem.ixx.

77
78 for (auto [entity, tc, nc, active] : updateContext.view<
82 >().whereEnabled()) {
83
84 if (!tc->isDirty()) {
85 continue;
86 }
87
88 auto* sceneNode = nc->sceneNode();
89 if (!sceneNode || !sceneNode->isActive()) {
90 continue;
91 }
92
93 sceneNode->setScale(tc->localScaling());
94 sceneNode->setRotation(tc->localRotation());
95 sceneNode->setTranslation(tc->localTranslation());
96 }
97
98 //Propagate changes and update the nodes
99 for (auto* scene : sceneToViewportMap_.scenes()) {
100 scene->updateNodes();
101 }
102
103 // Second pass: read back world transforms from SceneNode to ComposeTransformComponent
104 for (auto [entity, tc, nc, active] : updateContext.view<
108 >().whereEnabled()) {
109
110 auto* sceneNode = nc->sceneNode();
111 if (!sceneNode || !sceneNode->isActive()) {
112 continue;
113 }
114
115 tc->setWorldTransform(sceneNode->worldTransform());
116 }
117
118 }

Reference sceneToViewportMap_.

Public Member Attributes

sceneToViewportMap_

helios::engine::modules::scene::types::SceneToViewportMap& helios::engine::modules::scene::systems::SceneSyncSystem::sceneToViewportMap_

Reference to the scene-to-viewport mapping for scene iteration.

Definition at line 56 of file SceneSyncSystem.ixx.

Referenced by SceneSyncSystem and update.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.