Chapter 5. Transformation

The transformation system in Reindeer is similar to the one used in OpenGL. There is one mode for each thing that can be transformed. The possible modes are model-view and projection. Each mode has an associated current matrix, and a stack of previous matrices saved for later use. The current matrix is the one used in transformation calculations.

The current model-view matrix is used to transform vertex positions and normals. The projection matrix is used together with the viewport coordinates (specified with ren_viewport) to transform 3D coordinates to window coordinates.

RenTransformMode

REN_TRANSFORM_MODE_MODELVIEW
REN_TRANSFORM_MODE_PROJECTION

Represents a transform mode.

void ren_transform_mode( RenReindeer r,
  RenTransformMode mode);
 

Set the current transform mode to mode. This makes the following functions manipulate the current matrix and matrix stack associated with this mode.

void ren_transform_push( RenReindeer* r);
 

Push the current matrix to the matrix stack. The current matrix is not affected.

void ren_transform_pop( RenReindeer* r);
 

Pop the matrix stack and sets the current matrix to the retrieved matrix.

void ren_transform_set( RenReindeer r,
  RenMatrix* matrix);
 

Set the current matrix to the value of matrix.

void ren_transform_mul( RenReindeer* r,
  RenMatrix* matrix);
 

Multiply the current matrix with the value of matrix and set the current matrix to the result.

void ren_transform_identity( RenReindeer* r);
 

Set the current matrix to be the identity matrix.