Clutter Engine 0.0.1
Loading...
Searching...
No Matches
Matrix4Row Struct Reference

4x4 matrix class with row-major storage. Provides common matrix operations for 3D graphics. More...

#include <Matrix4Row.h>

Public Member Functions

 Matrix4Row ()
 Default constructor. Initializes to identity matrix.
 
 Matrix4Row (float inMat[4][4])
 Constructs a matrix from a 2D float array.
 
const float * GetAsFloatPtr () const
 Returns a pointer to the first element as a float pointer.
 
Matrix4Rowoperator*= (const Matrix4Row &right)
 Multiplies this matrix by another matrix.
 
Matrix4Row Inverse () const
 Returns the inverse of this matrix.
 
Vector3 GetTranslation () const
 Gets the translation component of the matrix.
 
Vector3 GetXAxis () const
 Gets the X axis (first row) as a normalized vector.
 
Vector3 GetYAxis () const
 Gets the Y axis (second row) as a normalized vector.
 
Vector3 GetZAxis () const
 Gets the Z axis (third row) as a normalized vector.
 
Vector3 GetScale () const
 Gets the scale component of the matrix.
 

Static Public Member Functions

static Matrix4Row CreateScale (float xScale, float yScale, float zScale)
 Creates a scale matrix.
 
static Matrix4Row InvertMatrix (const Matrix4Row &mat)
 Inverts a matrix (static version).
 
static Matrix4Row CreateScale (const Vector3 &scaleVector)
 Creates a scale matrix from a vector.
 
static Matrix4Row CreateScale (float scale)
 Creates a uniform scale matrix.
 
static Matrix4Row CreateRotationX (float theta)
 Creates a rotation matrix around the X axis.
 
static Matrix4Row CreateRotationY (float theta)
 Creates a rotation matrix around the Y axis.
 
static Matrix4Row CreateRotationZ (float theta)
 Creates a rotation matrix around the Z axis.
 
static Matrix4Row CreateTranslation (const Vector3 &trans)
 Creates a translation matrix.
 
static Matrix4Row CreateSimpleViewProj (float width, float height)
 Creates a simple orthographic view-projection matrix.
 
static Matrix4Row CreateFromQuaternion (const Quaternion &q)
 Creates a rotation matrix from a quaternion.
 
static Matrix4Row CreateLookAt (const Vector3 &eye, const Vector3 &target, const Vector3 &up)
 Creates a look-at view matrix.
 
static Matrix4Row CreateOrtho (float width, float height, float pNear, float pFar)
 Creates an orthographic projection matrix.
 
static Matrix4Row CreatePerspectiveFOV (float fovY, float width, float height, float pNear, float pFar)
 Creates a perspective projection matrix using field of view.
 
static Matrix4Row CreatePerspective (float left, float right, float bottom, float top, float pNear, float pFar)
 Creates a perspective projection matrix.
 

Public Attributes

float mat [4][4]
 The matrix elements in row-major order.
 

Static Public Attributes

static const Matrix4Row Identity
 The identity matrix constant.
 

Friends

Matrix4Row operator* (const Matrix4Row &a, const Matrix4Row &b)
 Matrix multiplication (a * b).
 
Vector3 operator* (const Matrix4Row &mat, const Vector3 &vec)
 Multiplies a matrix by a Vector3 (assumes w=1).
 
Vector4 operator* (const Matrix4Row &mat, const Vector4 &vec)
 Multiplies a matrix by a Vector4.
 

Detailed Description

4x4 matrix class with row-major storage. Provides common matrix operations for 3D graphics.

Constructor & Destructor Documentation

◆ Matrix4Row()

Matrix4Row::Matrix4Row ( float inMat[4][4])
inlineexplicit

Constructs a matrix from a 2D float array.

Parameters
inMat4x4 array of floats.

Member Function Documentation

◆ CreateFromQuaternion()

static Matrix4Row Matrix4Row::CreateFromQuaternion ( const Quaternion & q)
inlinestatic

Creates a rotation matrix from a quaternion.

Parameters
qThe quaternion.
Returns
The rotation matrix.

◆ CreateLookAt()

static Matrix4Row Matrix4Row::CreateLookAt ( const Vector3 & eye,
const Vector3 & target,
const Vector3 & up )
inlinestatic

Creates a look-at view matrix.

Parameters
eyeThe camera position.
targetThe target point.
upThe up direction.
Returns
The look-at matrix.

◆ CreateOrtho()

static Matrix4Row Matrix4Row::CreateOrtho ( float width,
float height,
float pNear,
float pFar )
inlinestatic

Creates an orthographic projection matrix.

Parameters
widthThe width of the view volume.
heightThe height of the view volume.
pNearThe near plane.
pFarThe far plane.
Returns
The orthographic projection matrix.

◆ CreatePerspective()

static Matrix4Row Matrix4Row::CreatePerspective ( float left,
float right,
float bottom,
float top,
float pNear,
float pFar )
inlinestatic

Creates a perspective projection matrix.

Parameters
leftLeft plane.
rightRight plane.
bottomBottom plane.
topTop plane.
pNearNear plane.
pFarFar plane.
Returns
The perspective projection matrix.

◆ CreatePerspectiveFOV()

static Matrix4Row Matrix4Row::CreatePerspectiveFOV ( float fovY,
float width,
float height,
float pNear,
float pFar )
inlinestatic

Creates a perspective projection matrix using field of view.

Parameters
fovYField of view in Y, in radians.
widthThe width of the view.
heightThe height of the view.
pNearThe near plane.
pFarThe far plane.
Returns
The perspective projection matrix.

◆ CreateRotationX()

static Matrix4Row Matrix4Row::CreateRotationX ( float theta)
inlinestatic

Creates a rotation matrix around the X axis.

Parameters
thetaAngle in radians.
Returns
The rotation matrix.

◆ CreateRotationY()

static Matrix4Row Matrix4Row::CreateRotationY ( float theta)
inlinestatic

Creates a rotation matrix around the Y axis.

Parameters
thetaAngle in radians.
Returns
The rotation matrix.

◆ CreateRotationZ()

static Matrix4Row Matrix4Row::CreateRotationZ ( float theta)
inlinestatic

Creates a rotation matrix around the Z axis.

Parameters
thetaAngle in radians.
Returns
The rotation matrix.

◆ CreateScale() [1/3]

static Matrix4Row Matrix4Row::CreateScale ( const Vector3 & scaleVector)
inlinestatic

Creates a scale matrix from a vector.

Parameters
scaleVectorThe scale vector.
Returns
The scale matrix.

◆ CreateScale() [2/3]

static Matrix4Row Matrix4Row::CreateScale ( float scale)
inlinestatic

Creates a uniform scale matrix.

Parameters
scaleThe uniform scale.
Returns
The scale matrix.

◆ CreateScale() [3/3]

static Matrix4Row Matrix4Row::CreateScale ( float xScale,
float yScale,
float zScale )
inlinestatic

Creates a scale matrix.

Parameters
xScaleScale along X.
yScaleScale along Y.
zScaleScale along Z.
Returns
The scale matrix.

◆ CreateSimpleViewProj()

static Matrix4Row Matrix4Row::CreateSimpleViewProj ( float width,
float height )
inlinestatic

Creates a simple orthographic view-projection matrix.

Parameters
widthThe width of the view.
heightThe height of the view.
Returns
The view-projection matrix.

◆ CreateTranslation()

static Matrix4Row Matrix4Row::CreateTranslation ( const Vector3 & trans)
inlinestatic

Creates a translation matrix.

Parameters
transThe translation vector.
Returns
The translation matrix.

◆ GetAsFloatPtr()

const float * Matrix4Row::GetAsFloatPtr ( ) const
inline

Returns a pointer to the first element as a float pointer.

Returns
Pointer to the matrix data.

◆ GetScale()

Vector3 Matrix4Row::GetScale ( ) const
inline

Gets the scale component of the matrix.

Returns
The scale as a Vector3.

◆ GetTranslation()

Vector3 Matrix4Row::GetTranslation ( ) const
inline

Gets the translation component of the matrix.

Returns
The translation as a Vector3.

◆ GetXAxis()

Vector3 Matrix4Row::GetXAxis ( ) const
inline

Gets the X axis (first row) as a normalized vector.

Returns
The X axis.

◆ GetYAxis()

Vector3 Matrix4Row::GetYAxis ( ) const
inline

Gets the Y axis (second row) as a normalized vector.

Returns
The Y axis.

◆ GetZAxis()

Vector3 Matrix4Row::GetZAxis ( ) const
inline

Gets the Z axis (third row) as a normalized vector.

Returns
The Z axis.

◆ Inverse()

Matrix4Row Matrix4Row::Inverse ( ) const

Returns the inverse of this matrix.

Returns
The inverted matrix.
Note
This operation is slow.

◆ InvertMatrix()

static Matrix4Row Matrix4Row::InvertMatrix ( const Matrix4Row & mat)
inlinestatic

Inverts a matrix (static version).

Parameters
matThe matrix to invert.
Returns
The inverted matrix, or identity if not invertible.

◆ operator*=()

Matrix4Row & Matrix4Row::operator*= ( const Matrix4Row & right)
inline

Multiplies this matrix by another matrix.

Parameters
rightThe right-hand matrix.
Returns
Reference to this matrix.

Friends And Related Symbol Documentation

◆ operator* [1/3]

Matrix4Row operator* ( const Matrix4Row & a,
const Matrix4Row & b )
friend

Matrix multiplication (a * b).

Parameters
aLeft matrix.
bRight matrix.
Returns
Resulting matrix.

◆ operator* [2/3]

Vector3 operator* ( const Matrix4Row & mat,
const Vector3 & vec )
friend

Multiplies a matrix by a Vector3 (assumes w=1).

Parameters
matThe matrix.
vecThe vector.
Returns
The transformed Vector3.

◆ operator* [3/3]

Vector4 operator* ( const Matrix4Row & mat,
const Vector4 & vec )
friend

Multiplies a matrix by a Vector4.

Parameters
matThe matrix.
vecThe vector.
Returns
The transformed Vector4.

The documentation for this struct was generated from the following files: