Scene Class
Represents a hierarchical SceneGraph that organizes all renderable and non-renderable objects within a scene. More...
Declaration
Public Constructors Index
| Scene (const Scene &)=delete | |
|
Prevent copying. More... | |
| Scene (Scene &&) noexcept=default | |
|
Move constructor. More... | |
| Scene (std::unique_ptr< helios::scene::FrustumCullingStrategy > frustumCullingStrategy) | |
| Scene (std::unique_ptr< helios::scene::FrustumCullingStrategy > frustumCullingStrategy, const helios::engine::modules::scene::types::SceneId sceneId) | |
Public Destructor Index
| ~Scene ()=default | |
|
Destructor. More... | |
Public Operators Index
| Scene & | operator= (const Scene &)=delete |
|
Prevent copy assignment. More... | |
| Scene & | operator= (Scene &&) noexcept=default |
|
Move assignment operator. More... | |
Public Member Functions Index
| SceneNode * | addNode (std::unique_ptr< SceneNode > node) const |
| void | updateNodes () const |
|
Updates the world transformations of SceneNodes in the graph. More... | |
| helios::engine::modules::scene::types::SceneId | sceneId () const noexcept |
|
Returns the unique identifier for this scene. More... | |
| std::vector< const helios::scene::SceneNode * > | findVisibleNodes (const helios::scene::CameraSceneNode *cameraSceneNode) const |
|
Applies this Scene's frustumCullingStrategy and returns all nodes visible for the specified CameraSceneNode and its associated `Camera`. More... | |
| helios::scene::SceneNode & | root () const noexcept |
| std::optional< Snapshot > | createSnapshot (const rendering::Viewport &viewport) const |
Private Member Functions Index
| void | propagateWorldTransform (SceneNode &node, const math::mat4f &parentWorldTransform) const |
|
Internal helper function to force-propagate the worldTransformation of SceneNodes to their child nodes. More... | |
| void | updateNodes (SceneNode &node, const math::mat4f &wt) const |
|
Selectively updates the world transformation of SceneNodes in the scene graph. More... | |
Private Member Attributes Index
| SceneGraphKey | sceneGraphKey_ {} |
|
SceneGraphKey for internal use. More... | |
| helios::math::mat4f | mat4fid = helios::math::mat4f::identity() |
|
4x4 identity matrix for internal use. More... | |
| std::unique_ptr< SceneNode > | root_ |
|
The root node of this scene. More... | |
| helios::engine::modules::scene::types::SceneId | sceneId_ {helios::core::types::no_init} |
|
Unique identifier for this scene. More... | |
| std::unique_ptr< helios::scene::FrustumCullingStrategy > | frustumCullingStrategy_ |
|
The FrustumCullingStrategy used with this Scene. More... | |
Private Static Attributes Index
| static const helios::util::log::Logger & | logger_ = ... |
Description
Represents a hierarchical SceneGraph that organizes all renderable and non-renderable objects within a scene.
Every scene has one implicit root node all nodes are appended to when `addNode` is called.
A Scene is responsible for managing the SceneGraph, consisting of SceneNodes; it provides methods to frustum cull SceneNodes based on a specific `FrustumCullingStrategy` and a particular `CameraSceneNode` and also allows for propagating world transformations through the contained subtrees.
- See Also
[RTR, pp. 828]
- See Also
[Gre19, pp. 693]
- See Also
[HDMS+14, pp. 138]
By default, we're not allowing copying/moving Scenes. These constraints may be relaxed in the future, depending on valid use cases.
Definition at line 55 of file Scene.ixx.
Public Constructors
Scene()
| delete |
Scene()
| noexcept default |
Scene()
| inline explicit |
Constructs a new Scene.
The root node for this scene is automatically created.
- Parameters
-
frustumCullingStrategy The frustum culling strategy to use with this Scene.
Definition at line 188 of file Scene.ixx.
Reference Scene.
Scene()
| inline explicit |
Constructs a new Scene with a specific scene ID.
- Parameters
-
frustumCullingStrategy The frustum culling strategy to use with this Scene.
sceneId Unique identifier for this scene.
Definition at line 200 of file Scene.ixx.
Public Operators
operator=()
| delete |
operator=()
Public Member Functions
addNode()
| inline nodiscard |
createSnapshot()
| inline nodiscard |
Creates a Snapshot of the Scene and returns it.
Taking a snapshot will frustum cull the SceneNodes and place their Renderables along with the current matrices of this scene into the Snapshot object. Only those SceneNodes are considered that were configured with a Renderable and have their `isActive`-flag set to true.
- Parameters
-
viewport The viewport for which the Snapshot is created.
Definition at line 298 of file Scene.ixx.
References helios::scene::SceneNode::cachedWorldTransform, helios::rendering::Viewport::cameraSceneNode, findVisibleNodes, helios::scene::SceneNode::hasRenderable, helios::scene::SceneNode::isActive and helios::scene::SceneNode::renderable.
findVisibleNodes()
| inline nodiscard |
Applies this Scene's frustumCullingStrategy and returns all nodes visible for the specified CameraSceneNode and its associated `Camera`.
This method ensures that all nodes' world geometry is properly updated before culling is applied.
- Parameters
-
cameraSceneNode The cameraSceneNode used to determine the view frustum for culling.
- Returns
A list of currently visible nodes (const pointers into the scene graph).
Definition at line 255 of file Scene.ixx.
Reference updateNodes.
Referenced by createSnapshot.
root()
| inline nodiscard noexcept |
Returns the root node of this Scene.
The root node is guaranteed to exist.
- Returns
The root node of this Scene.
Definition at line 275 of file Scene.ixx.
sceneId()
| inline nodiscard noexcept |
updateNodes()
| inline |
Updates the world transformations of SceneNodes in the graph.
The method traverses the Scene and propagates updated world transformations to their respective child nodes if the processed node is considered to be dirty.
Definition at line 231 of file Scene.ixx.
Reference updateNodes.
Referenced by findVisibleNodes and updateNodes.
Private Member Functions
propagateWorldTransform()
| inline |
Internal helper function to force-propagate the worldTransformation of SceneNodes to their child nodes.
Propagation is cancelled for this node if the resulting world transform is considered equal to the current world transform of the SceneNode.
- Parameters
-
node The current SceneNode for which to propagate the world transformation.
parentWorldTransform The world transformation from the parent node.
- See Also
Definition at line 94 of file Scene.ixx.
updateNodes()
| inline |
Selectively updates the world transformation of SceneNodes in the scene graph.
A SceneNode is forced to update its own world transformation and the world transformation of its children as soon as a check for the dirty-state of the node is true.
- Parameters
-
node The current SceneNode processed.
wt The world transform to apply.
It is important that this method is called before the next render pass, or before the scene graph is culled. This method must also consider CameraSceneNodes, making sure the associated `Camera` is updated with the view matrix.
Definition at line 123 of file Scene.ixx.
Private Member Attributes
frustumCullingStrategy_
|
The FrustumCullingStrategy used with this Scene.
Definition at line 138 of file Scene.ixx.
mat4fid
|
4x4 identity matrix for internal use.
Definition at line 69 of file Scene.ixx.
root_
|
sceneGraphKey_
|
SceneGraphKey for internal use.
- See Also
helios::scene::SceneNode::setWorldTransform()
Definition at line 64 of file Scene.ixx.
sceneId_
|
Unique identifier for this scene.
Private Static Attributes
logger_
| static |
The logger used with this Scene instance.
- Initialiser
Defaults to HELIOS_LOG_SCOPE.
- Todo
-
constructor injection
Definition at line 147 of file Scene.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.