KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Functions
matrix3d.h File Reference

3D matrix operations. More...

#include <sys/cdefs.h>
#include <dc/matrix.h>

Go to the source code of this file.

Functions

void mat_rotate_x (float r)
 Rotate around the X-axis. More...
 
void mat_rotate_y (float r)
 Rotate around the Y-axis. More...
 
void mat_rotate_z (float r)
 Rotate around the Z-axis. More...
 
void mat_rotate (float xr, float yr, float zr)
 Rotate around all axes. More...
 
void mat_translate (float x, float y, float z)
 Perform a 3D translation. More...
 
void mat_scale (float x, float y, float z)
 Perform a 3D scale operation. More...
 
void mat_perspective (float xcenter, float ycenter, float cot_fovy_2, float znear, float zfar)
 Set up a perspective view frustum. More...
 
void mat_lookat (const point_t *eye, const point_t *center, const vector_t *up)
 Set up a "camera". More...
 

Detailed Description

3D matrix operations.

This file contains various 3D matrix math functionality for using the SH4's matrix transformation unit.

Author
Dan Potter
Jordan DeLong

Function Documentation

void mat_lookat ( const point_t eye,
const point_t center,
const vector_t up 
)

Set up a "camera".

This function acts as the similarly named GL function to set up a "camera" by doing rotations/translations.

Parameters
eyeThe eye coordinate.
centerThe center coordinate.
upThe up vector.
void mat_perspective ( float  xcenter,
float  ycenter,
float  cot_fovy_2,
float  znear,
float  zfar 
)

Set up a perspective view frustum.

This function sets up a perspective view frustum for basic 3D usage.

Parameters
xcenterCenter of the X direction.
ycenterCenter of the Y direction.
cot_fovy_21.0 / tan(view_angle / 2).
znearNear Z-plane.
zfarFar Z-plane.
void mat_rotate ( float  xr,
float  yr,
float  zr 
)

Rotate around all axes.

This function sets up a rotation matrix around the X-axis, then around the Y, then around the Z.

Parameters
xrThe angle to rotate around the X-axis, in radians.
yrThe angle to rotate around the Y-axis, in radians.
zrThe angle to rotate around the Z-axis, in radians.
void mat_rotate_x ( float  r)

Rotate around the X-axis.

This function sets up a rotation matrix around the X-axis.

Parameters
rThe angle to rotate, in radians.
void mat_rotate_y ( float  r)

Rotate around the Y-axis.

This function sets up a rotation matrix around the Y-axis.

Parameters
rThe angle to rotate, in radians.
void mat_rotate_z ( float  r)

Rotate around the Z-axis.

This function sets up a rotation matrix around the Z-axis.

Parameters
rThe angle to rotate, in radians.
void mat_scale ( float  x,
float  y,
float  z 
)

Perform a 3D scale operation.

This function sets up a scaling matrix with the specified parameters.

Parameters
xThe ratio to scale in X.
yThe ratio to scale in Y.
zThe ratio to scale in Z.
void mat_translate ( float  x,
float  y,
float  z 
)

Perform a 3D translation.

This function sets up a translation matrix with the specified parameters.

Parameters
xThe amount to translate in X.
yThe amount to translate in Y.
zThe amount to translate in Z.