Level H Engine
Public Member Functions | Public Attributes | List of all members
Mat4 Struct Reference

Contains the Mat4 structure with functions and overloaded operators. This is row major. More...

#include <Mat4.h>

Collaboration diagram for Mat4:
Collaboration graph

Public Member Functions

 Mat4 ()
 Constructs the Mat4 setting the values of the matrix to 0. More...
 
 Mat4 (Vec4 v1, Vec4 v2, Vec4 v3, Vec4 v4)
 Constructs the Mat4 setting the values to the input vectors. More...
 
Mat4operator+= (Mat4 mIn)
 Overloads the += operator. More...
 
Mat4operator-= (Mat4 mIn)
 Overloads the -= operator. More...
 
void setAsIdentityMatrix ()
 Sets the values of the matrix to that of a identity matrix. More...
 
void setAsPerspectiveMatrix (float fovy, float aspect, float n, float f)
 Sets the values of the matrix to that of a Perspective matrix. More...
 
void setAsOrthogonalProjectionMatrix (float w, float h, float n, float f)
 Sets the values of the matrix to that of a Orthogonal Projection matrix. More...
 
void setPos (Vec3 pv)
 Sets the position of the matrix using the input vector. More...
 
void setPos (Mat4 &matrix, Vec3 pos)
 
void scale (Mat4 &matrix, float sv)
 Scales the matrix using the input vector. More...
 
void scale (Mat4 &matrix, Vec3 &sv)
 Scales the matrix using the input vector. More...
 
void translate (Mat4 &matrix, Vec3 tv)
 Translates the matrix using the input vector. More...
 
void rotate (Mat4 &matrix, Vec3 angle)
 Rotate the matrix using the angle of rotation along the axis. More...
 
void rotateAlongX (Mat4 &matrix, float angle)
 Rotate the matrix using the angle of rotation along the x axis. More...
 
void rotateAlongY (Mat4 &matrix, float angle)
 Rotate the matrix using the angle of rotation along the y axis. More...
 
void rotateAlongZ (Mat4 &matrix, float angle)
 Rotate the matrix using the angle of rotation along the z axis. More...
 
void rotatePointAroundXAxis (Mat4 &matrix, Vec3 axisPoint, float angle)
 Rotate the matrix around a point using the angle of rotation along the x axis. More...
 
void rotatePointAroundYAxis (Mat4 &matrix, Vec3 axisPoint, float angle)
 Rotate the matrix around a point using the angle of rotation along the y axis. More...
 
void rotatePointAroundZAxis (Mat4 &matrix, Vec3 axisPoint, float angle)
 Rotate the matrix around a point using the angle of rotation along the z axis. More...
 
void getInverse (Mat4 &matrix)
 A function to get the inverse of a matrix. More...
 
Vec3 getPos ()
 Gets the position of the matrix. More...
 
float * getMatrixArray ()
 A function to get a pointer to the first index of the array. More...
 

Public Attributes

float m [16]
 

Detailed Description

Contains the Mat4 structure with functions and overloaded operators. This is row major.

Constructor & Destructor Documentation

◆ Mat4() [1/2]

Mat4::Mat4 ( )
inline

Constructs the Mat4 setting the values of the matrix to 0.

◆ Mat4() [2/2]

Mat4::Mat4 ( Vec4  v1,
Vec4  v2,
Vec4  v3,
Vec4  v4 
)
inline

Constructs the Mat4 setting the values to the input vectors.

Parameters
v1The first inputed vector.
v2The second inputed vector.
v3The third inputed vector.
v4The forth inputed vector.

Member Function Documentation

◆ getInverse()

void Mat4::getInverse ( Mat4 matrix)

A function to get the inverse of a matrix.

Parameters
matrixA pointer to the matrix to invert.
Here is the caller graph for this function:

◆ getMatrixArray()

float* Mat4::getMatrixArray ( )
inline

A function to get a pointer to the first index of the array.

Returns
A pointer to the first index of the array.
Here is the caller graph for this function:

◆ getPos()

Vec3 Mat4::getPos ( )
inline

Gets the position of the matrix.

Returns
pv The position of the matrix as a vec3.

◆ operator+=()

Mat4* Mat4::operator+= ( Mat4  mIn)
inline

Overloads the += operator.

Parameters
vecInThe input Mat4.
Returns
The new matrix.

◆ operator-=()

Mat4* Mat4::operator-= ( Mat4  mIn)
inline

Overloads the -= operator.

Parameters
vecInThe input Mat4.
Returns
The new matrix.

◆ rotate()

void Mat4::rotate ( Mat4 matrix,
Vec3  angle 
)

Rotate the matrix using the angle of rotation along the axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angles to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotateAlongX()

void Mat4::rotateAlongX ( Mat4 matrix,
float  angle 
)

Rotate the matrix using the angle of rotation along the x axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angle to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotateAlongY()

void Mat4::rotateAlongY ( Mat4 matrix,
float  angle 
)

Rotate the matrix using the angle of rotation along the y axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angle to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotateAlongZ()

void Mat4::rotateAlongZ ( Mat4 matrix,
float  angle 
)

Rotate the matrix using the angle of rotation along the z axis.

Parameters
matrixA pointer to the matrix to rotate.
angleThe angle to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotatePointAroundXAxis()

void Mat4::rotatePointAroundXAxis ( Mat4 matrix,
Vec3  axisPoint,
float  angle 
)

Rotate the matrix around a point using the angle of rotation along the x axis.

Parameters
matrixA pointer to the matrix to rotate.
axisPointThe point to rtate around.
angleThe angle to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotatePointAroundYAxis()

void Mat4::rotatePointAroundYAxis ( Mat4 matrix,
Vec3  axisPoint,
float  angle 
)

Rotate the matrix around a point using the angle of rotation along the y axis.

Parameters
matrixA pointer to the matrix to rotate.
axisPointThe point to rtate around.
angleThe angle to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotatePointAroundZAxis()

void Mat4::rotatePointAroundZAxis ( Mat4 matrix,
Vec3  axisPoint,
float  angle 
)

Rotate the matrix around a point using the angle of rotation along the z axis.

Parameters
matrixA pointer to the matrix to rotate.
axisPointThe point to rtate around.
angleThe angle to rotate the matrix by, must be a Radian.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale() [1/2]

void Mat4::scale ( Mat4 matrix,
float  sv 
)

Scales the matrix using the input vector.

Parameters
matrixA pointer to the matrix to scale.
sVThe scale vector vec3 to scale the matrix by.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale() [2/2]

void Mat4::scale ( Mat4 matrix,
Vec3 sv 
)

Scales the matrix using the input vector.

Parameters
matrixA pointer to the matrix to scale.
sVThe scale vector vec3 to scale the matrix by.
Here is the call graph for this function:

◆ setAsIdentityMatrix()

void Mat4::setAsIdentityMatrix ( )
inline

Sets the values of the matrix to that of a identity matrix.

Here is the caller graph for this function:

◆ setAsOrthogonalProjectionMatrix()

void Mat4::setAsOrthogonalProjectionMatrix ( float  w,
float  h,
float  n,
float  f 
)
inline

Sets the values of the matrix to that of a Orthogonal Projection matrix.

Parameters
wThe width of the area to view.
hThe height of the area to view.
fThe z plane which is the furthest the view can see.
nThe z plane which is the closest the view can see.

◆ setAsPerspectiveMatrix()

void Mat4::setAsPerspectiveMatrix ( float  fovy,
float  aspect,
float  n,
float  f 
)
inline

Sets the values of the matrix to that of a Perspective matrix.

Parameters
fovyThe field of view on the y axis.
aThe aspect.
fThe z plane which is far from the camera.
nThe z plane closer to the camera.
Here is the caller graph for this function:

◆ setPos() [1/2]

void Mat4::setPos ( Vec3  pv)
inline

Sets the position of the matrix using the input vector.

Parameters
pvThe position vector vec3 to set the matrix position.
Here is the call graph for this function:

◆ setPos() [2/2]

void Mat4::setPos ( Mat4 matrix,
Vec3  pos 
)
Here is the call graph for this function:

◆ translate()

void Mat4::translate ( Mat4 matrix,
Vec3  tv 
)

Translates the matrix using the input vector.

Parameters
matrixA pointer to the matrix to rotate.
tvThe translation vector vec3 to set the matrix position.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m

float Mat4::m[16]

matrix variables [00]x [01]y [02]z [03]w [04]x [05]y [06]z [07]w [08]x [09]y [10]z [11]w [12]x [13]y [14]z [15]w


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