CameraSceneNode Class
Represents an adapter for cameras, allowing spatial positioning and transformation within the scene graph. More...
Declaration
Base class
| class | SceneNode |
Public Constructors Index
| CameraSceneNode (std::unique_ptr< helios::scene::Camera > camera) | |
|
Constructs a CameraSceneNode that takes ownership of the given camera. More... | |
Public Member Functions Index
| SceneNode * | addNode (std::unique_ptr< SceneNode > sceneNode) override |
|
Prevents adding child nodes to a camera scene node. More... | |
| const helios::scene::Camera & | camera () const noexcept |
|
Gets the camera associated with this scene node. More... | |
| helios::scene::Camera & | camera () noexcept |
|
Gets the camera associated with this scene node. More... | |
| void | lookAt (helios::math::vec3f target, helios::math::vec3f up) |
|
Orients this camera node to look at a target position in world space. More... | |
| void | lookAtLocal (helios::math::vec3f targetLocal, helios::math::vec3f upLocal) |
|
Orients this camera node to look at a target position in local space. More... | |
| void | onWorldTransformUpdate () noexcept override |
|
Callback invoked when the world transform of this node changes. More... | |
Protected Member Attributes Index
| std::unique_ptr< helios::scene::Camera > | camera_ |
|
Unique pointer to the camera instance owned by this scene node. More... | |
Description
Represents an adapter for cameras, allowing spatial positioning and transformation within the scene graph.
A CameraSceneNode behaves just like a (non-renderable) SceneNode, except that it does not accept child nodes.
An instance of `CameraSceneNode` can be added as a direct descendant of the scene's root node for free transform, or it can be a child of a model hierarchy to inherit the corresponding positioning in the world.
Definition at line 31 of file CameraSceneNode.ixx.
Public Constructors
CameraSceneNode()
| inline explicit |
Constructs a CameraSceneNode that takes ownership of the given camera.
The CameraSceneNode becomes the sole owner of the Camera instance. The camera's view matrix is automatically updated when `worldTransform()` is called.
- Parameters
-
camera A unique pointer to the camera to be owned by this scene node.
- Exceptions
-
std::invalid_argument if camera is a nullptr.
Definition at line 52 of file CameraSceneNode.ixx.
Public Member Functions
addNode()
| inline nodiscard virtual |
Prevents adding child nodes to a camera scene node.
This method does nothing and returns `nullptr`, indicating that a `CameraSceneNode` must not have child nodes.
- Parameters
-
sceneNode The attempted child node to add (ignored).
- Returns
Always returns `nullptr`.
Definition at line 71 of file CameraSceneNode.ixx.
Reference helios::scene::SceneNode::SceneNode.
camera()
| inline nodiscard noexcept |
Gets the camera associated with this scene node.
- Returns
A const ref to the associated camera instance.
Definition at line 81 of file CameraSceneNode.ixx.
Reference camera_.
Referenced by CameraSceneNode.
camera()
| inline nodiscard noexcept |
Gets the camera associated with this scene node.
- Returns
A ref to the associated camera instance.
Definition at line 90 of file CameraSceneNode.ixx.
Reference camera_.
lookAt()
| inline |
Orients this camera node to look at a target position in world space.
Computes the rotation matrix required to align this scene node's forward direction with the specified target position. The rotation is computed in world space and then converted to local space by factoring out the parent's rotation.
- Parameters
-
target The world-space coordinates of the target to look at.
up The up vector defining the camera's vertical orientation in world space.
- Precondition
The camera node must have a valid parent (i.e., must be added to a scene graph).
The up vector should typically be `(0, 1, 0)` for standard upright orientation.
- See Also
Definition at line 112 of file CameraSceneNode.ixx.
References helios::scene::SceneNode::cachedWorldTransform, helios::math::cross, helios::math::mat4< T >::decompose, helios::scene::SceneNode::inheritance_, helios::math::vec3< T >::normalize, helios::scene::SceneNode::parent, helios::math::Rotation, helios::scene::SceneNode::setRotation, helios::math::transformTypeMatch and helios::scene::SceneNode::worldTransform.
lookAtLocal()
| inline |
Orients this camera node to look at a target position in local space.
Similar to `lookAt()`, but the target and up vector are interpreted relative to this node's local coordinate system rather than world space. Useful when the camera should track objects within the same local hierarchy.
- Parameters
-
targetLocal The local-space coordinates of the target to look at.
upLocal The up vector defining the camera's vertical orientation in local space.
- See Also
Definition at line 162 of file CameraSceneNode.ixx.
References helios::math::cross, helios::scene::SceneNode::localTransform, helios::math::vec3< T >::normalize, helios::scene::SceneNode::setRotation and helios::core::spatial::Transform::transform.
onWorldTransformUpdate()
| inline noexcept virtual |
Callback invoked when the world transform of this node changes.
Overrides the base class implementation to update the camera's view matrix whenever the node's position or orientation in the scene graph changes. This ensures the camera always reflects the current world-space transform.
- See Also
Definition at line 193 of file CameraSceneNode.ixx.
References helios::scene::SceneNode::cachedWorldTransform, camera_ and helios::scene::SceneNode::onWorldTransformUpdate.
Protected Member Attributes
camera_
| protected |
Unique pointer to the camera instance owned by this scene node.
Definition at line 39 of file CameraSceneNode.ixx.
Referenced by camera, camera, CameraSceneNode and onWorldTransformUpdate.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.