RenderPassFactory Class
Factory for constructing `RenderPass` objects from scene snapshots. More...
Declaration
Public Member Functions Index
| RenderPass | buildRenderPass (const helios::scene::Snapshot &snapshot) const |
|
Builds a `RenderPass` from a given `Snapshot`. More... | |
| void | populateRenderQueue (const helios::scene::Snapshot &snapshot, helios::rendering::RenderQueue &renderQueue) const |
|
Populates an existing `RenderQueue` with render commands based on a `Snapshot`. More... | |
| void | makeRenderCommand (const helios::scene::SnapshotItem &snapshotItem, helios::rendering::RenderQueue &renderQueue) const noexcept |
|
Emits render commands from a `SnapshotItem` to the render queue. More... | |
Public Static Functions Index
| static RenderPassFactory & | getInstance () |
|
Returns the singleton instance of `RenderPassFactory`. More... | |
Protected Static Attributes Index
| static const helios::util::log::Logger & | logger_ = ... |
|
Shared logger instance for all RenderPassFactory objects. More... | |
Description
Factory for constructing `RenderPass` objects from scene snapshots.
`RenderPassFactory` transforms high-level scene data (`Snapshot` and `SnapshotItem`) into low-level rendering commands suitable for the rendering device. It creates `RenderPass` objects with populated `RenderQueue`s and configured frame uniforms.
## Responsibilities
- Build `RenderPass` objects from `Snapshot` data.
- Populate `RenderQueue` with `MeshRenderCommand` and `TextRenderCommand` objects.
- Configure frame-level uniforms (view/projection matrices).
## Usage
```cpp auto& factory = RenderPassFactory::getInstance(); auto snapshot = sceneGraph.createSnapshot(viewport); auto renderPass = factory.buildRenderPass(snapshot);
device.beginRenderPass(renderPass); device.doRender(renderPass); device.endRenderPass(renderPass); ```
This class implements a singleton pattern. In the future, the conversion of high-level scene data into lower-level rendering commands might be realized with strategies and/or separate factories.
- See Also
- See Also
Snapshot
- See Also
SnapshotItem
- See Also
Definition at line 61 of file RenderPassFactory.ixx.
Public Member Functions
buildRenderPass()
| inline nodiscard |
Builds a `RenderPass` from a given `Snapshot`.
This method orchestrates the creation of a `RenderQueue` and populates it with render commands derived from the `SnapshotItem`s within the snapshot. It also sets up frame-specific uniform values (view and projection matrices) for the `RenderPass`.
- Parameters
-
snapshot A const reference to the snapshot containing the scene data for which the `RenderPass` is to be built.
- Returns
A fully constructed `RenderPass` object containing the render queue and frame-specific uniforms.
- See Also
Definition at line 99 of file RenderPassFactory.ixx.
References populateRenderQueue, helios::rendering::shader::ProjectionMatrix, helios::scene::Snapshot::projectionMatrix, helios::rendering::shader::ViewMatrix, helios::scene::Snapshot::viewMatrix and helios::scene::Snapshot::viewport.
Referenced by helios::engine::modules::scene::systems::SceneRenderingSystem::update.
makeRenderCommand()
| inline noexcept |
Emits render commands from a `SnapshotItem` to the render queue.
This method extracts necessary data from the `SnapshotItem`, sets up the object uniform values (e.g., model matrix), and delegates to the `Renderable` to emit its render commands to the queue.
- Parameters
-
snapshotItem A const reference to the `SnapshotItem` from which to create render commands.
renderQueue A reference to the `RenderQueue` to emit commands to.
If the `Renderable` pointer in the `SnapshotItem` is `nullptr`, a warning is logged and no commands are emitted.
Definition at line 158 of file RenderPassFactory.ixx.
References logger_ and helios::rendering::shader::ModelMatrix.
Referenced by populateRenderQueue.
populateRenderQueue()
| inline |
Populates an existing `RenderQueue` with render commands based on a `Snapshot`.
This method clears the specified `RenderQueue` before adding new commands. Each `SnapshotItem` in the snapshot is processed via `makeRenderCommand()`.
- Parameters
-
snapshot A const reference to the `Snapshot` providing scene data.
renderQueue A reference to the `RenderQueue` to be filled. This queue will be cleared before new commands are added.
- See Also
Definition at line 131 of file RenderPassFactory.ixx.
References helios::rendering::RenderQueue::clear, makeRenderCommand and helios::scene::Snapshot::snapshotItems.
Referenced by buildRenderPass.
Public Static Functions
getInstance()
| inline static |
Returns the singleton instance of `RenderPassFactory`.
- Returns
A reference to the single `RenderPassFactory` instance.
Definition at line 77 of file RenderPassFactory.ixx.
Referenced by helios::engine::modules::scene::systems::SceneRenderingSystem::update.
Protected Static Attributes
logger_
| protected static |
Shared logger instance for all RenderPassFactory objects.
- Initialiser
Definition at line 67 of file RenderPassFactory.ixx.
Referenced by makeRenderCommand.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.