Transform3
Internally manages position, scale, and rotation in Euler angles. Lazily computes the final transformation matrix when accessed.
Properties
touched bool
bool touched { true }
Indicates whether the transformation matrix needs to be recomputed.
Functions
Get() auto
auto vglx::Transform3::Get()
Returns the 4x4 transformation matrix. Lazily recomputes the matrix if any component has changed since last access.
LookAt() auto
auto vglx::Transform3::LookAt(const Vector3 &position, const Vector3 &target, const Vector3 &world_up)
Parameter | Description |
---|---|
position | Position of the object. |
target | Target point to look at. |
world_up | World up direction. |
Sets the rotation such that the object looks at the given target. Computes the Euler rotation needed to look from position
to target
, using the given world-up vector to determine orientation.
Rotate() auto
auto vglx::Transform3::Rotate(const Vector3 &axis, float angle)
Parameter | Description |
---|---|
axis | Axis to rotate around (Right, Up, or Forward). |
angle | Rotation angle in radians. |
Applies a rotation around a specific axis. Only cardinal axes (X, Y, Z) are supported.
Scale() auto
auto vglx::Transform3::Scale(const Vector3 &value)
Parameter | Description |
---|---|
value | Scale factors to apply. |
Applies a scale to the current scale.
SetPosition() auto
auto vglx::Transform3::SetPosition(const Vector3 &position)
Parameter | Description |
---|---|
position | New position vector. |
Sets the world position of the transform.
SetRotation() auto
auto vglx::Transform3::SetRotation(const Euler &rotation)
Parameter | Description |
---|---|
rotation | New Euler rotation. |
Sets the rotation of the transform.
SetScale() auto
auto vglx::Transform3::SetScale(const Vector3 &scale)
Parameter | Description |
---|---|
scale | New scale vector. |
Sets the local scale of the transform.
Translate() auto
auto vglx::Transform3::Translate(const Vector3 &value)
Parameter | Description |
---|---|
value | Translation vector. |
Applies a translation in local space. If rotation is non-zero, the translation is rotated accordingly.