Scene.ixx File
Represents a hierarchical SceneGraph that organizes all renderable and non-renderable objects within a scene. More...
Included Headers
#include <cassert>
#include <format>
#include <memory>
#include <optional>
#include <vector>
#include <helios.core.types>
#include <helios.engine.modules.scene.types.SceneId>
#include <helios.util.log.Logger>
#include <helios.scene.SnapshotItem>
#include <helios.util.log.LogManager>
#include <helios.scene.FrustumCullingStrategy>
#include <helios.scene.SceneNode>
#include <helios.rendering.Viewport>
#include <helios.math.types>
#include <helios.scene.Camera>
#include <helios.scene.CameraSceneNode>
#include <helios.scene.Snapshot>
Namespaces Index
| namespace | helios |
| namespace | scene |
Classes Index
| class | Scene |
|
Represents a hierarchical SceneGraph that organizes all renderable and non-renderable objects within a scene. More... | |
Macro Definitions Index
| #define | HELIOS_LOG_SCOPE "helios::scene::Scene" |
Description
Represents a hierarchical SceneGraph that organizes all renderable and non-renderable objects within a scene.
File Listing
The file content with the documentation metadata removed is:
32#define HELIOS_LOG_SCOPE "helios::scene::Scene"
33export namespace helios::scene {
64 SceneGraphKey sceneGraphKey_{};
69 helios::math::mat4f mat4fid = helios::math::mat4f::identity();
84 * @brief Internal helper function to force-propagate the worldTransformation of SceneNodes to their child nodes.
94 void propagateWorldTransform(SceneNode& node, const math::mat4f& parentWorldTransform) const {
98 if (!node.applyWorldTransform(parentWorldTransform, sceneGraphKey_)) {
99 for (auto& child: node.children()) {
100 updateNodes(*child, node.cachedWorldTransform());
103 for (auto& child: node.children()) {
104 propagateWorldTransform(*child, node.cachedWorldTransform());
123 void updateNodes(SceneNode& node, const math::mat4f& wt) const {
125 if (node.needsUpdate()) {
128 const auto& parentWt = node.worldTransform();
129 for (auto& child: node.children()) {
130 updateNodes(*child, parentWt);
147 inline static const helios::util::log::Logger& logger_ = helios::util::log::LogManager::loggerForScope(
148 HELIOS_LOG_SCOPE
188 explicit Scene(std::unique_ptr<helios::scene::FrustumCullingStrategy> frustumCullingStrategy) :
189 frustumCullingStrategy_(std::move(frustumCullingStrategy)), root_(std::make_unique<SceneNode>()) {
202 const helios::engine::modules::scene::types::SceneId sceneId) :
203 Scene(std::move(frustumCullingStrategy))
205 sceneId_ = sceneId;
231 void updateNodes() const {
232 updateNodes(*root_, mat4fid);
240 [[nodiscard]] helios::engine::modules::scene::types::SceneId sceneId() const noexcept {
245 * @brief Applies this Scene's frustumCullingStrategy and returns all nodes visible for the specified
255 [[nodiscard]] std::vector<const helios::scene::SceneNode*> findVisibleNodes(
256 const helios::scene::CameraSceneNode* cameraSceneNode
263 updateNodes();
275 [[nodiscard]] helios::scene::SceneNode& root() const noexcept {
295 * @todo This should be refactored into a factory to prevent domain leakage between Scene and Rendering.
298 createSnapshot(const rendering::Viewport& viewport) const {
300 const auto* cameraSceneNode = viewport.cameraSceneNode();
307 const auto nodes = findVisibleNodes(cameraSceneNode);
312 if (node->isActive() && node->hasRenderable()) {
314 node->renderable(),
315 node->cachedWorldTransform()
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.