A class representing a 3D transformation with position, rotation, and scale. More...
#include <Transform.hpp>
Public Member Functions | |
Transform () | |
Default constructor for the Transform class. | |
virtual | ~Transform ()=default |
Virtual destructor for the Transform class. | |
void | set_position (const vec3 &pos) |
Sets the position of the object. | |
vec3 | get_position () const |
Gets the current position of the object. | |
void | set_rotation (const vec3 &rot) |
Moves the object by a specified vector. | |
vec3 | get_rotation () const |
Gets the current rotation of the object. | |
void | rotate (const float angle, const vec3 &axis) |
Rotates the object by a specified angle around a given axis. | |
void | set_scale (const vec3 &scale) |
Sets the scale of the object. | |
vec3 | get_scale () const |
Sets the scale of the object uniformly. | |
bool | is_dirty () const |
Checks if the transformation matrix is dirty (needs recalculation). | |
virtual mat4 | get_transform_matrix () |
Gets the transformation matrix that combines position, rotation, and scale. | |
Protected Attributes | |
vec3 | position |
The position of the object in 3D space. | |
vec3 | rotation |
The rotation of the object in degrees around each axis (x, y, z). | |
vec3 | scale |
The scale of the object in 3D space, default is (1, 1, 1). | |
bool | dirty = true |
Flag indicating whether the transformation matrix needs to be recalculated. | |
Private Attributes | |
mat4 | transform_matrix |
The transformation matrix that combines position, rotation, and scale. | |
A class representing a 3D transformation with position, rotation, and scale.
This class provides methods to set and get the position, rotation, and scale of a 3D object. It also provides a method to get the transformation matrix that combines these transformations.
|
inline |
Default constructor for the Transform class.
Initializes position to (0, 0, 0), rotation to (0, 0, 0), and scale to (1, 1, 1).
|
virtualdefault |
Virtual destructor for the Transform class.
Ensures proper cleanup of derived classes.
|
inline |
Gets the current position of the object.
|
inline |
Gets the current rotation of the object.
|
inline |
Sets the scale of the object uniformly.
scale | The new uniform scale factor. |
|
inlinevirtual |
Gets the transformation matrix that combines position, rotation, and scale.
This method recalculates the transformation matrix if it is dirty.
Reimplemented in Ragot::Node.
|
inline |
Checks if the transformation matrix is dirty (needs recalculation).
|
inline |
Rotates the object by a specified angle around a given axis.
angle | The angle in degrees to rotate. |
axis | The axis around which to rotate, as a vec3. |
|
inline |
Sets the position of the object.
pos | The new position as a vec3. |
|
inline |
Moves the object by a specified vector.
offset | The vector by which to move the object. |
|
inline |
Sets the scale of the object.
scale | The new scale as a vec3. |
|
protected |
Flag indicating whether the transformation matrix needs to be recalculated.
|
protected |
The position of the object in 3D space.
|
protected |
The rotation of the object in degrees around each axis (x, y, z).
|
protected |
The scale of the object in 3D space, default is (1, 1, 1).
|
private |
The transformation matrix that combines position, rotation, and scale.