Functions related to transforming matrix and vector structures.
zmlMatrix zmlTranslated(zmlMatrix mat, zmlVector vec)mat the matrix to base the translation matrix off of.vec the vector to use as the transformation factor.
Produces a 4x4 translation matrix from a given matrix mat and the desired 3D vector vec.
For an alternative that modifies mat rather than returning a new matrix, see zmlTranslate().
vec must be of size 3 and the matrix mat must be 4x4.
void zmlTranslate(zmlMatrix *mat, zmlVector vec)mat the matrix to base the translation matrix off of.vec the vector to use as the transformation factor.
Modifies the given matrix mat so it can be used as a 4x4 translation matrix,
using vector vec as the translation factor.
vec must be of size 3 and the matrix mat must be 4x4.
zmlMatrix zmlTranslateIdentity(zmlVector vec)vec the vector to use as the transformation factor.Produces a 4x4 translation matrix from an identity matrix.
This function returns a new heap-allocated matrix, which must be freed after use with a call to zmlFreeMatrix(). The vectorvec must be of size 3 and the matrix mat must be 4x4.
zmlMatrix zmlRotated(zmlMatrix mat, floating angle, floating x, floating y, floating z)
mat the matrix to base the rotation matrix on.angle the angle to rotate the specified axes by. Expressed in radians.x the multiplier for the X axis of rotation (set to 0 if you don't want X rotation).y the multiplier for the Y axis of rotation (set to 0 if you don't want Y rotation).z the multiplier for the Z axis of rotation (set to 0 if you don't want Z rotation).
Produces a 4x4 rotation matrix from a given matrix mat and the desired angle angle.
The matrix is rotated based on the given axes (x, y, and z multipliers).
For an alternative that modifies mat rather than returning a new matrix, see zmlRotate().
vec must be of size 3 and the matrix mat must be 4x4.
void zmlRotate(zmlMatrix *mat, floating angle, floating x, floating y, floating z)mat the matrix to modify.angle the angle to rotate the specified axes by. Expressed in radians.x the multiplier for the X axis of rotation (set to 0 if you don't want X rotation).y the multiplier for the Y axis of rotation (set to 0 if you don't want Y rotation).z the multiplier for the Z axis of rotation (set to 0 if you don't want Z rotation).
Modifies the given matrix mat so it can be used as a 4x4 rotation matrix, using the desired angle angle.
The matrix is rotated based on the given axes (x, y, and z multipliers).
vec must be of size 3 and the matrix mat must be 4x4.
zmlMatrix zmlRotateIdentity(floating angle, floating x, floating y, floating z)
angle the angle to rotate the specified axes by. Expressed in radians.x the multiplier for the X axis of rotation (set to 0 if you don't want X rotation).y the multiplier for the Y axis of rotation (set to 0 if you don't want Y rotation).z the multiplier for the Z axis of rotation (set to 0 if you don't want Z rotation).
Produces a 4x4 rotation matrix from a new identity matrix and the desired angle angle.
The matrix is rotated based on the given axes (x, y, and z multipliers).
vec must be of size 3 and the matrix mat must be 4x4.
zmlMatrix zmlScaled(zmlMatrix mat, zmlVector vec)mat the matrix to base the scale matrix off of.vec the vector to use as the scale factor.
Produces a 4x4 scale matrix from a given matrix mat and the desired 3D vector vec.
For an alternative that modifies mat rather than returning a new matrix, see zmlScale().
vec must be of size 3 and the matrix mat must be 4x4.
void zmlScale(zmlMatrix *mat, zmlVector vec)mat the matrix to base the scale matrix off of.vec the vector to use as the scale factor.Modifies the given matrix mat so it can be used as a 4x4 scale matrix, using vector vec as the scale factor.
vec must be of size 3 and the matrix mat must be 4x4.
zmlMatrix zmlScaleIdentity(zmlVector vec)vec the vector to use as the scale factor.Produces a 4x4 scale matrix from a new identity matrix and the desired 3D vector vec.
vec must be of size 3 and the matrix mat must be 4x4.
zmlMatrix zmlConstructOrthoMatrix{LH|RH}(floating lm, floating rm, floating bm,
floating tm, floating zn, floating zf)
lm the left-most boundary.rm the right-most boundary.bm the bottom-most boundary.tm the top-most boundary.zn the nearest Z coordinate that will be rendered.zf the farthest Z coordinate that will be rendered.Allocates and initialises an orthographic projection matrix based on the given values.
zmlConstructOrthoMatrixLH(): for left-handed coordinate systemszmlConstructOrthoMatrixRH(): for right-handed coordinate systemsvoid zmlUpdateOrthoMatrix{LH|RH}(zmlMatrix *mat, floating lm, floating rm, floating bm,
floating tm, floating zn, floating zf)
mat the matrix to modify.lm the left-most boundary.rm the right-most boundary.bm the bottom-most boundary.tm the top-most boundary.zn the nearest Z coordinate that will be rendered.zf the farthest Z coordinate that will be rendered.Modifies an existing orthographic matrix based on the given values; an alternative to zmlConstructOrthoMatrix() that doesn't allocate any new memory.
zmlUpdateOrthoMatrixLH(): for left-handed coordinate systemszmlUpdateOrthoMatrixRH(): for right-handed coordinate systemszmlMatrix zmlConstructPerspectiveMatrix{LH|RH}(floating lm, floating rm,
floating bm, floating tm, floating zn, floating zf)
near specifies the distance from the viewer to the nearest clipping plane.far specifies the distance from the viewer to the farthest clipping plane.fovy the angle of the field of view in the y direction. Expressed in radians!aspect_ratio the aspect ratio of the viewport.Allocates and initialises an perspective projection matrix based on the given values.
zmlConstructPerspectiveMatrixLH(): for left-handed coordinate systemszmlConstructPerspectiveMatrixRH(): for right-handed coordinate systemsvoid zmlUpdatePerspectiveMatrix{LH|RH}(zmlMatrix *mat, floating lm, floating rm,
floating bm, floating tm, floating zn, floating zf)
mat the matrix to modify.near specifies the distance from the viewer to the nearest clipping plane.far specifies the distance from the viewer to the farthest clipping plane.fovy the angle of the field of view in the y direction. Expressed in radians!aspect_ratio the aspect ratio of the viewport.Modifies an existing orthographic matrix based on the given values; an alternative to zmlConstructPerspectiveMatrix() that doesn't allocate any new memory.
zmlUpdatePerspectiveMatrixLH(): for left-handed coordinate systemszmlUpdatePerspectiveMatrixRH(): for right-handed coordinate systemszmlMatrix zmlConstructLookAtMatrix{LH|RH}(zmlVector pos, zmlVector focus, zmlVector up)pos the position of the viewer/camera.focus the position the viewer/camera is looking at.up an absolute unit vector indicating the up direction. If Y is the 'up' axis, set this to be ( 0, 1, 0 ), for example.Allocates and initialises a new look-at matrix based on the given values.
zmlConstructLookAtMatrixLH(): for left-handed coordinate systemszmlConstructLookAtMatrixRH(): for right-handed coordinate systemsvoid zmlUpdateLookAtMatrix{LH|RH}(zmlMatrix *mat, zmlVector pos, zmlVector focus, zmlVector up)mat the matrix to modify.pos the position of the viewer/camera.focus the position the viewer/camera is looking at.up an absolute unit vector indicating the up direction. If Y is the 'up' axis, set this to be ( 0, 1, 0 ), for example.Modifies an existing look-at matrix based on the given values; an alternative to zmlConstructLookAtMatrix() that doesn't allocate any new memory.
zmlUpdateLookAtMatrixLH(): for left-handed coordinate systemszmlUpdateLookAtMatrixRH(): for right-handed coordinate systems