Skip to main content

SceneRenderingSystem.ixx File

System for rendering scenes through their associated viewports. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemodules

Domain-specific components and systems. More...

namespacescene

Scene graph integration for game entities. More...

namespacesystems

Scene graph synchronization and rendering systems. More...

Classes Index

classSceneRenderingSystem

Renders scenes through their configured viewports. More...

Description

System for rendering scenes through their associated viewports.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file SceneRenderingSystem.ixx
3 * @brief System for rendering scenes through their associated viewports.
4 */
5module;
6
7
8#include <cassert>
9#include <vector>
10
11export module helios.engine.modules.scene.systems.SceneRenderingSystem;
12
13import helios.scene.Scene;
14
15import helios.rendering.RenderingDevice;
16
17import helios.engine.runtime.world.Session;
18
19import helios.engine.runtime.world.GameWorld;
20
21import helios.engine.runtime.world.UpdateContext;
22
23import helios.engine.mechanics.lifecycle.components.Active;
24
25import helios.rendering.RenderPassFactory;
26
27import helios.engine.modules.scene.types.SceneToViewportMap;
28
29import helios.engine.modules.scene.components.SceneNodeComponent;
30import helios.engine.modules.spatial.transform.components.ComposeTransformComponent;
31
33
34import helios.engine.common.tags.SystemRole;
35
37
38 /**
39 * @brief Renders scenes through their configured viewports.
40 *
41 * @details This system iterates over all active viewport IDs from the session,
42 * resolves the associated scene and viewport via SceneToViewportMap, creates
43 * a scene snapshot, and submits it to the rendering device.
44 *
45 * The system runs in the Post phase after all gameplay updates are complete,
46 * ensuring the scene graph reflects the final state for this frame.
47 *
48 * @see SceneToViewportMap
49 * @see RenderingDevice
50 * @see RenderPassFactory
51 */
53
54 /**
55 * @brief Reference to the rendering device for draw call submission.
56 */
58
59 /**
60 * @brief Reference to the scene-to-viewport mapping.
61 */
63
64 public:
65
67
68 /**
69 * @brief Constructs the system with required dependencies.
70 *
71 * @param renderingDevice The rendering device for submitting draw calls.
72 * @param sceneToViewportMap Mapping from scenes to their viewports.
73 */
77 )
78 : renderingDevice_(renderingDevice), sceneToViewportMap_(sceneToViewportMap) {}
79
80 /**
81 * @brief Renders all active viewports for this frame.
82 *
83 * @details Iterates over the session's active viewport IDs, resolves each
84 * to its scene and viewport, creates a snapshot, builds a RenderPass, and
85 * submits it to the rendering device.
86 *
87 * @param updateContext The current frame's update context.
88 */
90
91
92 auto& session = updateContext.session();
93
94 auto viewportIds = session.viewportIds();
95
96 for (auto viewportId : viewportIds) {
97
98 auto scene = sceneToViewportMap_.scene(viewportId);
99 if (!scene) {
100 continue;
101 }
102
103 auto viewport = sceneToViewportMap_.viewport(scene->sceneId(), viewportId);
104 if (!viewport) {
105 continue;
106 }
107
108 const auto& snapshot = scene->createSnapshot(*viewport);
109 if (snapshot.has_value()) {
111 .buildRenderPass(*snapshot);
112 renderingDevice_.render(renderPass);
113 }
114
115 }
116
117 }
118
119 };
120
121}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.