Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Matrix Class Reference

Matrix manipulation. More...

Public Member Functions

array Create ()
 Creates a 4x4 matrix and sets it to the identity.
void Identity (matrix matrix)
 Sets the matrix to the identity.
void Perspective (matrix matrix, number fov, number near, number far, number aspect)
 Creates a perspective projection matrix.
void Copy (matrix matrixDestination, matrix matrixSource)
 Copies the matrix to the destination.
void Multiply (matrix matrix, matrix a, matrix b)
 Multiplies two matrices.
void Translate (matrix matrix, number x, number y, number z, boolean resetToIdentity=false, boolean actuallyTranslate=false)
 Translates the matrix.
void Scale (matrix matrix, number x, number y, number z)
 Sets the matrix to a scale identity.
void Rotate (matrix matrix, number x, number y, number z)
 Sets the matrix to a rotation identity.

Detailed Description

Matrix manipulation.

Member Function Documentation

◆ Copy()

void Matrix.Copy ( matrix matrixDestination,
matrix matrixSource )

Copies the matrix to the destination.

Parameters
matrixDestinationDestination.
matrixSourceSource.

◆ Create()

array Matrix.Create ( )

Creates a 4x4 matrix and sets it to the identity.

"The model, view and projection matrices are three separate matrices. <br/>Model maps from an object's local coordinate space into world space, <br/>view from world space to view space, projection from camera to screen.<br/><br/>If you compose all three, you can use the one result to map all the way from <br/>object space to screen space, making you able to work out what you need to <br/>pass on to the next stage of a programmable pipeline from the incoming <br/>vertex positions." - Tommy (https://stackoverflow.com/questions/5550620/the-purpose-of-model-view-projection-matrix)

Returns
Returns the matrix as an array.

◆ Identity()

void Matrix.Identity ( matrix matrix)

Sets the matrix to the identity.

Parameters
matrixThe matrix to set to the identity.

◆ Multiply()

void Matrix.Multiply ( matrix matrix,
matrix a,
matrix b )

Multiplies two matrices.

Parameters
matrixThe matrix to output the values to.
aThe first matrix to use for multiplying.
bThe second matrix to use for multiplying.

◆ Perspective()

void Matrix.Perspective ( matrix matrix,
number fov,
number near,
number far,
number aspect )

Creates a perspective projection matrix.

Parameters
matrixThe matrix to generate the projection matrix into.
fovThe field of view, in degrees.
nearThe near clipping plane value.
farThe far clipping plane value.
aspectThe aspect ratio.

◆ Rotate()

void Matrix.Rotate ( matrix matrix,
number x,
number y,
number z )

Sets the matrix to a rotation identity.

Parameters
matrixThe matrix to output the values to.
xX rotation value.
yY rotation value.
zZ rotation value.

◆ Scale()

void Matrix.Scale ( matrix matrix,
number x,
number y,
number z )

Sets the matrix to a scale identity.

Parameters
matrixThe matrix to output the values to.
xX scale value.
yY scale value.
zZ scale value.

◆ Translate()

void Matrix.Translate ( matrix matrix,
number x,
number y,
number z,
boolean resetToIdentity = false,
boolean actuallyTranslate = false )

Translates the matrix.

Parameters
matrixThe matrix to output the values to.
xX position value.
yY position value.
zZ position value.
resetToIdentityWhether to calculate the translation values based on the matrix.
actuallyTranslateAdds the translation components to the matrix instead of overwriting them (Preserves older code functionality, please fix me!).