Transform3
Transform3 represents a 3D transform combining translation, non-uniform scaling, and quaternion-based rotation. It lazily builds a Matrix4 suitable for use as a world transform in scene graphs and rendering code.
Properties
rotation Quaternion
Rotation stored as a unit quaternion.
Quaternion rotation {};touched bool
Dirty flag indicating the cached matrix needs to be recomputed.
bool touched {true};Functions
Returns the 4×4 transform matrix.
Recomputes the underlying matrix if any component has changed since the last call, then returns the cached Matrix4.
Matrix4 Transform3::Get();Returns the rotation as Euler angles.
Provided as a convenience for inspection; the conversion is lossy near gimbal lock and only resolves angles within the Euler reconstruction range. The quaternion remains the authoritative representation.
Euler Transform3::GetEuler() const;LookAt() void
Sets the rotation such that the object looks at a target point.
Computes an orientation that looks from position toward target, using world_up to resolve roll and construct a stable basis.
void Transform3::LookAt(const Vector3& position, const Vector3& target, const Vector3& world_up);| Parameter | Description |
|---|---|
| position | Object position. |
| target | Target point to look at. |
| world_up | World up direction. |
Rotate() void
Applies an additional rotation around an axis in local space.
The rotation is composed after the current orientation, so the axis is interpreted in the transform's local frame.
void Transform3::Rotate(const Vector3& axis, float angle);| Parameter | Description |
|---|---|
| axis | Rotation axis; normalized internally. |
| angle | Rotation angle in radians. |
Scale() void
Scales the transform.
void Transform3::Scale(const Vector3& value);| Parameter | Description |
|---|---|
| value | Scale factors to apply. |
SetPosition() void
Sets the translation component.
void Transform3::SetPosition(const Vector3& position);| Parameter | Description |
|---|---|
| position | New position. |
SetRotation() void
Sets the rotation component from Euler angles.
Provided as a convenience; the angles are converted to and stored as a quaternion.
void Transform3::SetRotation(const Euler& rotation);| Parameter | Description |
|---|---|
| rotation | New Euler rotation. |
SetRotation() void
Sets the rotation component.
void Transform3::SetRotation(const Quaternion& rotation);| Parameter | Description |
|---|---|
| rotation | New rotation quaternion. |
SetScale() void
Sets the scale component.
void Transform3::SetScale(const Vector3& scale);| Parameter | Description |
|---|---|
| scale | New scale factors. |
Translate() void
Translates the transform a distance along an axis in local space.
Convenience overload mirroring Rotate. The axis is normalized internally, so distance is a true distance along it. For an arbitrary offset, use the single-vector overload instead.
void Transform3::Translate(const Vector3& axis, float distance);| Parameter | Description |
|---|---|
| axis | Translation axis; normalized internally. |
| distance | Distance to translate along the axis. |