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