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,2013 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 __VEC234_H__
|
|
35 #define __VEC234_H__
|
|
36
|
|
37 #ifdef __cplusplus
|
|
38 extern "C" {
|
|
39 #endif
|
|
40
|
|
41
|
|
42 /**
|
|
43 * Tuple of 4 ints.
|
|
44 *
|
|
45 * Each field can be addressed using several aliases:
|
|
46 * - First component: <b>x</b>, <b>r</b>, <b>red</b> or <b>vstart</b>
|
|
47 * - Second component: <b>y</b>, <b>g</b>, <b>green</b> or <b>vcount</b>
|
|
48 * - Third component: <b>z</b>, <b>b</b>, <b>blue</b>, <b>width</b> or <b>istart</b>
|
|
49 * - Fourth component: <b>w</b>, <b>a</b>, <b>alpha</b>, <b>height</b> or <b>icount</b>
|
|
50 *
|
|
51 */
|
|
52 typedef union
|
|
53 {
|
|
54 int data[4]; /**< All compoments at once */
|
|
55 struct {
|
|
56 int x; /**< Alias for first component */
|
|
57 int y; /**< Alias for second component */
|
|
58 int z; /**< Alias for third component */
|
|
59 int w; /**< Alias for fourht component */
|
|
60 };
|
|
61 struct {
|
|
62 int x_; /**< Alias for first component */
|
|
63 int y_; /**< Alias for second component */
|
|
64 int width; /**< Alias for third component */
|
|
65 int height; /**< Alias for fourth component */
|
|
66 };
|
|
67 struct {
|
|
68 int r; /**< Alias for first component */
|
|
69 int g; /**< Alias for second component */
|
|
70 int b; /**< Alias for third component */
|
|
71 int a; /**< Alias for fourth component */
|
|
72 };
|
|
73 struct {
|
|
74 int red; /**< Alias for first component */
|
|
75 int green; /**< Alias for second component */
|
|
76 int blue; /**< Alias for third component */
|
|
77 int alpha; /**< Alias for fourth component */
|
|
78 };
|
|
79 struct {
|
|
80 int vstart; /**< Alias for first component */
|
|
81 int vcount; /**< Alias for second component */
|
|
82 int istart; /**< Alias for third component */
|
|
83 int icount; /**< Alias for fourth component */
|
|
84 };
|
|
85 } ivec4;
|
|
86
|
|
87
|
|
88 /**
|
|
89 * Tuple of 3 ints.
|
|
90 *
|
|
91 * Each field can be addressed using several aliases:
|
|
92 * - First component: <b>x</b>, <b>r</b> or <b>red</b>
|
|
93 * - Second component: <b>y</b>, <b>g</b> or <b>green</b>
|
|
94 * - Third component: <b>z</b>, <b>b</b> or <b>blue</b>
|
|
95 *
|
|
96 */
|
|
97 typedef union
|
|
98 {
|
|
99 int data[3]; /**< All compoments at once */
|
|
100 struct {
|
|
101 int x; /**< Alias for first component */
|
|
102 int y; /**< Alias for second component */
|
|
103 int z; /**< Alias for third component */
|
|
104 };
|
|
105 struct {
|
|
106 int r; /**< Alias for first component */
|
|
107 int g; /**< Alias for second component */
|
|
108 int b; /**< Alias for third component */
|
|
109 };
|
|
110 struct {
|
|
111 int red; /**< Alias for first component */
|
|
112 int green; /**< Alias for second component */
|
|
113 int blue; /**< Alias for third component */
|
|
114 };
|
|
115 } ivec3;
|
|
116
|
|
117
|
|
118 /**
|
|
119 * Tuple of 2 ints.
|
|
120 *
|
|
121 * Each field can be addressed using several aliases:
|
|
122 * - First component: <b>x</b>, <b>s</b> or <b>start</b>
|
|
123 * - Second component: <b>y</b>, <b>t</b> or <b>end</b>
|
|
124 *
|
|
125 */
|
|
126 typedef union
|
|
127 {
|
|
128 int data[2]; /**< All compoments at once */
|
|
129 struct {
|
|
130 int x; /**< Alias for first component */
|
|
131 int y; /**< Alias for second component */
|
|
132 };
|
|
133 struct {
|
|
134 int s; /**< Alias for first component */
|
|
135 int t; /**< Alias for second component */
|
|
136 };
|
|
137 struct {
|
|
138 int start; /**< Alias for first component */
|
|
139 int end; /**< Alias for second component */
|
|
140 };
|
|
141 } ivec2;
|
|
142
|
|
143
|
|
144 /**
|
|
145 * Tuple of 4 floats.
|
|
146 *
|
|
147 * Each field can be addressed using several aliases:
|
|
148 * - First component: <b>x</b>, <b>r</b> or <b>red</b>
|
|
149 * - Second component: <b>y</b>, <b>g</b> or <b>green</b>
|
|
150 * - Third component: <b>z</b>, <b>b</b>, <b>blue</b> or <b>width</b>
|
|
151 * - Fourth component: <b>w</b>, <b>a</b>, <b>alpha</b> or <b>height</b>
|
|
152 */
|
|
153 typedef union
|
|
154 {
|
|
155 float data[4]; /**< All compoments at once */
|
|
156 struct {
|
|
157 float x; /**< Alias for first component */
|
|
158 float y; /**< Alias fo second component */
|
|
159 float z; /**< Alias fo third component */
|
|
160 float w; /**< Alias fo fourth component */
|
|
161 };
|
|
162 struct {
|
|
163 float x_; /**< Alias for first component */
|
|
164 float y_; /**< Alias fo second component */
|
|
165 float width; /**< Alias fo third component */
|
|
166 float height; /**< Alias fo fourth component */
|
|
167 };
|
|
168 struct {
|
|
169 float r; /**< Alias for first component */
|
|
170 float g; /**< Alias fo second component */
|
|
171 float b; /**< Alias fo third component */
|
|
172 float a; /**< Alias fo fourth component */
|
|
173 };
|
|
174 struct {
|
|
175 float red; /**< Alias for first component */
|
|
176 float green; /**< Alias fo second component */
|
|
177 float blue; /**< Alias fo third component */
|
|
178 float alpha; /**< Alias fo fourth component */
|
|
179 };
|
|
180 } vec4;
|
|
181
|
|
182
|
|
183 /**
|
|
184 * Tuple of 3 floats
|
|
185 *
|
|
186 * Each field can be addressed using several aliases:
|
|
187 * - First component: <b>x</b>, <b>r</b> or <b>red</b>
|
|
188 * - Second component: <b>y</b>, <b>g</b> or <b>green</b>
|
|
189 * - Third component: <b>z</b>, <b>b</b> or <b>blue</b>
|
|
190 */
|
|
191 typedef union
|
|
192 {
|
|
193 float data[3]; /**< All compoments at once */
|
|
194 struct {
|
|
195 float x; /**< Alias for first component */
|
|
196 float y; /**< Alias fo second component */
|
|
197 float z; /**< Alias fo third component */
|
|
198 };
|
|
199 struct {
|
|
200 float r; /**< Alias for first component */
|
|
201 float g; /**< Alias fo second component */
|
|
202 float b; /**< Alias fo third component */
|
|
203 };
|
|
204 struct {
|
|
205 float red; /**< Alias for first component */
|
|
206 float green; /**< Alias fo second component */
|
|
207 float blue; /**< Alias fo third component */
|
|
208 };
|
|
209 } vec3;
|
|
210
|
|
211
|
|
212 /**
|
|
213 * Tuple of 2 floats
|
|
214 *
|
|
215 * Each field can be addressed using several aliases:
|
|
216 * - First component: <b>x</b> or <b>s</b>
|
|
217 * - Second component: <b>y</b> or <b>t</b>
|
|
218 */
|
|
219 typedef union
|
|
220 {
|
|
221 float data[2]; /**< All components at once */
|
|
222 struct {
|
|
223 float x; /**< Alias for first component */
|
|
224 float y; /**< Alias for second component */
|
|
225 };
|
|
226 struct {
|
|
227 float s; /**< Alias for first component */
|
|
228 float t; /**< Alias for second component */
|
|
229 };
|
|
230 } vec2;
|
|
231
|
|
232
|
|
233 #ifdef __cplusplus
|
|
234 }
|
|
235 #endif
|
|
236
|
|
237 #endif /* __VEC234_H__ */
|