Transform2
A 2D transformation class supporting translation, scaling, and rotation.
Internally manages position, scale, rotation, and center of transformation. Lazily computes the final transformation matrix when accessed.
Properties
rotation float
cpp
float rotation { 0.0f }
Rotation angle in radians.
touched bool
cpp
bool touched { true }
Indicates whether the transformation matrix needs to be recomputed.
Functions
Get() auto
cpp
auto vglx::Transform2::Get()
Returns the 3x3 transformation matrix. Lazily recomputes the matrix if any component has changed since last access.
Rotate() auto
cpp
auto vglx::Transform2::Rotate(float angle)
Parameter | Description |
---|---|
angle | Rotation angle in radians. |
Applies a rotation delta to the current rotation.
Scale() auto
cpp
auto vglx::Transform2::Scale(const Vector2 &value)
Parameter | Description |
---|---|
value | Scale factors to apply. |
Applies a scale to the current scale.
SetCenter() auto
cpp
auto vglx::Transform2::SetCenter(const Vector2 ¢er)
Parameter | Description |
---|---|
center | Pivot point in local space. |
Sets the pivot point for rotation and scaling.
SetPosition() auto
cpp
auto vglx::Transform2::SetPosition(const Vector2 &position)
Parameter | Description |
---|---|
position | New position vector. |
Sets the world position of the transform.
SetRotation() auto
cpp
auto vglx::Transform2::SetRotation(float rotation)
Parameter | Description |
---|---|
rotation | Rotation angle in radians. |
Sets the rotation angle of the transform.
SetScale() auto
cpp
auto vglx::Transform2::SetScale(const Vector2 &scale)
Parameter | Description |
---|---|
scale | New scale vector. |
Sets the local scale of the transform.
Translate() auto
cpp
auto vglx::Transform2::Translate(const Vector2 &value)
Parameter | Description |
---|---|
value | Translation vector. |
Applies a translation in local space. If rotation is non-zero, the translation is rotated accordingly.