Transform Class
Represents a 3D transformation consisting of translation, rotation and scale. More...
Declaration
Public Constructors Index
| Transform ()=default | |
|
Constructs a new Transform object with the default identity transformation, i.e. scale (1, 1, 1), rotation 4x4_id, translate (0, 0, 0). More... | |
| Transform (const helios::math::mat4f &rotation, helios::math::vec3f scale, helios::math::vec3f translation) noexcept | |
|
Constructs a new Transformation matrix from the specified rotation, scale and translation. More... | |
Public Destructor Index
| ~Transform ()=default | |
Public Member Functions Index
| void | setRotation (const math::mat4f &rotation) noexcept |
|
Sets the rotation component of this Transform. Marks this Transform object as dirty. More... | |
| void | setTranslation (const math::vec3f &translation) noexcept |
|
Sets the translation component of this Transform. Marks this Transform object as dirty. More... | |
| void | setScale (const math::vec3f &scale) noexcept |
|
Sets the scale component of this Transform. Marks this Transform object as dirty. More... | |
| helios::math::mat4f | rotation () const noexcept |
|
Returns the current rotation component of this Transform object. More... | |
| helios::math::vec3f | translation () const noexcept |
|
Returns the current translation component of this Transform object. More... | |
| helios::math::vec3f | scaling () const noexcept |
|
Returns the current scale component of this Transform object. More... | |
| helios::math::mat4f | transform () const noexcept |
|
Returns the 4x4 transformation matrix combined from scale, rotation, and translation. More... | |
| bool | needsUpdate () const noexcept |
|
Checks whether this Transform needs to be updated, e.g. because the various components changed. More... | |
Private Member Functions Index
| helios::math::mat4f | updateCache () const |
|
Internal helper function to compute the full 4x4 affine transformation matrix. More... | |
Private Member Attributes Index
| bool | needsUpdate_ = true |
|
Flag indicating whether this Transform needs to recompute its transformation matrix. More... | |
| helios::math::mat4f | rotation_ = helios::math::mat4f::identity() |
|
The rotation component of the transformation, stored as a 4x4 matrix. More... | |
| helios::math::vec3f | scale_ = helios::math::vec3f(1) |
|
The scaling component of the transformation, stored as a 3D vector. More... | |
| helios::math::vec3f | translation_ = helios::math::vec3f(0) |
|
The translation component of the transformation, stored as a 3D vector. More... | |
| helios::math::mat4f | cached_ = helios::math::mat4f::identity() |
|
The cached 4x4 matrix, computed from scale, rotation and translation (in this order: T * (R * S)). More... | |
Description
Represents a 3D transformation consisting of translation, rotation and scale.
This class encapsulates the components of a local transform for SceneNodes. It uses lazy evaluation to compute the final transform. The current scale, translation and rotation is queryable. Changing the transformation is always considered against an "origin" of an object, that is, a 4x4 identity matrix
- Todo
-
use quaternions for rotation
Definition at line 29 of file Transform.ixx.
Public Constructors
Transform()
| default |
Constructs a new Transform object with the default identity transformation, i.e. scale (1, 1, 1), rotation 4x4_id, translate (0, 0, 0).
Definition at line 81 of file Transform.ixx.
Transform()
| inline noexcept |
Constructs a new Transformation matrix from the specified rotation, scale and translation.
- Parameters
-
rotation The initial rotation matrix.
scale The initial scaling vector.
translation The initial translation vector.
Definition at line 90 of file Transform.ixx.
References rotation and translation.
Public Destructor
~Transform()
| default |
Definition at line 75 of file Transform.ixx.
Public Member Functions
needsUpdate()
| inline nodiscard noexcept |
Checks whether this Transform needs to be updated, e.g. because the various components changed.
- Returns
true if this Transform is considered to be dirty, otherwise false.
Definition at line 179 of file Transform.ixx.
rotation()
| inline nodiscard noexcept |
Returns the current rotation component of this Transform object.
- Returns
The current 4x4 rotation matrix.
Definition at line 138 of file Transform.ixx.
Referenced by setRotation and Transform.
scaling()
| inline nodiscard noexcept |
Returns the current scale component of this Transform object.
- Returns
The current 3D scale vector.
Definition at line 156 of file Transform.ixx.
setRotation()
| inline noexcept |
Sets the rotation component of this Transform. Marks this Transform object as dirty.
- Parameters
-
rotation A const ref to the new rotation matrix.
Definition at line 106 of file Transform.ixx.
Reference rotation.
setScale()
| inline noexcept |
Sets the scale component of this Transform. Marks this Transform object as dirty.
- Parameters
-
scale A const ref to the new scale vector.
Definition at line 128 of file Transform.ixx.
setTranslation()
| inline noexcept |
Sets the translation component of this Transform. Marks this Transform object as dirty.
- Parameters
-
translation A const ref to the new translation vector.
Definition at line 117 of file Transform.ixx.
Reference translation.
transform()
| inline nodiscard noexcept |
Returns the 4x4 transformation matrix combined from scale, rotation, and translation.
- Returns
The current 4x4 affine transformation matrix.
Definition at line 165 of file Transform.ixx.
translation()
| inline nodiscard noexcept |
Returns the current translation component of this Transform object.
- Returns
The current 3D translation vector.
Definition at line 147 of file Transform.ixx.
Referenced by setTranslation and Transform.
Private Member Functions
updateCache()
| inline |
Internal helper function to compute the full 4x4 affine transformation matrix.
- Returns
The newly computed transformation matrix.
Definition at line 65 of file Transform.ixx.
Private Member Attributes
cached_
| mutable |
The cached 4x4 matrix, computed from scale, rotation and translation (in this order: T * (R * S)).
Definition at line 57 of file Transform.ixx.
needsUpdate_
| mutable |
Flag indicating whether this Transform needs to recompute its transformation matrix.
Definition at line 36 of file Transform.ixx.
rotation_
|
The rotation component of the transformation, stored as a 4x4 matrix.
Definition at line 41 of file Transform.ixx.
scale_
|
The scaling component of the transformation, stored as a 3D vector.
Definition at line 46 of file Transform.ixx.
translation_
|
The translation component of the transformation, stored as a 3D vector.
Definition at line 51 of file Transform.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.