Matrix management

Reliquish has a comprehensive projection matrix system that in many ways mirrors the OpenGL 1.x matrix stack. Instead of having a single matrix users can allocate as many matrices as needed and then bind and unbind them for each call. Relinquish also has a default Matrix that can be accessed by bunding matrix NULL. All matrix operations talk a matrix pointer. if this matrix pointer is set to NULL, the currently bound Matrix will be used. Any shader using uniforms of type mat4 with names "NormalMatrix", "ModelViewMatrix", "ProjectionMatrix", and "ModelViewProjectionMatrix" will automaticaly be set in any uniform memory not beeing feed form a pointer of array object. Using the function r_shader_uniform_matrix_set a block of memory beeing prepared to be used as a instance unifom block can have its matrices set from a Relinquish matrix stack.

r_matrix_identity

void r_matrix_identity(RMatrix *matrix);

Description: Clears and initializes the matrix.

r_matrix_push

void r_matrix_push(RMatrix *matrix);

Description: Push the matrix stack one level.

r_matrix_pop

void r_matrix_pop(RMatrix *matrix);

Description: Pops the matrix one level.

r_matrix_matrix_mult

void r_matrix_matrix_mult(RMatrix *matrix, float *mult);

Description: multiplies a 4by4 float matrix with the current matrix.

r_matrix_rotate

void r_matrix_rotate(RMatrix *matrix, float angle, float x, float y, float z);

Description: Rotates the matrix angle degrees around the x, y, and z axis.

r_matrix_scale

void r_matrix_scale(RMatrix *matrix, float x, float y, float z);

Description: Scales the matrix in x, y, and z.

r_matrix_translate

void r_matrix_translate(RMatrix *matrix, float x, float y, float z);

Description: Translates the matrix in x, y, and z.

r_matrix_normalize_scale

void r_matrix_normalize_scale(RMatrix *matrix);

Description: Normalises the scale of the matrix.

r_matrix_frustum

void r_matrix_frustum(RMatrix *matrix, float left, float right, float bottom, float top, float znear, float zfar);

Description: Sets up a frustum for a pespective projection matrix

r_matrix_ortho

void r_matrix_ortho(RMatrix *matrix, float left, float right, float bottom, float top, float znear, float zfar);

Description: Sets up a frustum for a ortogonal projection

r_matrix_set

void r_matrix_set(RMatrix *matrix);

Description: Sets the currently active matrix.

r_matrix_get

RMatrix *r_matrix_get();

Description: Returns a pointer to the currently bound matrix. It will return a pointer to the default matrix if matrix NULL is bound.

r_matrix_projection_screend

void r_matrix_projection_screend(RMatrix *matrix, double *output, double x, double y, double z);

Description: transforms double precission x, y, and z from worldspace coordinates in to screen space coordinates.

r_matrix_projection_screenf

void r_matrix_projection_screenf(RMatrix *matrix, float *output, float x, float y, float z);

Description: transforms single precission x, y, and z from worldspace coordinates in to screen space coordinates.

r_matrix_projection_worldf

void r_matrix_projection_worldf(RMatrix *matrix, float *output, float x, float y, float z);

Description: transforms single precission x, y, and z from screen space coordinates to world corrdinates.

r_matrix_projection_vertexd

void r_matrix_projection_vertexd(RMatrix *matrix, double *output, double *vertex, double x, double y);

Description: transforms double precission screen space x and y at the depth of vertex (in world coordinates), on to world coordinates.

r_matrix_projection_vertexf

void r_matrix_projection_vertexf(RMatrix *matrix, float *output, float *vertex, float x, float y);

Description: transforms single precission screen space x and y at the depth of vertex (in world coordinates), on to world coordinates.

r_matrix_projection_surfacef

boolean r_matrix_projection_surfacef(RMatrix *matrix, float *output, float *pos, uint axis, float x, float y);

r_matrix_projection_axisf

boolean r_matrix_projection_axisf(RMatrix *matrix, float *output, float *pos, uint axis, float x, float y);

r_matrix_projection_vectorf

boolean r_matrix_projection_vectorf(RMatrix *matrix, float *output, float *pos, float *vec, float x, float y);

r_viewport

void r_viewport(uint x_start, uint y_start, uint x_end, uint y_end);

Description: sets, in pixes the view port where Relinquish will draw.