Transform class

A class that represents a 3D transformation; it can store the same information as a 4x4 matrix, but it's easier to use.

This class stores the location, scale and rotation (as a 3x3 matrix) separately, making it a lot easier to use than a matrix. It does have a method to convert it to a 4x4 matrix, so that it can be used in matematical operations. (NOT YET, TODO!) Transforms can be multiplied in order to concatenate multiple transformations.

Public types

enum TransformFlags { kTransformFlagScale = 1, kTransformFlagRotation = 2, kTransformFlagOffset = 4 }

Constructors, destructors, conversion operators


Public functions

auto GetOffset() const -> const Vector3&
auto SetOffset(const Vector3& value) -> Transform&
auto SetOffset(float x, float y, float z) -> Transform&
auto GetScale() const -> float
auto SetScale(float value) -> Transform&
auto GetRotation() const -> const Matrix3&
auto SetRotation(const Matrix3& value) -> Transform&
auto SetRotation(const Vector3& euler) -> Transform&
auto ToMatrix4() const -> Matrix4
auto operator=(const Transform& other) -> Transform&

Protected variables

int16_t mnFlags
int16_t mnTransformCount
Vector3 mOffset
float mfScale
Matrix3 mRotation