KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
matrix3d.h
Go to the documentation of this file.
1 /* KallistiOS 2.0.0
2 
3  matrix3d.h
4  (c)2000 Dan Potter and Jordan DeLong
5 
6 */
7 
8 /** \file dc/matrix3d.h
9  \brief 3D matrix operations.
10 
11  This file contains various 3D matrix math functionality for using the SH4's
12  matrix transformation unit.
13 
14  \author Dan Potter
15  \author Jordan DeLong
16 */
17 
18 #ifndef __KOS_MATRIX3D_H
19 #define __KOS_MATRIX3D_H
20 
21 #include <sys/cdefs.h>
22 __BEGIN_DECLS
23 
24 #include <dc/matrix.h>
25 
26 /** \brief Rotate around the X-axis.
27 
28  This function sets up a rotation matrix around the X-axis.
29 
30  \param r The angle to rotate, in radians.
31 */
32 void mat_rotate_x(float r);
33 
34 /** \brief Rotate around the Y-axis.
35 
36  This function sets up a rotation matrix around the Y-axis.
37 
38  \param r The angle to rotate, in radians.
39 */
40 void mat_rotate_y(float r);
41 
42 /** \brief Rotate around the Z-axis.
43 
44  This function sets up a rotation matrix around the Z-axis.
45 
46  \param r The angle to rotate, in radians.
47 */
48 void mat_rotate_z(float r);
49 
50 /** \brief Rotate around all axes.
51 
52  This function sets up a rotation matrix around the X-axis, then around the
53  Y, then around the Z.
54 
55  \param xr The angle to rotate around the X-axis, in radians.
56  \param yr The angle to rotate around the Y-axis, in radians.
57  \param zr The angle to rotate around the Z-axis, in radians.
58 */
59 void mat_rotate(float xr, float yr, float zr);
60 
61 /** \brief Perform a 3D translation.
62 
63  This function sets up a translation matrix with the specified parameters.
64 
65  \param x The amount to translate in X.
66  \param y The amount to translate in Y.
67  \param z The amount to translate in Z.
68 */
69 void mat_translate(float x, float y, float z);
70 
71 /** \brief Perform a 3D scale operation.
72 
73  This function sets up a scaling matrix with the specified parameters.
74 
75  \param x The ratio to scale in X.
76  \param y The ratio to scale in Y.
77  \param z The ratio to scale in Z.
78 */
79 void mat_scale(float x, float y, float z);
80 
81 /** \brief Set up a perspective view frustum.
82 
83  This function sets up a perspective view frustum for basic 3D usage.
84 
85  \param xcenter Center of the X direction.
86  \param ycenter Center of the Y direction.
87  \param cot_fovy_2 1.0 / tan(view_angle / 2).
88  \param znear Near Z-plane.
89  \param zfar Far Z-plane.
90 */
91 void mat_perspective(float xcenter, float ycenter, float cot_fovy_2,
92  float znear, float zfar);
93 
94 /** \brief Set up a "camera".
95 
96  This function acts as the similarly named GL function to set up a "camera"
97  by doing rotations/translations.
98 
99  \param eye The eye coordinate.
100  \param center The center coordinate.
101  \param up The up vector.
102 */
103 void mat_lookat(const point_t * eye, const point_t * center, const vector_t * up);
104 
105 __END_DECLS
106 
107 #endif /* __KOS_MATRIX3D_H */
108 
109