0
|
1 /* ============================================================================
|
|
2 * Freetype GL - A C OpenGL Freetype engine
|
|
3 * Platform: Any
|
|
4 * WWW: http://code.google.com/p/freetype-gl/
|
|
5 * ----------------------------------------------------------------------------
|
|
6 * Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.
|
|
7 *
|
|
8 * Redistribution and use in source and binary forms, with or without
|
|
9 * modification, are permitted provided that the following conditions are met:
|
|
10 *
|
|
11 * 1. Redistributions of source code must retain the above copyright notice,
|
|
12 * this list of conditions and the following disclaimer.
|
|
13 *
|
|
14 * 2. Redistributions in binary form must reproduce the above copyright
|
|
15 * notice, this list of conditions and the following disclaimer in the
|
|
16 * documentation and/or other materials provided with the distribution.
|
|
17 *
|
|
18 * THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER ''AS IS'' AND ANY EXPRESS OR
|
|
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
21 * EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28 *
|
|
29 * The views and conclusions contained in the software and documentation are
|
|
30 * those of the authors and should not be interpreted as representing official
|
|
31 * policies, either expressed or implied, of Nicolas P. Rougier.
|
|
32 * ============================================================================
|
|
33 */
|
|
34 #ifndef __MAT4_H__
|
|
35 #define __MAT4_H__
|
|
36
|
|
37 #ifdef __cplusplus
|
|
38 extern "C" {
|
|
39 #endif
|
|
40
|
|
41
|
|
42 /**
|
|
43 *
|
|
44 */
|
|
45 typedef union
|
|
46 {
|
|
47 float data[16]; /**< All compoments at once */
|
|
48 struct {
|
|
49 float m00, m01, m02, m03;
|
|
50 float m10, m11, m12, m13;
|
|
51 float m20, m21, m22, m23;
|
|
52 float m30, m31, m32, m33;
|
|
53 };
|
|
54 } mat4;
|
|
55
|
|
56
|
|
57 mat4 *
|
|
58 mat4_new( void );
|
|
59
|
|
60 void
|
|
61 mat4_set_identity( mat4 *self );
|
|
62
|
|
63 void
|
|
64 mat4_set_zero( mat4 *self );
|
|
65
|
|
66 void
|
|
67 mat4_multiply( mat4 *self, mat4 *other );
|
|
68
|
|
69 void
|
|
70 mat4_set_orthographic( mat4 *self,
|
|
71 float left, float right,
|
|
72 float bottom, float top,
|
|
73 float znear, float zfar );
|
|
74
|
|
75 void
|
|
76 mat4_set_perspective( mat4 *self,
|
|
77 float fovy, float aspect,
|
|
78 float zNear, float zFar);
|
|
79
|
|
80 void
|
|
81 mat4_set_frustum( mat4 *self,
|
|
82 float left, float right,
|
|
83 float bottom, float top,
|
|
84 float znear, float zfar );
|
|
85
|
|
86 void
|
|
87 mat4_set_rotation( mat4 *self,
|
|
88 float angle,
|
|
89 float x, float y, float z);
|
|
90
|
|
91 void
|
|
92 mat4_set_translation( mat4 *self,
|
|
93 float x, float y, float z);
|
|
94
|
|
95 void
|
|
96 mat4_set_scaling( mat4 *self,
|
|
97 float x, float y, float z);
|
|
98
|
|
99 void
|
|
100 mat4_rotate( mat4 *self,
|
|
101 float angle,
|
|
102 float x, float y, float z);
|
|
103
|
|
104 void
|
|
105 mat4_translate( mat4 *self,
|
|
106 float x, float y, float z);
|
|
107
|
|
108 void
|
|
109 mat4_scale( mat4 *self,
|
|
110 float x, float y, float z);
|
|
111
|
|
112
|
|
113 #ifdef __cplusplus
|
|
114 }
|
|
115 #endif
|
|
116
|
|
117 #endif /* __MAT4_H__ */
|