Represents a 3D transformation with position, rotation, and scale. More...
#include <Transform.h>
Public Member Functions | |
Transform () | |
Default constructor - creates identity transform. | |
Transform (const Vec3 &position) | |
Constructor with position. | |
Transform (const Vec3 &position, const Vec3 &rotation, const Vec3 &scale) | |
Constructor with position, rotation, and scale. | |
const Vec3 & | GetPosition () const |
const Vec3 & | GetRotation () const |
const Vec3 & | GetScale () const |
const Vec3 & | GetPivot () const |
void | SetPosition (const Vec3 &position) |
void | SetRotation (const Vec3 &rotation) |
void | SetScale (const Vec3 &scale) |
void | SetScale (float uniformScale) |
void | SetPivot (const Vec3 &pivot) |
void | SetMeshCenter (const Vec3 &meshCenter) |
void | SetRelativePivot (const Vec3 &meshCenter, const Vec3 &relativePivot=Vec3(0.0f, 0.0f, 0.0f)) |
Sets the pivot based on mesh bounds, where (0,0,0) represents the mesh center. | |
void | Translate (const Vec3 &translation) |
void | Rotate (const Vec3 &rotation) |
void | Scale (const Vec3 &scale) |
void | Scale (float uniformScale) |
void | TranslateLocal (const Vec3 &localTranslation) |
Translates the object along its local axes. | |
void | TranslateLocalX (float distance) |
Translates the object along its local X axis. | |
void | TranslateLocalY (float distance) |
Translates the object along its local Y axis. | |
void | TranslateLocalZ (float distance) |
Translates the object along its local Z axis. | |
Vec3 | GetLocalRight () const |
Gets the local X axis (right vector) of the object. | |
Vec3 | GetLocalUp () const |
Gets the local Y axis (up vector) of the object. | |
Vec3 | GetLocalForward () const |
Gets the local Z axis (forward vector) of the object. | |
Mat4 | GetMatrix () const |
Gets the transformation matrix. | |
Mat4 | GetInverseMatrix () const |
Gets the inverse transformation matrix. | |
void | Reset () |
Resets transform to identity. | |
Represents a 3D transformation with position, rotation, and scale.
The Transform class encapsulates 3D transformations including translation, rotation (using Euler angles), and uniform/non-uniform scaling. It provides methods to compute transformation matrices and manipulate the transform.
Transform::Transform | ( | ) |
Default constructor - creates identity transform.
Transform::Transform | ( | const Vec3 & | position | ) |
Constructor with position.
position | Initial position. |
Constructor with position, rotation, and scale.
position | Initial position. |
rotation | Initial rotation in degrees (Euler angles). |
scale | Initial scale. |
Mat4 Transform::GetInverseMatrix | ( | ) | const |
Gets the inverse transformation matrix.
Vec3 Transform::GetLocalForward | ( | ) | const |
Gets the local Z axis (forward vector) of the object.
Vec3 Transform::GetLocalRight | ( | ) | const |
Gets the local X axis (right vector) of the object.
Vec3 Transform::GetLocalUp | ( | ) | const |
Gets the local Y axis (up vector) of the object.
Mat4 Transform::GetMatrix | ( | ) | const |
Gets the transformation matrix.
|
inline |
|
inline |
|
inline |
|
inline |
void Transform::Reset | ( | ) |
Resets transform to identity.
void Transform::Rotate | ( | const Vec3 & | rotation | ) |
void Transform::Scale | ( | const Vec3 & | scale | ) |
void Transform::Scale | ( | float | uniformScale | ) |
void Transform::SetMeshCenter | ( | const Vec3 & | meshCenter | ) |
void Transform::SetPivot | ( | const Vec3 & | pivot | ) |
void Transform::SetPosition | ( | const Vec3 & | position | ) |
void Transform::SetRelativePivot | ( | const Vec3 & | meshCenter, |
const Vec3 & | relativePivot = Vec3(0.0f, 0.0f, 0.0f) |
||
) |
Sets the pivot based on mesh bounds, where (0,0,0) represents the mesh center.
meshCenter | The center point of the mesh. |
relativePivot | The relative pivot offset from center (0,0,0 = center). |
void Transform::SetRotation | ( | const Vec3 & | rotation | ) |
void Transform::SetScale | ( | const Vec3 & | scale | ) |
void Transform::SetScale | ( | float | uniformScale | ) |
void Transform::Translate | ( | const Vec3 & | translation | ) |
void Transform::TranslateLocal | ( | const Vec3 & | localTranslation | ) |
Translates the object along its local axes.
localTranslation | Translation vector in local space (relative to object's rotation). |
void Transform::TranslateLocalX | ( | float | distance | ) |
Translates the object along its local X axis.
distance | Distance to move along local X axis. |
void Transform::TranslateLocalY | ( | float | distance | ) |
Translates the object along its local Y axis.
distance | Distance to move along local Y axis. |
void Transform::TranslateLocalZ | ( | float | distance | ) |
Translates the object along its local Z axis.
distance | Distance to move along local Z axis. |