Skip to main content

Snapshot.ixx File

Represents an immutable snapshot of a SceneGraph at a given point in time. More...

Included Headers

#include <memory> #include <span> #include <vector> #include <helios.math.types> #include <helios.scene.SnapshotItem> #include <helios.rendering.Viewport>

Namespaces Index

namespacehelios
namespacescene

Scene graph and camera management. More...

Classes Index

classSnapshot

Represents an immutable snapshot of a SceneGraph at a given point in time. More...

Description

Represents an immutable snapshot of a SceneGraph at a given point in time.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Snapshot.ixx
3 * @brief Represents an immutable snapshot of a SceneGraph at a given point in time.
4 */
5module;
6
7
8#include <memory>
9#include <span>
10#include <vector>
11
12export module helios.scene.Snapshot;
13
14import helios.rendering.Viewport;
15import helios.scene.SnapshotItem;
16import helios.math.types;
17
18export namespace helios::scene {
19
20 /**
21 * @brief Represents an immutable snapshot of a SceneGraph at a given point in time.
22 *
23 * The class encapsulates all necessary data to render a single frame. It is
24 * designed to be a lightweight DTO to pass information to the rendering
25 * engine abstraction layer, such as the `LegacyRenderPass` class.
26 *
27 * A snapshot includes a camera's projection and view matrix that should be used
28 * for rendering the scene. A collection of `SnapshotItems` holds the information
29 * about the renderable objects in the scene, preferably computed by using a
30 * `FrustumCullingStrategy` (@see Scene::createSnapshot).
31 *
32 * The class is not copyable to enforce its immutability and prevent unintended
33 * duplication of potentially large data sets.
34 */
35 class Snapshot final {
36
37 protected:
38 /**
39 * @brief The projection matrix that should be used with this Snapshot.
40 *
41 * The projection matrix transforms camera space into clip space.
42 */
44
45 /**
46 * @brief The view matrix that should be used with this Snapshot.
47 *
48 * The view matrix transforms world space coordinates into camera space.
49 */
51
52 /**
53 * @brief A const collection of `SnapshotItem`s representing all renderable objects visible in this Snapshot.
54 *
55 * Each item contains the world transformation along with the renderable object.
56 */
57 const std::vector<SnapshotItem> snapshotItems_;
58
59 /**
60 * @brief The viewport associated with this Snapshot.
61 */
63
64 public:
65
66 ~Snapshot() = default;
67
68 /**
69 * @brief Delete copy constructor.
70 *
71 * Snapshots are not intended to be copied.
72 */
73 Snapshot(const Snapshot&) = delete;
74
75 /**
76 * @brief Delete copy assignment operator.
77 *
78 * Snapshots are not intended to be copied.
79 */
80 Snapshot& operator=(const Snapshot&) = delete;
81
82 /**
83 * @brief Delete move constructor.
84 */
85 Snapshot(Snapshot&&) noexcept = delete;
86
87 /**
88 * @brief Delete move assignment.
89 */
90 Snapshot& operator=(Snapshot&&) noexcept = delete;
91
92 /**
93 * @brief Constructs a new immutable Snapshot from the given data.
94 *
95 * @param viewport The viewport associated with this snapshot.
96 * @param projectionMatrix The projection matrix of the camera for this snapshot.
97 * @param viewMatrix The view matrix of the camera for this snapshot.
98 * @param snapshotItems A vector of snapshot items. The vector is moved into the Snapshot,
99 * transferring ownership to this instance.
100 */
102 const helios::rendering::Viewport& viewport,
103 const math::mat4f& projectionMatrix,
104 const math::mat4f& viewMatrix,
105 std::vector<SnapshotItem> snapshotItems) noexcept :
110 {}
111
112 /**
113 * @brief Returns a const reference to this Snapshot's SnapshotItems.
114 *
115 * The vector contains all renderable items in the scene.
116 *
117 * @return A const reference to this Snapshot's collection of SnapshotItems.
118 */
119 [[nodiscard]] std::span<const SnapshotItem> snapshotItems() const noexcept {
120 return snapshotItems_;
121 }
122
123 /**
124 * @brief Returns the viewport associated with this Snapshot.
125 *
126 * @return A shared pointer to the const Viewport.
127 */
128 [[nodiscard]] const helios::rendering::Viewport& viewport() const noexcept {
129 return viewport_;
130 }
131
132 /**
133 * @brief Returns a const reference to the projection matrix for this Snapshot.
134 *
135 * The matrix represents the projection matrix of the camera that was used to
136 * capture this scene.
137 *
138 * @return A const reference to the projection matrix used for creating this Snapshot.
139 */
140 [[nodiscard]] const helios::math::mat4f& projectionMatrix() const noexcept {
141 return projectionMatrix_;
142 }
143
144 /**
145 * @brief Returns a const reference to the view matrix for this Snapshot.
146 *
147 * The matrix represents the view matrix of the camera that was used to
148 * capture this scene.
149 *
150 * @return A const reference to the view matrix used for creating this Snapshot.
151 */
152 [[nodiscard]] const helios::math::mat4f& viewMatrix() const noexcept {
153 return viewMatrix_;
154 }
155 };
156}
157

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.