RML::Matrix4 struct

A matrix 4.

Public static functions

static auto identity() -> Matrix4
Gets an identity Matrix4.
static auto orthographic(float left, float right, float bottom, float top, float near, float far) -> Matrix4
Returns an orthographic matrix.
static auto perspective(float fov, float aspectRatio, float near, float far) -> Matrix4
Returns a perspective matrix.
static auto translation(const Vector3D& translation) -> Matrix4
Returns a translation matrix, which translates by amounts defined by the translation vector parameter.
static auto rotation(float angle, const Vector3D& axis) -> Matrix4
Returns a rotation matrix, which rotates by amount defined by angle parameter about the axis defined by the axis parameter.
static auto scale(const Vector3D scale) -> Matrix4
Returns a scaling matrix, that scales by amounts defined by scale parameter.

Constructors, destructors, conversion operators

Matrix4()
Default constructor.
Matrix4(float diagonal)
Constructor. Initialises Matrix4 with a diagonal matrix.

Public functions

auto multiply(const Matrix4& other) -> Matrix4&
Multiplies the given other.
auto multiply(const Vector3D& vector) -> Vector3D
Multiplies the given Vector3D.
auto operator*=(const Matrix4& other) -> Matrix4&
Multiplication assignment operator.

Public variables

float elements
The elements[4 * 4].
Vector4D columns
The columns[4] in forms of Vector4Ds.

Friends

auto operator<<(std::ostream& stream, const Matrix4& matrix) -> std::ostream&
Put to operator.
auto operator*(Matrix4 left, const Matrix4& right) -> Matrix4
Multiplication operator.

Function documentation

static Matrix4 RML::Matrix4::identity()

Gets an identity Matrix4.

Returns A Matrix4.

static Matrix4 RML::Matrix4::orthographic(float left, float right, float bottom, float top, float near, float far)

Returns an orthographic matrix.

Parameters
left The left parameter.
right The right parameter.
bottom The bottom parameter.
top The top parameter.
near The near parameter.
far The far parameter.
Returns A Matrix4.

static Matrix4 RML::Matrix4::perspective(float fov, float aspectRatio, float near, float far)

Returns a perspective matrix.

Parameters
fov The field of view.
aspectRatio The aspect ratio.
near The near parameter.
far The far parameter.
Returns A Matrix4.

static Matrix4 RML::Matrix4::translation(const Vector3D& translation)

Returns a translation matrix, which translates by amounts defined by the translation vector parameter.

Parameters
translation The translation vector.
Returns A Matrix4.

static Matrix4 RML::Matrix4::rotation(float angle, const Vector3D& axis)

Returns a rotation matrix, which rotates by amount defined by angle parameter about the axis defined by the axis parameter.

Parameters
angle The angle(in degree) to be rotated by.
axis The axis to be rotated about.
Returns A Matrix4.

static Matrix4 RML::Matrix4::scale(const Vector3D scale)

Returns a scaling matrix, that scales by amounts defined by scale parameter.

Parameters
scale The scale vector.
Returns A Matrix4.

RML::Matrix4::Matrix4(float diagonal)

Constructor. Initialises Matrix4 with a diagonal matrix.

Parameters
diagonal The diagonal.

Matrix4& RML::Matrix4::multiply(const Matrix4& other)

Multiplies the given other.

Parameters
other The other.
Returns A reference to a Matrix4.

Vector3D RML::Matrix4::multiply(const Vector3D& vector)

Multiplies the given Vector3D.

Parameters
vector The Vector3D to multiply.
Returns The Vector3D result.

Matrix4& RML::Matrix4::operator*=(const Matrix4& other)

Multiplication assignment operator.

Parameters
other The other.
Returns The result of the operation.

std::ostream& operator<<(std::ostream& stream, const Matrix4& matrix)

Put to operator.

Parameters
stream The output stream.
matrix The matrix to be put to stream.
Returns The result of the operation.

Matrix4 operator*(Matrix4 left, const Matrix4& right)

Multiplication operator.

Parameters
left The first value.
right A matrix to multiply to it.
Returns The result of the operation.