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;
20import helios.engine.ecs.System;
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
34 using namespace helios::engine::modules::scene::types;
35
36 /**
37 * @brief Renders scenes through their configured viewports.
38 *
39 * @details This system iterates over all active viewport IDs from the session,
40 * resolves the associated scene and viewport via SceneToViewportMap, creates
41 * a scene snapshot, and submits it to the rendering device.
42 *
43 * The system runs in the Post phase after all gameplay updates are complete,
44 * ensuring the scene graph reflects the final state for this frame.
45 *
46 * @see SceneToViewportMap
47 * @see RenderingDevice
48 * @see RenderPassFactory
49 */
51
52 /**
53 * @brief Reference to the rendering device for draw call submission.
54 */
56
57 /**
58 * @brief Reference to the scene-to-viewport mapping.
59 */
61
62 public:
63
64 /**
65 * @brief Constructs the system with required dependencies.
66 *
67 * @param renderingDevice The rendering device for submitting draw calls.
68 * @param sceneToViewportMap Mapping from scenes to their viewports.
69 */
73 )
74 : renderingDevice_(renderingDevice), sceneToViewportMap_(sceneToViewportMap) {}
75
76 /**
77 * @brief Renders all active viewports for this frame.
78 *
79 * @details Iterates over the session's active viewport IDs, resolves each
80 * to its scene and viewport, creates a snapshot, builds a RenderPass, and
81 * submits it to the rendering device.
82 *
83 * @param updateContext The current frame's update context.
84 */
85 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept override {
86
87
88 auto& session = updateContext.session();
89
90 auto viewportIds = session.viewportIds();
91
92 for (auto viewportId : viewportIds) {
93
94 auto scene = sceneToViewportMap_.scene(viewportId);
95 if (!scene) {
96 continue;
97 }
98
99 auto viewport = sceneToViewportMap_.viewport(scene->sceneId(), viewportId);
100 if (!viewport) {
101 continue;
102 }
103
104 const auto& snapshot = scene->createSnapshot(*viewport);
105 if (snapshot.has_value()) {
107 .buildRenderPass(*snapshot);
108 renderingDevice_.render(renderPass);
109 }
110
111 }
112
113 }
114
115 };
116
117}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.