1 | /* $Id: xform_tmp.h,v 1.3 2000-05-23 20:35:00 jeroen Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.1
|
---|
6 | *
|
---|
7 | * Copyright (C) 1999 Brian Paul All Rights Reserved.
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
10 | * copy of this software and associated documentation files (the "Software"),
|
---|
11 | * to deal in the Software without restriction, including without limitation
|
---|
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
13 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included
|
---|
17 | * in all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
25 | */
|
---|
26 |
|
---|
27 | /*
|
---|
28 | * New (3.1) transformation code written by Keith Whitwell.
|
---|
29 | */
|
---|
30 |
|
---|
31 |
|
---|
32 | /*----------------------------------------------------------------------
|
---|
33 | * Begin Keith's new code
|
---|
34 | *
|
---|
35 | *----------------------------------------------------------------------
|
---|
36 | */
|
---|
37 |
|
---|
38 | /* KW: Fixed stride, now measured in bytes as is the OpenGL array stride.
|
---|
39 | */
|
---|
40 |
|
---|
41 | /* KW: These are now parameterized to produce two versions, one
|
---|
42 | * which transforms all incoming points, and a second which
|
---|
43 | * takes notice of a cullmask array, and only transforms
|
---|
44 | * unculled vertices.
|
---|
45 | */
|
---|
46 |
|
---|
47 | /* KW: 1-vectors can sneak into the texture pipeline via the array
|
---|
48 | * interface. These functions are here because I want consistant
|
---|
49 | * treatment of the vertex sizes and a lazy strategy for
|
---|
50 | * cleaning unused parts of the vector, and so as not to exclude
|
---|
51 | * them from the vertex array interface.
|
---|
52 | *
|
---|
53 | * Under our current analysis of matrices, there is no way that
|
---|
54 | * the product of a matrix and a 1-vector can remain a 1-vector,
|
---|
55 | * with the exception of the identity transform.
|
---|
56 | */
|
---|
57 |
|
---|
58 | /* KW: No longer zero-pad outgoing vectors. Now that external
|
---|
59 | * vectors can get into the pipeline we cannot ever assume
|
---|
60 | * that there is more to a vector than indicated by its
|
---|
61 | * size.
|
---|
62 | */
|
---|
63 |
|
---|
64 | /* KW: Now uses clipmask and a flag to allow us to skip both/either
|
---|
65 | * cliped and/or culled vertices.
|
---|
66 | */
|
---|
67 |
|
---|
68 | static void _XFORMAPI TAG(transform_points1_general)( GLvector4f *to_vec,
|
---|
69 | const GLmatrix *mat,
|
---|
70 | const GLvector4f *from_vec,
|
---|
71 | const GLubyte *mask,
|
---|
72 | const GLubyte flag )
|
---|
73 | {
|
---|
74 | const GLuint stride = from_vec->stride;
|
---|
75 | GLfloat *from = from_vec->start;
|
---|
76 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
77 | GLuint count = from_vec->count;
|
---|
78 | const GLfloat *m = mat->m;
|
---|
79 | const GLfloat m0 = m[0], m12 = m[12];
|
---|
80 | const GLfloat m1 = m[1], m13 = m[13];
|
---|
81 | const GLfloat m2 = m[2], m14 = m[14];
|
---|
82 | const GLfloat m3 = m[3], m15 = m[15];
|
---|
83 | GLuint i;
|
---|
84 | (void) mask;
|
---|
85 | (void) flag;
|
---|
86 | STRIDE_LOOP {
|
---|
87 | CLIP_CHECK {
|
---|
88 | const GLfloat ox = from[0];
|
---|
89 | to[i][0] = m0 * ox + m12;
|
---|
90 | to[i][1] = m1 * ox + m13;
|
---|
91 | to[i][2] = m2 * ox + m14;
|
---|
92 | to[i][3] = m3 * ox + m15;
|
---|
93 | }
|
---|
94 | }
|
---|
95 |
|
---|
96 | to_vec->size = 4;
|
---|
97 | to_vec->flags |= VEC_SIZE_4;
|
---|
98 | to_vec->count = from_vec->count;
|
---|
99 | }
|
---|
100 |
|
---|
101 | static void _XFORMAPI TAG(transform_points1_identity)( GLvector4f *to_vec,
|
---|
102 | const GLmatrix *mat,
|
---|
103 | const GLvector4f *from_vec,
|
---|
104 | const GLubyte *mask,
|
---|
105 | const GLubyte flag )
|
---|
106 | {
|
---|
107 | const GLuint stride = from_vec->stride;
|
---|
108 | GLfloat *from = from_vec->start;
|
---|
109 | GLuint count = from_vec->count;
|
---|
110 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
111 | GLuint i;
|
---|
112 | (void) mat;
|
---|
113 | (void) mask;
|
---|
114 | (void) flag;
|
---|
115 | ASSERT(mat->type == MATRIX_IDENTITY);
|
---|
116 | if (to_vec == from_vec) return;
|
---|
117 | STRIDE_LOOP {
|
---|
118 | CLIP_CHECK {
|
---|
119 | to[i][0] = from[0];
|
---|
120 | }
|
---|
121 | }
|
---|
122 |
|
---|
123 | to_vec->size = 1;
|
---|
124 | to_vec->flags |= VEC_SIZE_1;
|
---|
125 | to_vec->count = from_vec->count;
|
---|
126 | }
|
---|
127 |
|
---|
128 | static void _XFORMAPI TAG(transform_points1_2d)( GLvector4f *to_vec,
|
---|
129 | const GLmatrix *mat,
|
---|
130 | const GLvector4f *from_vec,
|
---|
131 | const GLubyte *mask,
|
---|
132 | const GLubyte flag )
|
---|
133 | {
|
---|
134 | const GLuint stride = from_vec->stride;
|
---|
135 | GLfloat *from = from_vec->start;
|
---|
136 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
137 | GLuint count = from_vec->count;
|
---|
138 | const GLfloat *m = mat->m;
|
---|
139 | const GLfloat m0 = m[0], m1 = m[1];
|
---|
140 | const GLfloat m12 = m[12], m13 = m[13];
|
---|
141 | GLuint i;
|
---|
142 | (void) mask;
|
---|
143 | (void) flag;
|
---|
144 | ASSERT(mat->type == MATRIX_2D);
|
---|
145 | STRIDE_LOOP {
|
---|
146 | CLIP_CHECK {
|
---|
147 | const GLfloat ox = from[0];
|
---|
148 | to[i][0] = m0 * ox + m12;
|
---|
149 | to[i][1] = m1 * ox + m13;
|
---|
150 | }
|
---|
151 | }
|
---|
152 | to_vec->size = 2;
|
---|
153 | to_vec->flags |= VEC_SIZE_2;
|
---|
154 | to_vec->count = from_vec->count;
|
---|
155 | }
|
---|
156 |
|
---|
157 | static void _XFORMAPI TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
|
---|
158 | const GLmatrix *mat,
|
---|
159 | const GLvector4f *from_vec,
|
---|
160 | const GLubyte *mask,
|
---|
161 | const GLubyte flag )
|
---|
162 | {
|
---|
163 | const GLuint stride = from_vec->stride;
|
---|
164 | GLfloat *from = from_vec->start;
|
---|
165 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
166 | GLuint count = from_vec->count;
|
---|
167 | const GLfloat *m = mat->m;
|
---|
168 | const GLfloat m0 = m[0], m12 = m[12], m13 = m[13];
|
---|
169 | GLuint i;
|
---|
170 | (void) mask;
|
---|
171 | (void) flag;
|
---|
172 | ASSERT(mat->type == MATRIX_2D_NO_ROT);
|
---|
173 | STRIDE_LOOP {
|
---|
174 | CLIP_CHECK {
|
---|
175 | const GLfloat ox = from[0];
|
---|
176 | to[i][0] = m0 * ox + m12;
|
---|
177 | to[i][1] = m13;
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 | to_vec->size = 2;
|
---|
182 | to_vec->flags |= VEC_SIZE_2;
|
---|
183 | to_vec->count = from_vec->count;
|
---|
184 | }
|
---|
185 |
|
---|
186 | static void _XFORMAPI TAG(transform_points1_3d)( GLvector4f *to_vec,
|
---|
187 | const GLmatrix *mat,
|
---|
188 | const GLvector4f *from_vec,
|
---|
189 | const GLubyte *mask,
|
---|
190 | const GLubyte flag )
|
---|
191 | {
|
---|
192 | const GLuint stride = from_vec->stride;
|
---|
193 | GLfloat *from = from_vec->start;
|
---|
194 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
195 | GLuint count = from_vec->count;
|
---|
196 | const GLfloat *m = mat->m;
|
---|
197 | const GLfloat m0 = m[0], m1 = m[1], m2 = m[2];
|
---|
198 | const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
199 | GLuint i;
|
---|
200 | (void) mask;
|
---|
201 | (void) flag;
|
---|
202 | ASSERT(mat->type == MATRIX_3D);
|
---|
203 | STRIDE_LOOP {
|
---|
204 | CLIP_CHECK {
|
---|
205 | const GLfloat ox = from[0];
|
---|
206 | to[i][0] = m0 * ox + m12;
|
---|
207 | to[i][1] = m1 * ox + m13;
|
---|
208 | to[i][2] = m2 * ox + m14;
|
---|
209 | }
|
---|
210 | }
|
---|
211 | to_vec->size = 3;
|
---|
212 | to_vec->flags |= VEC_SIZE_3;
|
---|
213 | to_vec->count = from_vec->count;
|
---|
214 | }
|
---|
215 |
|
---|
216 |
|
---|
217 | static void _XFORMAPI TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
|
---|
218 | const GLmatrix *mat,
|
---|
219 | const GLvector4f *from_vec,
|
---|
220 | const GLubyte *mask,
|
---|
221 | const GLubyte flag )
|
---|
222 | {
|
---|
223 | const GLuint stride = from_vec->stride;
|
---|
224 | GLfloat *from = from_vec->start;
|
---|
225 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
226 | GLuint count = from_vec->count;
|
---|
227 | const GLfloat *m = mat->m;
|
---|
228 | const GLfloat m0 = m[0];
|
---|
229 | const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
230 | GLuint i;
|
---|
231 | (void) mask;
|
---|
232 | (void) flag;
|
---|
233 | ASSERT(mat->type == MATRIX_3D_NO_ROT);
|
---|
234 | STRIDE_LOOP {
|
---|
235 | CLIP_CHECK {
|
---|
236 | const GLfloat ox = from[0];
|
---|
237 | to[i][0] = m0 * ox + m12;
|
---|
238 | to[i][1] = m13;
|
---|
239 | to[i][2] = m14;
|
---|
240 | }
|
---|
241 | }
|
---|
242 | to_vec->size = 3;
|
---|
243 | to_vec->flags |= VEC_SIZE_3;
|
---|
244 | to_vec->count = from_vec->count;
|
---|
245 | }
|
---|
246 |
|
---|
247 | static void _XFORMAPI TAG(transform_points1_perspective)( GLvector4f *to_vec,
|
---|
248 | const GLmatrix *mat,
|
---|
249 | const GLvector4f *from_vec,
|
---|
250 | const GLubyte *mask,
|
---|
251 | const GLubyte flag )
|
---|
252 | {
|
---|
253 | const GLuint stride = from_vec->stride;
|
---|
254 | GLfloat *from = from_vec->start;
|
---|
255 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
256 | GLuint count = from_vec->count;
|
---|
257 | const GLfloat *m = mat->m;
|
---|
258 | const GLfloat m0 = m[0], m14 = m[14];
|
---|
259 | GLuint i;
|
---|
260 | (void) mask;
|
---|
261 | (void) flag;
|
---|
262 | ASSERT(mat->type == MATRIX_PERSPECTIVE);
|
---|
263 | STRIDE_LOOP {
|
---|
264 | CLIP_CHECK {
|
---|
265 | const GLfloat ox = from[0];
|
---|
266 | to[i][0] = m0 * ox ;
|
---|
267 | to[i][1] = 0 ;
|
---|
268 | to[i][2] = m14;
|
---|
269 | to[i][3] = 0;
|
---|
270 | }
|
---|
271 | }
|
---|
272 | to_vec->size = 4;
|
---|
273 | to_vec->flags |= VEC_SIZE_4;
|
---|
274 | to_vec->count = from_vec->count;
|
---|
275 | }
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 | /* 2-vectors, which are a lot more relevant than 1-vectors, are
|
---|
281 | * present early in the geometry pipeline and throughout the
|
---|
282 | * texture pipeline.
|
---|
283 | */
|
---|
284 | static void _XFORMAPI TAG(transform_points2_general)( GLvector4f *to_vec,
|
---|
285 | const GLmatrix *mat,
|
---|
286 | const GLvector4f *from_vec,
|
---|
287 | const GLubyte *mask,
|
---|
288 | const GLubyte flag )
|
---|
289 | {
|
---|
290 | const GLuint stride = from_vec->stride;
|
---|
291 | GLfloat *from = from_vec->start;
|
---|
292 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
293 | GLuint count = from_vec->count;
|
---|
294 | const GLfloat *m = mat->m;
|
---|
295 | const GLfloat m0 = m[0], m4 = m[4], m12 = m[12];
|
---|
296 | const GLfloat m1 = m[1], m5 = m[5], m13 = m[13];
|
---|
297 | const GLfloat m2 = m[2], m6 = m[6], m14 = m[14];
|
---|
298 | const GLfloat m3 = m[3], m7 = m[7], m15 = m[15];
|
---|
299 | GLuint i;
|
---|
300 | (void) mask;
|
---|
301 | (void) flag;
|
---|
302 | STRIDE_LOOP {
|
---|
303 | CLIP_CHECK {
|
---|
304 | const GLfloat ox = from[0], oy = from[1];
|
---|
305 | to[i][0] = m0 * ox + m4 * oy + m12;
|
---|
306 | to[i][1] = m1 * ox + m5 * oy + m13;
|
---|
307 | to[i][2] = m2 * ox + m6 * oy + m14;
|
---|
308 | to[i][3] = m3 * ox + m7 * oy + m15;
|
---|
309 | }
|
---|
310 | }
|
---|
311 | to_vec->size = 4;
|
---|
312 | to_vec->flags |= VEC_SIZE_4;
|
---|
313 | to_vec->count = from_vec->count;
|
---|
314 | }
|
---|
315 |
|
---|
316 | static void _XFORMAPI TAG(transform_points2_identity)( GLvector4f *to_vec,
|
---|
317 | const GLmatrix *mat,
|
---|
318 | const GLvector4f *from_vec,
|
---|
319 | const GLubyte *mask,
|
---|
320 | const GLubyte flag )
|
---|
321 | {
|
---|
322 | const GLuint stride = from_vec->stride;
|
---|
323 | GLfloat *from = from_vec->start;
|
---|
324 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
325 | GLuint count = from_vec->count;
|
---|
326 | GLuint i;
|
---|
327 | (void) mat;
|
---|
328 | (void) mask;
|
---|
329 | (void) flag;
|
---|
330 | ASSERT(mat->type == MATRIX_IDENTITY);
|
---|
331 | if (to_vec == from_vec) return;
|
---|
332 | STRIDE_LOOP {
|
---|
333 | CLIP_CHECK {
|
---|
334 | to[i][0] = from[0];
|
---|
335 | to[i][1] = from[1];
|
---|
336 | }
|
---|
337 | }
|
---|
338 | to_vec->size = 2;
|
---|
339 | to_vec->flags |= VEC_SIZE_2;
|
---|
340 | to_vec->count = from_vec->count;
|
---|
341 | }
|
---|
342 |
|
---|
343 | static void _XFORMAPI TAG(transform_points2_2d)( GLvector4f *to_vec,
|
---|
344 | const GLmatrix *mat,
|
---|
345 | const GLvector4f *from_vec,
|
---|
346 | const GLubyte *mask,
|
---|
347 | const GLubyte flag )
|
---|
348 | {
|
---|
349 | const GLuint stride = from_vec->stride;
|
---|
350 | GLfloat *from = from_vec->start;
|
---|
351 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
352 | GLuint count = from_vec->count;
|
---|
353 | const GLfloat *m = mat->m;
|
---|
354 | const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
|
---|
355 | const GLfloat m12 = m[12], m13 = m[13];
|
---|
356 | GLuint i;
|
---|
357 | (void) mask;
|
---|
358 | (void) flag;
|
---|
359 | ASSERT(mat->type == MATRIX_2D);
|
---|
360 | STRIDE_LOOP {
|
---|
361 | CLIP_CHECK {
|
---|
362 | const GLfloat ox = from[0], oy = from[1];
|
---|
363 | to[i][0] = m0 * ox + m4 * oy + m12;
|
---|
364 | to[i][1] = m1 * ox + m5 * oy + m13;
|
---|
365 | }
|
---|
366 | }
|
---|
367 |
|
---|
368 | to_vec->size = 2;
|
---|
369 | to_vec->flags |= VEC_SIZE_2;
|
---|
370 | to_vec->count = from_vec->count;
|
---|
371 | }
|
---|
372 |
|
---|
373 | static void _XFORMAPI TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
|
---|
374 | const GLmatrix *mat,
|
---|
375 | const GLvector4f *from_vec,
|
---|
376 | const GLubyte *mask,
|
---|
377 | const GLubyte flag )
|
---|
378 | {
|
---|
379 | const GLuint stride = from_vec->stride;
|
---|
380 | GLfloat *from = from_vec->start;
|
---|
381 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
382 | GLuint count = from_vec->count;
|
---|
383 | const GLfloat *m = mat->m;
|
---|
384 | const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
|
---|
385 | GLuint i;
|
---|
386 | (void) mask;
|
---|
387 | (void) flag;
|
---|
388 | ASSERT(mat->type == MATRIX_2D_NO_ROT);
|
---|
389 | STRIDE_LOOP {
|
---|
390 | CLIP_CHECK {
|
---|
391 | const GLfloat ox = from[0], oy = from[1];
|
---|
392 | to[i][0] = m0 * ox + m12;
|
---|
393 | to[i][1] = m5 * oy + m13;
|
---|
394 | }
|
---|
395 | }
|
---|
396 |
|
---|
397 | to_vec->size = 2;
|
---|
398 | to_vec->flags |= VEC_SIZE_2;
|
---|
399 | to_vec->count = from_vec->count;
|
---|
400 | }
|
---|
401 |
|
---|
402 | static void _XFORMAPI TAG(transform_points2_3d)( GLvector4f *to_vec,
|
---|
403 | const GLmatrix *mat,
|
---|
404 | const GLvector4f *from_vec,
|
---|
405 | const GLubyte *mask,
|
---|
406 | const GLubyte flag )
|
---|
407 | {
|
---|
408 | const GLuint stride = from_vec->stride;
|
---|
409 | GLfloat *from = from_vec->start;
|
---|
410 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
411 | GLuint count = from_vec->count;
|
---|
412 | const GLfloat *m = mat->m;
|
---|
413 | const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
|
---|
414 | const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
415 | GLuint i;
|
---|
416 | (void) mask;
|
---|
417 | (void) flag;
|
---|
418 | ASSERT(mat->type == MATRIX_3D);
|
---|
419 | STRIDE_LOOP {
|
---|
420 | CLIP_CHECK {
|
---|
421 | const GLfloat ox = from[0], oy = from[1];
|
---|
422 | to[i][0] = m0 * ox + m4 * oy + m12;
|
---|
423 | to[i][1] = m1 * ox + m5 * oy + m13;
|
---|
424 | to[i][2] = m2 * ox + m6 * oy + m14;
|
---|
425 | }
|
---|
426 | }
|
---|
427 | to_vec->size = 3;
|
---|
428 | to_vec->flags |= VEC_SIZE_3;
|
---|
429 | to_vec->count = from_vec->count;
|
---|
430 | }
|
---|
431 |
|
---|
432 |
|
---|
433 | /* I would actually say this was a fairly important function, from
|
---|
434 | * a texture transformation point of view.
|
---|
435 | */
|
---|
436 | static void _XFORMAPI TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
|
---|
437 | const GLmatrix *mat,
|
---|
438 | const GLvector4f *from_vec,
|
---|
439 | const GLubyte *mask,
|
---|
440 | const GLubyte flag )
|
---|
441 | {
|
---|
442 | const GLuint stride = from_vec->stride;
|
---|
443 | GLfloat *from = from_vec->start;
|
---|
444 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
445 | GLuint count = from_vec->count;
|
---|
446 | const GLfloat *m = mat->m;
|
---|
447 | const GLfloat m0 = m[0], m5 = m[5];
|
---|
448 | const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
449 | GLuint i;
|
---|
450 | (void) mask;
|
---|
451 | (void) flag;
|
---|
452 | ASSERT(mat->type == MATRIX_3D_NO_ROT);
|
---|
453 | STRIDE_LOOP {
|
---|
454 | CLIP_CHECK {
|
---|
455 | const GLfloat ox = from[0], oy = from[1];
|
---|
456 | to[i][0] = m0 * ox + m12;
|
---|
457 | to[i][1] = m5 * oy + m13;
|
---|
458 | to[i][2] = m14;
|
---|
459 | }
|
---|
460 | }
|
---|
461 | if (m14 == 0) {
|
---|
462 | to_vec->size = 2;
|
---|
463 | to_vec->flags |= VEC_SIZE_2;
|
---|
464 | } else {
|
---|
465 | to_vec->size = 3;
|
---|
466 | to_vec->flags |= VEC_SIZE_3;
|
---|
467 | }
|
---|
468 | to_vec->count = from_vec->count;
|
---|
469 | }
|
---|
470 |
|
---|
471 | /* This may not be called too often, but I wouldn't say it was dead
|
---|
472 | * code. It's also hard to remove any of these functions if you are
|
---|
473 | * attached to the assertions that have appeared in them.
|
---|
474 | */
|
---|
475 | static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec,
|
---|
476 | const GLmatrix *mat,
|
---|
477 | const GLvector4f *from_vec,
|
---|
478 | const GLubyte *mask,
|
---|
479 | const GLubyte flag )
|
---|
480 | {
|
---|
481 | const GLuint stride = from_vec->stride;
|
---|
482 | GLfloat *from = from_vec->start;
|
---|
483 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
484 | GLuint count = from_vec->count;
|
---|
485 | const GLfloat *m = mat->m;
|
---|
486 | const GLfloat m0 = m[0], m5 = m[5], m14 = m[14];
|
---|
487 | GLuint i;
|
---|
488 | (void) mask;
|
---|
489 | (void) flag;
|
---|
490 | ASSERT(mat->type == MATRIX_PERSPECTIVE);
|
---|
491 | STRIDE_LOOP {
|
---|
492 | CLIP_CHECK {
|
---|
493 | const GLfloat ox = from[0], oy = from[1];
|
---|
494 | to[i][0] = m0 * ox ;
|
---|
495 | to[i][1] = m5 * oy ;
|
---|
496 | to[i][2] = m14;
|
---|
497 | to[i][3] = 0;
|
---|
498 | }
|
---|
499 | }
|
---|
500 | to_vec->size = 4;
|
---|
501 | to_vec->flags |= VEC_SIZE_4;
|
---|
502 | to_vec->count = from_vec->count;
|
---|
503 | }
|
---|
504 |
|
---|
505 |
|
---|
506 |
|
---|
507 | static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec,
|
---|
508 | const GLmatrix *mat,
|
---|
509 | const GLvector4f *from_vec,
|
---|
510 | const GLubyte *mask,
|
---|
511 | const GLubyte flag )
|
---|
512 | {
|
---|
513 | const GLuint stride = from_vec->stride;
|
---|
514 | GLfloat *from = from_vec->start;
|
---|
515 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
516 | GLuint count = from_vec->count;
|
---|
517 | const GLfloat *m = mat->m;
|
---|
518 | const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12];
|
---|
519 | const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13];
|
---|
520 | const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14];
|
---|
521 | const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15];
|
---|
522 | GLuint i;
|
---|
523 | (void) mask;
|
---|
524 | (void) flag;
|
---|
525 | ASSERT(mat->type == MATRIX_GENERAL);
|
---|
526 | STRIDE_LOOP {
|
---|
527 | CLIP_CHECK {
|
---|
528 | const GLfloat ox = from[0], oy = from[1], oz = from[2];
|
---|
529 | to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12;
|
---|
530 | to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13;
|
---|
531 | to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14;
|
---|
532 | to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15;
|
---|
533 | }
|
---|
534 | }
|
---|
535 | to_vec->size = 4;
|
---|
536 | to_vec->flags |= VEC_SIZE_4;
|
---|
537 | to_vec->count = from_vec->count;
|
---|
538 | }
|
---|
539 |
|
---|
540 | static void _XFORMAPI TAG(transform_points3_identity)( GLvector4f *to_vec,
|
---|
541 | const GLmatrix *mat,
|
---|
542 | const GLvector4f *from_vec,
|
---|
543 | const GLubyte *mask,
|
---|
544 | const GLubyte flag )
|
---|
545 | {
|
---|
546 | const GLuint stride = from_vec->stride;
|
---|
547 | GLfloat *from = from_vec->start;
|
---|
548 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
549 | GLuint count = from_vec->count;
|
---|
550 | GLuint i;
|
---|
551 | (void) mat;
|
---|
552 | (void) mask;
|
---|
553 | (void) flag;
|
---|
554 | ASSERT(mat->type == MATRIX_IDENTITY);
|
---|
555 | if (to_vec == from_vec) return;
|
---|
556 | STRIDE_LOOP {
|
---|
557 | CLIP_CHECK {
|
---|
558 | to[i][0] = from[0];
|
---|
559 | to[i][1] = from[1];
|
---|
560 | to[i][2] = from[2];
|
---|
561 | }
|
---|
562 | }
|
---|
563 | to_vec->size = 3;
|
---|
564 | to_vec->flags |= VEC_SIZE_3;
|
---|
565 | to_vec->count = from_vec->count;
|
---|
566 | }
|
---|
567 |
|
---|
568 | static void _XFORMAPI TAG(transform_points3_2d)( GLvector4f *to_vec,
|
---|
569 | const GLmatrix *mat,
|
---|
570 | const GLvector4f *from_vec,
|
---|
571 | const GLubyte *mask,
|
---|
572 | const GLubyte flag )
|
---|
573 | {
|
---|
574 | const GLuint stride = from_vec->stride;
|
---|
575 | GLfloat *from = from_vec->start;
|
---|
576 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
577 | GLuint count = from_vec->count;
|
---|
578 | const GLfloat *m = mat->m;
|
---|
579 | const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
|
---|
580 | const GLfloat m12 = m[12], m13 = m[13];
|
---|
581 | GLuint i;
|
---|
582 | (void) mask;
|
---|
583 | (void) flag;
|
---|
584 | ASSERT(mat->type == MATRIX_2D);
|
---|
585 | STRIDE_LOOP {
|
---|
586 | CLIP_CHECK {
|
---|
587 | const GLfloat ox = from[0], oy = from[1], oz = from[2];
|
---|
588 | to[i][0] = m0 * ox + m4 * oy + m12 ;
|
---|
589 | to[i][1] = m1 * ox + m5 * oy + m13 ;
|
---|
590 | to[i][2] = + oz ;
|
---|
591 | }
|
---|
592 | }
|
---|
593 | to_vec->size = 3;
|
---|
594 | to_vec->flags |= VEC_SIZE_3;
|
---|
595 | to_vec->count = from_vec->count;
|
---|
596 | }
|
---|
597 |
|
---|
598 | static void _XFORMAPI TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
|
---|
599 | const GLmatrix *mat,
|
---|
600 | const GLvector4f *from_vec,
|
---|
601 | const GLubyte *mask,
|
---|
602 | const GLubyte flag )
|
---|
603 | {
|
---|
604 | const GLuint stride = from_vec->stride;
|
---|
605 | GLfloat *from = from_vec->start;
|
---|
606 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
607 | GLuint count = from_vec->count;
|
---|
608 | const GLfloat *m = mat->m;
|
---|
609 | const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
|
---|
610 | GLuint i;
|
---|
611 | (void) mask;
|
---|
612 | (void) flag;
|
---|
613 | ASSERT(mat->type == MATRIX_2D_NO_ROT);
|
---|
614 | STRIDE_LOOP {
|
---|
615 | CLIP_CHECK {
|
---|
616 | const GLfloat ox = from[0], oy = from[1], oz = from[2];
|
---|
617 | to[i][0] = m0 * ox + m12 ;
|
---|
618 | to[i][1] = m5 * oy + m13 ;
|
---|
619 | to[i][2] = + oz ;
|
---|
620 | }
|
---|
621 | }
|
---|
622 | to_vec->size = 3;
|
---|
623 | to_vec->flags |= VEC_SIZE_3;
|
---|
624 | to_vec->count = from_vec->count;
|
---|
625 | }
|
---|
626 |
|
---|
627 | static void _XFORMAPI TAG(transform_points3_3d)( GLvector4f *to_vec,
|
---|
628 | const GLmatrix *mat,
|
---|
629 | const GLvector4f *from_vec,
|
---|
630 | const GLubyte *mask,
|
---|
631 | const GLubyte flag )
|
---|
632 | {
|
---|
633 | const GLuint stride = from_vec->stride;
|
---|
634 | GLfloat *from = from_vec->start;
|
---|
635 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
636 | GLuint count = from_vec->count;
|
---|
637 | const GLfloat *m = mat->m;
|
---|
638 | const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
|
---|
639 | const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
|
---|
640 | const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
641 | GLuint i;
|
---|
642 | (void) mask;
|
---|
643 | (void) flag;
|
---|
644 | ASSERT(mat->type == MATRIX_3D);
|
---|
645 | STRIDE_LOOP {
|
---|
646 | CLIP_CHECK {
|
---|
647 | const GLfloat ox = from[0], oy = from[1], oz = from[2];
|
---|
648 | to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ;
|
---|
649 | to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ;
|
---|
650 | to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ;
|
---|
651 | }
|
---|
652 | }
|
---|
653 | to_vec->size = 3;
|
---|
654 | to_vec->flags |= VEC_SIZE_3;
|
---|
655 | to_vec->count = from_vec->count;
|
---|
656 | }
|
---|
657 |
|
---|
658 | /* previously known as ortho...
|
---|
659 | */
|
---|
660 | static void _XFORMAPI TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
|
---|
661 | const GLmatrix *mat,
|
---|
662 | const GLvector4f *from_vec,
|
---|
663 | const GLubyte *mask,
|
---|
664 | const GLubyte flag )
|
---|
665 | {
|
---|
666 | const GLuint stride = from_vec->stride;
|
---|
667 | GLfloat *from = from_vec->start;
|
---|
668 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
669 | GLuint count = from_vec->count;
|
---|
670 | const GLfloat *m = mat->m;
|
---|
671 | const GLfloat m0 = m[0], m5 = m[5];
|
---|
672 | const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
673 | GLuint i;
|
---|
674 | (void) mask;
|
---|
675 | (void) flag;
|
---|
676 | ASSERT(mat->type == MATRIX_3D_NO_ROT);
|
---|
677 | STRIDE_LOOP {
|
---|
678 | CLIP_CHECK {
|
---|
679 | const GLfloat ox = from[0], oy = from[1], oz = from[2];
|
---|
680 | to[i][0] = m0 * ox + m12 ;
|
---|
681 | to[i][1] = m5 * oy + m13 ;
|
---|
682 | to[i][2] = m10 * oz + m14 ;
|
---|
683 | }
|
---|
684 | }
|
---|
685 | to_vec->size = 3;
|
---|
686 | to_vec->flags |= VEC_SIZE_3;
|
---|
687 | to_vec->count = from_vec->count;
|
---|
688 | }
|
---|
689 |
|
---|
690 | static void _XFORMAPI TAG(transform_points3_perspective)( GLvector4f *to_vec,
|
---|
691 | const GLmatrix *mat,
|
---|
692 | const GLvector4f *from_vec,
|
---|
693 | const GLubyte *mask,
|
---|
694 | const GLubyte flag )
|
---|
695 | {
|
---|
696 | const GLuint stride = from_vec->stride;
|
---|
697 | GLfloat *from = from_vec->start;
|
---|
698 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
699 | GLuint count = from_vec->count;
|
---|
700 | const GLfloat *m = mat->m;
|
---|
701 | const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
|
---|
702 | const GLfloat m10 = m[10], m14 = m[14];
|
---|
703 | GLuint i;
|
---|
704 | (void) mask;
|
---|
705 | (void) flag;
|
---|
706 | ASSERT(mat->type == MATRIX_PERSPECTIVE);
|
---|
707 | STRIDE_LOOP {
|
---|
708 | CLIP_CHECK {
|
---|
709 | const GLfloat ox = from[0], oy = from[1], oz = from[2];
|
---|
710 | to[i][0] = m0 * ox + m8 * oz ;
|
---|
711 | to[i][1] = m5 * oy + m9 * oz ;
|
---|
712 | to[i][2] = m10 * oz + m14 ;
|
---|
713 | to[i][3] = -oz ;
|
---|
714 | }
|
---|
715 | }
|
---|
716 | to_vec->size = 4;
|
---|
717 | to_vec->flags |= VEC_SIZE_4;
|
---|
718 | to_vec->count = from_vec->count;
|
---|
719 | }
|
---|
720 |
|
---|
721 |
|
---|
722 |
|
---|
723 | static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec,
|
---|
724 | const GLmatrix *mat,
|
---|
725 | const GLvector4f *from_vec,
|
---|
726 | const GLubyte *mask,
|
---|
727 | const GLubyte flag )
|
---|
728 | {
|
---|
729 | const GLuint stride = from_vec->stride;
|
---|
730 | GLfloat *from = from_vec->start;
|
---|
731 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
732 | GLuint count = from_vec->count;
|
---|
733 | const GLfloat *m = mat->m;
|
---|
734 | const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12];
|
---|
735 | const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13];
|
---|
736 | const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14];
|
---|
737 | const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15];
|
---|
738 | GLuint i;
|
---|
739 | (void) mask;
|
---|
740 | (void) flag;
|
---|
741 | ASSERT(mat->type == MATRIX_GENERAL);
|
---|
742 | STRIDE_LOOP {
|
---|
743 | CLIP_CHECK {
|
---|
744 | const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
|
---|
745 | to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow;
|
---|
746 | to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow;
|
---|
747 | to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
|
---|
748 | to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow;
|
---|
749 | }
|
---|
750 | }
|
---|
751 | to_vec->size = 4;
|
---|
752 | to_vec->flags |= VEC_SIZE_4;
|
---|
753 | to_vec->count = from_vec->count;
|
---|
754 | }
|
---|
755 |
|
---|
756 | static void _XFORMAPI TAG(transform_points4_identity)( GLvector4f *to_vec,
|
---|
757 | const GLmatrix *mat,
|
---|
758 | const GLvector4f *from_vec,
|
---|
759 | const GLubyte *mask,
|
---|
760 | const GLubyte flag )
|
---|
761 | {
|
---|
762 | const GLuint stride = from_vec->stride;
|
---|
763 | GLfloat *from = from_vec->start;
|
---|
764 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
765 | GLuint count = from_vec->count;
|
---|
766 | GLuint i;
|
---|
767 | (void) mat;
|
---|
768 | (void) mask;
|
---|
769 | (void) flag;
|
---|
770 | ASSERT(mat->type == MATRIX_IDENTITY);
|
---|
771 | if (to_vec == from_vec) return;
|
---|
772 | STRIDE_LOOP {
|
---|
773 | CLIP_CHECK {
|
---|
774 | to[i][0] = from[0];
|
---|
775 | to[i][1] = from[1];
|
---|
776 | to[i][2] = from[2];
|
---|
777 | to[i][3] = from[3];
|
---|
778 | }
|
---|
779 | }
|
---|
780 | to_vec->size = 4;
|
---|
781 | to_vec->flags |= VEC_SIZE_4;
|
---|
782 | to_vec->count = from_vec->count;
|
---|
783 | }
|
---|
784 |
|
---|
785 | static void _XFORMAPI TAG(transform_points4_2d)( GLvector4f *to_vec,
|
---|
786 | const GLmatrix *mat,
|
---|
787 | const GLvector4f *from_vec,
|
---|
788 | const GLubyte *mask,
|
---|
789 | const GLubyte flag )
|
---|
790 | {
|
---|
791 | const GLuint stride = from_vec->stride;
|
---|
792 | GLfloat *from = from_vec->start;
|
---|
793 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
794 | GLuint count = from_vec->count;
|
---|
795 | const GLfloat *m = mat->m;
|
---|
796 | const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
|
---|
797 | const GLfloat m12 = m[12], m13 = m[13];
|
---|
798 | GLuint i;
|
---|
799 | (void) mask;
|
---|
800 | (void) flag;
|
---|
801 | ASSERT(mat->type == MATRIX_2D);
|
---|
802 | STRIDE_LOOP {
|
---|
803 | CLIP_CHECK {
|
---|
804 | const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
|
---|
805 | to[i][0] = m0 * ox + m4 * oy + m12 * ow;
|
---|
806 | to[i][1] = m1 * ox + m5 * oy + m13 * ow;
|
---|
807 | to[i][2] = + oz ;
|
---|
808 | to[i][3] = ow;
|
---|
809 | }
|
---|
810 | }
|
---|
811 | to_vec->size = 4;
|
---|
812 | to_vec->flags |= VEC_SIZE_4;
|
---|
813 | to_vec->count = from_vec->count;
|
---|
814 | }
|
---|
815 |
|
---|
816 | static void _XFORMAPI TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
|
---|
817 | const GLmatrix *mat,
|
---|
818 | const GLvector4f *from_vec,
|
---|
819 | const GLubyte *mask,
|
---|
820 | const GLubyte flag )
|
---|
821 | {
|
---|
822 | const GLuint stride = from_vec->stride;
|
---|
823 | GLfloat *from = from_vec->start;
|
---|
824 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
825 | GLuint count = from_vec->count;
|
---|
826 | const GLfloat *m = mat->m;
|
---|
827 | const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
|
---|
828 | GLuint i;
|
---|
829 | (void) mask;
|
---|
830 | (void) flag;
|
---|
831 | ASSERT(mat->type == MATRIX_2D_NO_ROT);
|
---|
832 | STRIDE_LOOP {
|
---|
833 | CLIP_CHECK {
|
---|
834 | const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
|
---|
835 | to[i][0] = m0 * ox + m12 * ow;
|
---|
836 | to[i][1] = m5 * oy + m13 * ow;
|
---|
837 | to[i][2] = + oz ;
|
---|
838 | to[i][3] = ow;
|
---|
839 | }
|
---|
840 | }
|
---|
841 | to_vec->size = 4;
|
---|
842 | to_vec->flags |= VEC_SIZE_4;
|
---|
843 | to_vec->count = from_vec->count;
|
---|
844 | }
|
---|
845 |
|
---|
846 | static void _XFORMAPI TAG(transform_points4_3d)( GLvector4f *to_vec,
|
---|
847 | const GLmatrix *mat,
|
---|
848 | const GLvector4f *from_vec,
|
---|
849 | const GLubyte *mask,
|
---|
850 | const GLubyte flag )
|
---|
851 | {
|
---|
852 | const GLuint stride = from_vec->stride;
|
---|
853 | GLfloat *from = from_vec->start;
|
---|
854 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
855 | GLuint count = from_vec->count;
|
---|
856 | const GLfloat *m = mat->m;
|
---|
857 | const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
|
---|
858 | const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
|
---|
859 | const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
860 | GLuint i;
|
---|
861 | (void) mask;
|
---|
862 | (void) flag;
|
---|
863 | ASSERT(mat->type == MATRIX_3D);
|
---|
864 | STRIDE_LOOP {
|
---|
865 | CLIP_CHECK {
|
---|
866 | const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
|
---|
867 | to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow;
|
---|
868 | to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow;
|
---|
869 | to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
|
---|
870 | to[i][3] = ow;
|
---|
871 | }
|
---|
872 | }
|
---|
873 | to_vec->size = 4;
|
---|
874 | to_vec->flags |= VEC_SIZE_4;
|
---|
875 | to_vec->count = from_vec->count;
|
---|
876 | }
|
---|
877 |
|
---|
878 | static void _XFORMAPI TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
|
---|
879 | const GLmatrix *mat,
|
---|
880 | const GLvector4f *from_vec,
|
---|
881 | const GLubyte *mask,
|
---|
882 | const GLubyte flag )
|
---|
883 | {
|
---|
884 | const GLuint stride = from_vec->stride;
|
---|
885 | GLfloat *from = from_vec->start;
|
---|
886 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
887 | GLuint count = from_vec->count;
|
---|
888 | const GLfloat *m = mat->m;
|
---|
889 | const GLfloat m0 = m[0], m5 = m[5];
|
---|
890 | const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
|
---|
891 | GLuint i;
|
---|
892 | (void) mask;
|
---|
893 | (void) flag;
|
---|
894 | ASSERT(mat->type == MATRIX_3D_NO_ROT);
|
---|
895 | STRIDE_LOOP {
|
---|
896 | CLIP_CHECK {
|
---|
897 | const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
|
---|
898 | to[i][0] = m0 * ox + m12 * ow;
|
---|
899 | to[i][1] = m5 * oy + m13 * ow;
|
---|
900 | to[i][2] = m10 * oz + m14 * ow;
|
---|
901 | to[i][3] = ow;
|
---|
902 | }
|
---|
903 | }
|
---|
904 | to_vec->size = 4;
|
---|
905 | to_vec->flags |= VEC_SIZE_4;
|
---|
906 | to_vec->count = from_vec->count;
|
---|
907 | }
|
---|
908 |
|
---|
909 | static void _XFORMAPI TAG(transform_points4_perspective)( GLvector4f *to_vec,
|
---|
910 | const GLmatrix *mat,
|
---|
911 | const GLvector4f *from_vec,
|
---|
912 | const GLubyte *mask,
|
---|
913 | const GLubyte flag )
|
---|
914 | {
|
---|
915 | const GLuint stride = from_vec->stride;
|
---|
916 | GLfloat *from = from_vec->start;
|
---|
917 | GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
|
---|
918 | GLuint count = from_vec->count;
|
---|
919 | const GLfloat *m = mat->m;
|
---|
920 | const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
|
---|
921 | const GLfloat m10 = m[10], m14 = m[14];
|
---|
922 | GLuint i;
|
---|
923 | (void) mask;
|
---|
924 | (void) flag;
|
---|
925 | ASSERT(mat->type == MATRIX_PERSPECTIVE);
|
---|
926 | STRIDE_LOOP {
|
---|
927 | CLIP_CHECK {
|
---|
928 | const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
|
---|
929 | to[i][0] = m0 * ox + m8 * oz ;
|
---|
930 | to[i][1] = m5 * oy + m9 * oz ;
|
---|
931 | to[i][2] = m10 * oz + m14 * ow ;
|
---|
932 | to[i][3] = -oz ;
|
---|
933 | }
|
---|
934 | }
|
---|
935 |
|
---|
936 | to_vec->size = 4;
|
---|
937 | to_vec->flags |= VEC_SIZE_4;
|
---|
938 | to_vec->count = from_vec->count;
|
---|
939 | }
|
---|
940 |
|
---|
941 | static transform_func /* _XFORMAPI */ TAG(transform_tab_1)[7];
|
---|
942 | static transform_func /* _XFORMAPI */ TAG(transform_tab_2)[7];
|
---|
943 | static transform_func /* _XFORMAPI */ TAG(transform_tab_3)[7];
|
---|
944 | static transform_func /* _XFORMAPI */ TAG(transform_tab_4)[7];
|
---|
945 |
|
---|
946 | /* Similar functions could be called several times, with more highly
|
---|
947 | * optimized routines overwriting the arrays. This only occurs during
|
---|
948 | * startup.
|
---|
949 | */
|
---|
950 | static void _XFORMAPI TAG(init_c_transformations)( void )
|
---|
951 | {
|
---|
952 | #define TAG_TAB gl_transform_tab[IDX]
|
---|
953 | #define TAG_TAB_1 TAG(transform_tab_1)
|
---|
954 | #define TAG_TAB_2 TAG(transform_tab_2)
|
---|
955 | #define TAG_TAB_3 TAG(transform_tab_3)
|
---|
956 | #define TAG_TAB_4 TAG(transform_tab_4)
|
---|
957 |
|
---|
958 | TAG_TAB[1] = TAG_TAB_1;
|
---|
959 | TAG_TAB[2] = TAG_TAB_2;
|
---|
960 | TAG_TAB[3] = TAG_TAB_3;
|
---|
961 | TAG_TAB[4] = TAG_TAB_4;
|
---|
962 |
|
---|
963 | /* 1-D points (ie texcoords) */
|
---|
964 | TAG_TAB_1[MATRIX_GENERAL] = TAG(transform_points1_general);
|
---|
965 | TAG_TAB_1[MATRIX_IDENTITY] = TAG(transform_points1_identity);
|
---|
966 | TAG_TAB_1[MATRIX_3D_NO_ROT] = TAG(transform_points1_3d_no_rot);
|
---|
967 | TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective) ;
|
---|
968 | TAG_TAB_1[MATRIX_2D] = TAG(transform_points1_2d);
|
---|
969 | TAG_TAB_1[MATRIX_2D_NO_ROT] = TAG(transform_points1_2d_no_rot);
|
---|
970 | TAG_TAB_1[MATRIX_3D] = TAG(transform_points1_3d);
|
---|
971 |
|
---|
972 | /* 2-D points */
|
---|
973 | TAG_TAB_2[MATRIX_GENERAL] = TAG(transform_points2_general);
|
---|
974 | TAG_TAB_2[MATRIX_IDENTITY] = TAG(transform_points2_identity);
|
---|
975 | TAG_TAB_2[MATRIX_3D_NO_ROT] = TAG(transform_points2_3d_no_rot);
|
---|
976 | TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective) ;
|
---|
977 | TAG_TAB_2[MATRIX_2D] = TAG(transform_points2_2d);
|
---|
978 | TAG_TAB_2[MATRIX_2D_NO_ROT] = TAG(transform_points2_2d_no_rot);
|
---|
979 | TAG_TAB_2[MATRIX_3D] = TAG(transform_points2_3d);
|
---|
980 |
|
---|
981 | /* 3-D points */
|
---|
982 | TAG_TAB_3[MATRIX_GENERAL] = TAG(transform_points3_general);
|
---|
983 | TAG_TAB_3[MATRIX_IDENTITY] = TAG(transform_points3_identity);
|
---|
984 | TAG_TAB_3[MATRIX_3D_NO_ROT] = TAG(transform_points3_3d_no_rot);
|
---|
985 | TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective);
|
---|
986 | TAG_TAB_3[MATRIX_2D] = TAG(transform_points3_2d);
|
---|
987 | TAG_TAB_3[MATRIX_2D_NO_ROT] = TAG(transform_points3_2d_no_rot);
|
---|
988 | TAG_TAB_3[MATRIX_3D] = TAG(transform_points3_3d);
|
---|
989 |
|
---|
990 | /* 4-D points */
|
---|
991 | TAG_TAB_4[MATRIX_GENERAL] = TAG(transform_points4_general);
|
---|
992 | TAG_TAB_4[MATRIX_IDENTITY] = TAG(transform_points4_identity);
|
---|
993 | TAG_TAB_4[MATRIX_3D_NO_ROT] = TAG(transform_points4_3d_no_rot);
|
---|
994 | TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective);
|
---|
995 | TAG_TAB_4[MATRIX_2D] = TAG(transform_points4_2d);
|
---|
996 | TAG_TAB_4[MATRIX_2D_NO_ROT] = TAG(transform_points4_2d_no_rot);
|
---|
997 | TAG_TAB_4[MATRIX_3D] = TAG(transform_points4_3d);
|
---|
998 |
|
---|
999 | #undef TAG_TAB
|
---|
1000 | }
|
---|