1 /* $Id: m_xform_tmp.h,v 1.5 2001/03/12 02:02:36 gareth Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
28 * New (3.1) transformation code written by Keith Whitwell.
32 /*----------------------------------------------------------------------
33 * Begin Keith's new code
35 *----------------------------------------------------------------------
38 /* KW: Fixed stride, now measured in bytes as is the OpenGL array stride.
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
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.
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.
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
64 /* KW: Now uses clipmask and a flag to allow us to skip both/either
65 * cliped and/or culled vertices.
69 TAG(transform_points1_general
)( GLvector4f
*to_vec
,
71 const GLvector4f
*from_vec
,
75 const GLuint stride
= from_vec
->stride
;
76 GLfloat
*from
= from_vec
->start
;
77 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
78 GLuint count
= from_vec
->count
;
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];
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
;
97 to_vec
->flags
|= VEC_SIZE_4
;
98 to_vec
->count
= from_vec
->count
;
101 static void _XFORMAPI
102 TAG(transform_points1_identity
)( GLvector4f
*to_vec
,
104 const GLvector4f
*from_vec
,
108 const GLuint stride
= from_vec
->stride
;
109 GLfloat
*from
= from_vec
->start
;
110 GLuint count
= from_vec
->count
;
111 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
115 if (to_vec
== from_vec
) return;
123 to_vec
->flags
|= VEC_SIZE_1
;
124 to_vec
->count
= from_vec
->count
;
127 static void _XFORMAPI
128 TAG(transform_points1_2d
)( GLvector4f
*to_vec
,
130 const GLvector4f
*from_vec
,
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 m0
= m
[0], m1
= m
[1];
139 const GLfloat m12
= m
[12], m13
= m
[13];
145 const GLfloat ox
= from
[0];
146 to
[i
][0] = m0
* ox
+ m12
;
147 to
[i
][1] = m1
* ox
+ m13
;
151 to_vec
->flags
|= VEC_SIZE_2
;
152 to_vec
->count
= from_vec
->count
;
155 static void _XFORMAPI
156 TAG(transform_points1_2d_no_rot
)( GLvector4f
*to_vec
,
158 const GLvector4f
*from_vec
,
162 const GLuint stride
= from_vec
->stride
;
163 GLfloat
*from
= from_vec
->start
;
164 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
165 GLuint count
= from_vec
->count
;
166 const GLfloat m0
= m
[0], m12
= m
[12], m13
= m
[13];
172 const GLfloat ox
= from
[0];
173 to
[i
][0] = m0
* ox
+ m12
;
179 to_vec
->flags
|= VEC_SIZE_2
;
180 to_vec
->count
= from_vec
->count
;
183 static void _XFORMAPI
184 TAG(transform_points1_3d
)( GLvector4f
*to_vec
,
186 const GLvector4f
*from_vec
,
190 const GLuint stride
= from_vec
->stride
;
191 GLfloat
*from
= from_vec
->start
;
192 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
193 GLuint count
= from_vec
->count
;
194 const GLfloat m0
= m
[0], m1
= m
[1], m2
= m
[2];
195 const GLfloat m12
= m
[12], m13
= m
[13], m14
= m
[14];
201 const GLfloat ox
= from
[0];
202 to
[i
][0] = m0
* ox
+ m12
;
203 to
[i
][1] = m1
* ox
+ m13
;
204 to
[i
][2] = m2
* ox
+ m14
;
208 to_vec
->flags
|= VEC_SIZE_3
;
209 to_vec
->count
= from_vec
->count
;
213 static void _XFORMAPI
214 TAG(transform_points1_3d_no_rot
)( GLvector4f
*to_vec
,
216 const GLvector4f
*from_vec
,
220 const GLuint stride
= from_vec
->stride
;
221 GLfloat
*from
= from_vec
->start
;
222 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
223 GLuint count
= from_vec
->count
;
224 const GLfloat m0
= m
[0];
225 const GLfloat m12
= m
[12], m13
= m
[13], m14
= m
[14];
231 const GLfloat ox
= from
[0];
232 to
[i
][0] = m0
* ox
+ m12
;
238 to_vec
->flags
|= VEC_SIZE_3
;
239 to_vec
->count
= from_vec
->count
;
242 static void _XFORMAPI
243 TAG(transform_points1_perspective
)( GLvector4f
*to_vec
,
245 const GLvector4f
*from_vec
,
249 const GLuint stride
= from_vec
->stride
;
250 GLfloat
*from
= from_vec
->start
;
251 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
252 GLuint count
= from_vec
->count
;
253 const GLfloat m0
= m
[0], m14
= m
[14];
259 const GLfloat ox
= from
[0];
267 to_vec
->flags
|= VEC_SIZE_4
;
268 to_vec
->count
= from_vec
->count
;
274 /* 2-vectors, which are a lot more relevant than 1-vectors, are
275 * present early in the geometry pipeline and throughout the
278 static void _XFORMAPI
279 TAG(transform_points2_general
)( GLvector4f
*to_vec
,
281 const GLvector4f
*from_vec
,
285 const GLuint stride
= from_vec
->stride
;
286 GLfloat
*from
= from_vec
->start
;
287 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
288 GLuint count
= from_vec
->count
;
289 const GLfloat m0
= m
[0], m4
= m
[4], m12
= m
[12];
290 const GLfloat m1
= m
[1], m5
= m
[5], m13
= m
[13];
291 const GLfloat m2
= m
[2], m6
= m
[6], m14
= m
[14];
292 const GLfloat m3
= m
[3], m7
= m
[7], m15
= m
[15];
298 const GLfloat ox
= from
[0], oy
= from
[1];
299 to
[i
][0] = m0
* ox
+ m4
* oy
+ m12
;
300 to
[i
][1] = m1
* ox
+ m5
* oy
+ m13
;
301 to
[i
][2] = m2
* ox
+ m6
* oy
+ m14
;
302 to
[i
][3] = m3
* ox
+ m7
* oy
+ m15
;
306 to_vec
->flags
|= VEC_SIZE_4
;
307 to_vec
->count
= from_vec
->count
;
310 static void _XFORMAPI
311 TAG(transform_points2_identity
)( GLvector4f
*to_vec
,
313 const GLvector4f
*from_vec
,
317 const GLuint stride
= from_vec
->stride
;
318 GLfloat
*from
= from_vec
->start
;
319 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
320 GLuint count
= from_vec
->count
;
324 if (to_vec
== from_vec
) return;
332 to_vec
->flags
|= VEC_SIZE_2
;
333 to_vec
->count
= from_vec
->count
;
336 static void _XFORMAPI
337 TAG(transform_points2_2d
)( GLvector4f
*to_vec
,
339 const GLvector4f
*from_vec
,
343 const GLuint stride
= from_vec
->stride
;
344 GLfloat
*from
= from_vec
->start
;
345 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
346 GLuint count
= from_vec
->count
;
347 const GLfloat m0
= m
[0], m1
= m
[1], m4
= m
[4], m5
= m
[5];
348 const GLfloat m12
= m
[12], m13
= m
[13];
354 const GLfloat ox
= from
[0], oy
= from
[1];
355 to
[i
][0] = m0
* ox
+ m4
* oy
+ m12
;
356 to
[i
][1] = m1
* ox
+ m5
* oy
+ m13
;
361 to_vec
->flags
|= VEC_SIZE_2
;
362 to_vec
->count
= from_vec
->count
;
365 static void _XFORMAPI
366 TAG(transform_points2_2d_no_rot
)( GLvector4f
*to_vec
,
368 const GLvector4f
*from_vec
,
372 const GLuint stride
= from_vec
->stride
;
373 GLfloat
*from
= from_vec
->start
;
374 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
375 GLuint count
= from_vec
->count
;
376 const GLfloat m0
= m
[0], m5
= m
[5], m12
= m
[12], m13
= m
[13];
382 const GLfloat ox
= from
[0], oy
= from
[1];
383 to
[i
][0] = m0
* ox
+ m12
;
384 to
[i
][1] = m5
* oy
+ m13
;
389 to_vec
->flags
|= VEC_SIZE_2
;
390 to_vec
->count
= from_vec
->count
;
393 static void _XFORMAPI
394 TAG(transform_points2_3d
)( GLvector4f
*to_vec
,
396 const GLvector4f
*from_vec
,
400 const GLuint stride
= from_vec
->stride
;
401 GLfloat
*from
= from_vec
->start
;
402 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
403 GLuint count
= from_vec
->count
;
404 const GLfloat m0
= m
[0], m1
= m
[1], m2
= m
[2], m4
= m
[4], m5
= m
[5];
405 const GLfloat m6
= m
[6], m12
= m
[12], m13
= m
[13], m14
= m
[14];
411 const GLfloat ox
= from
[0], oy
= from
[1];
412 to
[i
][0] = m0
* ox
+ m4
* oy
+ m12
;
413 to
[i
][1] = m1
* ox
+ m5
* oy
+ m13
;
414 to
[i
][2] = m2
* ox
+ m6
* oy
+ m14
;
418 to_vec
->flags
|= VEC_SIZE_3
;
419 to_vec
->count
= from_vec
->count
;
423 /* I would actually say this was a fairly important function, from
424 * a texture transformation point of view.
426 static void _XFORMAPI
427 TAG(transform_points2_3d_no_rot
)( GLvector4f
*to_vec
,
429 const GLvector4f
*from_vec
,
433 const GLuint stride
= from_vec
->stride
;
434 GLfloat
*from
= from_vec
->start
;
435 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
436 GLuint count
= from_vec
->count
;
437 const GLfloat m0
= m
[0], m5
= m
[5];
438 const GLfloat m12
= m
[12], m13
= m
[13], m14
= m
[14];
444 const GLfloat ox
= from
[0], oy
= from
[1];
445 to
[i
][0] = m0
* ox
+ m12
;
446 to
[i
][1] = m5
* oy
+ m13
;
452 to_vec
->flags
|= VEC_SIZE_2
;
455 to_vec
->flags
|= VEC_SIZE_3
;
457 to_vec
->count
= from_vec
->count
;
461 static void _XFORMAPI
462 TAG(transform_points2_perspective
)( GLvector4f
*to_vec
,
464 const GLvector4f
*from_vec
,
468 const GLuint stride
= from_vec
->stride
;
469 GLfloat
*from
= from_vec
->start
;
470 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
471 GLuint count
= from_vec
->count
;
472 const GLfloat m0
= m
[0], m5
= m
[5], m14
= m
[14];
478 const GLfloat ox
= from
[0], oy
= from
[1];
486 to_vec
->flags
|= VEC_SIZE_4
;
487 to_vec
->count
= from_vec
->count
;
492 static void _XFORMAPI
493 TAG(transform_points3_general
)( GLvector4f
*to_vec
,
495 const GLvector4f
*from_vec
,
499 const GLuint stride
= from_vec
->stride
;
500 GLfloat
*from
= from_vec
->start
;
501 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
502 GLuint count
= from_vec
->count
;
503 const GLfloat m0
= m
[0], m4
= m
[4], m8
= m
[8], m12
= m
[12];
504 const GLfloat m1
= m
[1], m5
= m
[5], m9
= m
[9], m13
= m
[13];
505 const GLfloat m2
= m
[2], m6
= m
[6], m10
= m
[10], m14
= m
[14];
506 const GLfloat m3
= m
[3], m7
= m
[7], m11
= m
[11], m15
= m
[15];
512 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2];
513 to
[i
][0] = m0
* ox
+ m4
* oy
+ m8
* oz
+ m12
;
514 to
[i
][1] = m1
* ox
+ m5
* oy
+ m9
* oz
+ m13
;
515 to
[i
][2] = m2
* ox
+ m6
* oy
+ m10
* oz
+ m14
;
516 to
[i
][3] = m3
* ox
+ m7
* oy
+ m11
* oz
+ m15
;
520 to_vec
->flags
|= VEC_SIZE_4
;
521 to_vec
->count
= from_vec
->count
;
524 static void _XFORMAPI
525 TAG(transform_points3_identity
)( GLvector4f
*to_vec
,
527 const GLvector4f
*from_vec
,
531 const GLuint stride
= from_vec
->stride
;
532 GLfloat
*from
= from_vec
->start
;
533 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
534 GLuint count
= from_vec
->count
;
538 if (to_vec
== from_vec
) return;
547 to_vec
->flags
|= VEC_SIZE_3
;
548 to_vec
->count
= from_vec
->count
;
551 static void _XFORMAPI
552 TAG(transform_points3_2d
)( GLvector4f
*to_vec
,
554 const GLvector4f
*from_vec
,
558 const GLuint stride
= from_vec
->stride
;
559 GLfloat
*from
= from_vec
->start
;
560 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
561 GLuint count
= from_vec
->count
;
562 const GLfloat m0
= m
[0], m1
= m
[1], m4
= m
[4], m5
= m
[5];
563 const GLfloat m12
= m
[12], m13
= m
[13];
569 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2];
570 to
[i
][0] = m0
* ox
+ m4
* oy
+ m12
;
571 to
[i
][1] = m1
* ox
+ m5
* oy
+ m13
;
576 to_vec
->flags
|= VEC_SIZE_3
;
577 to_vec
->count
= from_vec
->count
;
580 static void _XFORMAPI
581 TAG(transform_points3_2d_no_rot
)( GLvector4f
*to_vec
,
583 const GLvector4f
*from_vec
,
587 const GLuint stride
= from_vec
->stride
;
588 GLfloat
*from
= from_vec
->start
;
589 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
590 GLuint count
= from_vec
->count
;
591 const GLfloat m0
= m
[0], m5
= m
[5], m12
= m
[12], m13
= m
[13];
597 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2];
598 to
[i
][0] = m0
* ox
+ m12
;
599 to
[i
][1] = m5
* oy
+ m13
;
604 to_vec
->flags
|= VEC_SIZE_3
;
605 to_vec
->count
= from_vec
->count
;
608 static void _XFORMAPI
609 TAG(transform_points3_3d
)( GLvector4f
*to_vec
,
611 const GLvector4f
*from_vec
,
615 const GLuint stride
= from_vec
->stride
;
616 GLfloat
*from
= from_vec
->start
;
617 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
618 GLuint count
= from_vec
->count
;
619 const GLfloat m0
= m
[0], m1
= m
[1], m2
= m
[2], m4
= m
[4], m5
= m
[5];
620 const GLfloat m6
= m
[6], m8
= m
[8], m9
= m
[9], m10
= m
[10];
621 const GLfloat m12
= m
[12], m13
= m
[13], m14
= m
[14];
627 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2];
628 to
[i
][0] = m0
* ox
+ m4
* oy
+ m8
* oz
+ m12
;
629 to
[i
][1] = m1
* ox
+ m5
* oy
+ m9
* oz
+ m13
;
630 to
[i
][2] = m2
* ox
+ m6
* oy
+ m10
* oz
+ m14
;
634 to_vec
->flags
|= VEC_SIZE_3
;
635 to_vec
->count
= from_vec
->count
;
638 /* previously known as ortho...
640 static void _XFORMAPI
641 TAG(transform_points3_3d_no_rot
)( GLvector4f
*to_vec
,
643 const GLvector4f
*from_vec
,
647 const GLuint stride
= from_vec
->stride
;
648 GLfloat
*from
= from_vec
->start
;
649 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
650 GLuint count
= from_vec
->count
;
651 const GLfloat m0
= m
[0], m5
= m
[5];
652 const GLfloat m10
= m
[10], m12
= m
[12], m13
= m
[13], m14
= m
[14];
658 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2];
659 to
[i
][0] = m0
* ox
+ m12
;
660 to
[i
][1] = m5
* oy
+ m13
;
661 to
[i
][2] = m10
* oz
+ m14
;
665 to_vec
->flags
|= VEC_SIZE_3
;
666 to_vec
->count
= from_vec
->count
;
669 static void _XFORMAPI
670 TAG(transform_points3_perspective
)( GLvector4f
*to_vec
,
672 const GLvector4f
*from_vec
,
676 const GLuint stride
= from_vec
->stride
;
677 GLfloat
*from
= from_vec
->start
;
678 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
679 GLuint count
= from_vec
->count
;
680 const GLfloat m0
= m
[0], m5
= m
[5], m8
= m
[8], m9
= m
[9];
681 const GLfloat m10
= m
[10], m14
= m
[14];
687 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2];
688 to
[i
][0] = m0
* ox
+ m8
* oz
;
689 to
[i
][1] = m5
* oy
+ m9
* oz
;
690 to
[i
][2] = m10
* oz
+ m14
;
695 to_vec
->flags
|= VEC_SIZE_4
;
696 to_vec
->count
= from_vec
->count
;
701 static void _XFORMAPI
702 TAG(transform_points4_general
)( GLvector4f
*to_vec
,
704 const GLvector4f
*from_vec
,
708 const GLuint stride
= from_vec
->stride
;
709 GLfloat
*from
= from_vec
->start
;
710 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
711 GLuint count
= from_vec
->count
;
712 const GLfloat m0
= m
[0], m4
= m
[4], m8
= m
[8], m12
= m
[12];
713 const GLfloat m1
= m
[1], m5
= m
[5], m9
= m
[9], m13
= m
[13];
714 const GLfloat m2
= m
[2], m6
= m
[6], m10
= m
[10], m14
= m
[14];
715 const GLfloat m3
= m
[3], m7
= m
[7], m11
= m
[11], m15
= m
[15];
721 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2], ow
= from
[3];
722 to
[i
][0] = m0
* ox
+ m4
* oy
+ m8
* oz
+ m12
* ow
;
723 to
[i
][1] = m1
* ox
+ m5
* oy
+ m9
* oz
+ m13
* ow
;
724 to
[i
][2] = m2
* ox
+ m6
* oy
+ m10
* oz
+ m14
* ow
;
725 to
[i
][3] = m3
* ox
+ m7
* oy
+ m11
* oz
+ m15
* ow
;
729 to_vec
->flags
|= VEC_SIZE_4
;
730 to_vec
->count
= from_vec
->count
;
733 static void _XFORMAPI
734 TAG(transform_points4_identity
)( GLvector4f
*to_vec
,
736 const GLvector4f
*from_vec
,
740 const GLuint stride
= from_vec
->stride
;
741 GLfloat
*from
= from_vec
->start
;
742 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
743 GLuint count
= from_vec
->count
;
747 if (to_vec
== from_vec
) return;
757 to_vec
->flags
|= VEC_SIZE_4
;
758 to_vec
->count
= from_vec
->count
;
761 static void _XFORMAPI
762 TAG(transform_points4_2d
)( GLvector4f
*to_vec
,
764 const GLvector4f
*from_vec
,
768 const GLuint stride
= from_vec
->stride
;
769 GLfloat
*from
= from_vec
->start
;
770 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
771 GLuint count
= from_vec
->count
;
772 const GLfloat m0
= m
[0], m1
= m
[1], m4
= m
[4], m5
= m
[5];
773 const GLfloat m12
= m
[12], m13
= m
[13];
779 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2], ow
= from
[3];
780 to
[i
][0] = m0
* ox
+ m4
* oy
+ m12
* ow
;
781 to
[i
][1] = m1
* ox
+ m5
* oy
+ m13
* ow
;
787 to_vec
->flags
|= VEC_SIZE_4
;
788 to_vec
->count
= from_vec
->count
;
791 static void _XFORMAPI
792 TAG(transform_points4_2d_no_rot
)( GLvector4f
*to_vec
,
794 const GLvector4f
*from_vec
,
798 const GLuint stride
= from_vec
->stride
;
799 GLfloat
*from
= from_vec
->start
;
800 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
801 GLuint count
= from_vec
->count
;
802 const GLfloat m0
= m
[0], m5
= m
[5], m12
= m
[12], m13
= m
[13];
808 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2], ow
= from
[3];
809 to
[i
][0] = m0
* ox
+ m12
* ow
;
810 to
[i
][1] = m5
* oy
+ m13
* ow
;
816 to_vec
->flags
|= VEC_SIZE_4
;
817 to_vec
->count
= from_vec
->count
;
820 static void _XFORMAPI
821 TAG(transform_points4_3d
)( GLvector4f
*to_vec
,
823 const GLvector4f
*from_vec
,
827 const GLuint stride
= from_vec
->stride
;
828 GLfloat
*from
= from_vec
->start
;
829 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
830 GLuint count
= from_vec
->count
;
831 const GLfloat m0
= m
[0], m1
= m
[1], m2
= m
[2], m4
= m
[4], m5
= m
[5];
832 const GLfloat m6
= m
[6], m8
= m
[8], m9
= m
[9], m10
= m
[10];
833 const GLfloat m12
= m
[12], m13
= m
[13], m14
= m
[14];
839 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2], ow
= from
[3];
840 to
[i
][0] = m0
* ox
+ m4
* oy
+ m8
* oz
+ m12
* ow
;
841 to
[i
][1] = m1
* ox
+ m5
* oy
+ m9
* oz
+ m13
* ow
;
842 to
[i
][2] = m2
* ox
+ m6
* oy
+ m10
* oz
+ m14
* ow
;
847 to_vec
->flags
|= VEC_SIZE_4
;
848 to_vec
->count
= from_vec
->count
;
851 static void _XFORMAPI
852 TAG(transform_points4_3d_no_rot
)( GLvector4f
*to_vec
,
854 const GLvector4f
*from_vec
,
858 const GLuint stride
= from_vec
->stride
;
859 GLfloat
*from
= from_vec
->start
;
860 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
861 GLuint count
= from_vec
->count
;
862 const GLfloat m0
= m
[0], m5
= m
[5];
863 const GLfloat m10
= m
[10], m12
= m
[12], m13
= m
[13], m14
= m
[14];
869 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2], ow
= from
[3];
870 to
[i
][0] = m0
* ox
+ m12
* ow
;
871 to
[i
][1] = m5
* oy
+ m13
* ow
;
872 to
[i
][2] = m10
* oz
+ m14
* ow
;
877 to_vec
->flags
|= VEC_SIZE_4
;
878 to_vec
->count
= from_vec
->count
;
881 static void _XFORMAPI
882 TAG(transform_points4_perspective
)( GLvector4f
*to_vec
,
884 const GLvector4f
*from_vec
,
888 const GLuint stride
= from_vec
->stride
;
889 GLfloat
*from
= from_vec
->start
;
890 GLfloat (*to
)[4] = (GLfloat (*)[4])to_vec
->start
;
891 GLuint count
= from_vec
->count
;
892 const GLfloat m0
= m
[0], m5
= m
[5], m8
= m
[8], m9
= m
[9];
893 const GLfloat m10
= m
[10], m14
= m
[14];
899 const GLfloat ox
= from
[0], oy
= from
[1], oz
= from
[2], ow
= from
[3];
900 to
[i
][0] = m0
* ox
+ m8
* oz
;
901 to
[i
][1] = m5
* oy
+ m9
* oz
;
902 to
[i
][2] = m10
* oz
+ m14
* ow
;
908 to_vec
->flags
|= VEC_SIZE_4
;
909 to_vec
->count
= from_vec
->count
;
912 static transform_func _XFORMAPI
TAG(transform_tab_1
)[7];
913 static transform_func _XFORMAPI
TAG(transform_tab_2
)[7];
914 static transform_func _XFORMAPI
TAG(transform_tab_3
)[7];
915 static transform_func _XFORMAPI
TAG(transform_tab_4
)[7];
917 /* Similar functions could be called several times, with more highly
918 * optimized routines overwriting the arrays. This only occurs during
921 static void _XFORMAPI
TAG(init_c_transformations
)( void )
923 #define TAG_TAB _mesa_transform_tab[IDX]
924 #define TAG_TAB_1 TAG(transform_tab_1)
925 #define TAG_TAB_2 TAG(transform_tab_2)
926 #define TAG_TAB_3 TAG(transform_tab_3)
927 #define TAG_TAB_4 TAG(transform_tab_4)
929 TAG_TAB
[1] = TAG_TAB_1
;
930 TAG_TAB
[2] = TAG_TAB_2
;
931 TAG_TAB
[3] = TAG_TAB_3
;
932 TAG_TAB
[4] = TAG_TAB_4
;
934 /* 1-D points (ie texcoords) */
935 TAG_TAB_1
[MATRIX_GENERAL
] = TAG(transform_points1_general
);
936 TAG_TAB_1
[MATRIX_IDENTITY
] = TAG(transform_points1_identity
);
937 TAG_TAB_1
[MATRIX_3D_NO_ROT
] = TAG(transform_points1_3d_no_rot
);
938 TAG_TAB_1
[MATRIX_PERSPECTIVE
] = TAG(transform_points1_perspective
) ;
939 TAG_TAB_1
[MATRIX_2D
] = TAG(transform_points1_2d
);
940 TAG_TAB_1
[MATRIX_2D_NO_ROT
] = TAG(transform_points1_2d_no_rot
);
941 TAG_TAB_1
[MATRIX_3D
] = TAG(transform_points1_3d
);
944 TAG_TAB_2
[MATRIX_GENERAL
] = TAG(transform_points2_general
);
945 TAG_TAB_2
[MATRIX_IDENTITY
] = TAG(transform_points2_identity
);
946 TAG_TAB_2
[MATRIX_3D_NO_ROT
] = TAG(transform_points2_3d_no_rot
);
947 TAG_TAB_2
[MATRIX_PERSPECTIVE
] = TAG(transform_points2_perspective
) ;
948 TAG_TAB_2
[MATRIX_2D
] = TAG(transform_points2_2d
);
949 TAG_TAB_2
[MATRIX_2D_NO_ROT
] = TAG(transform_points2_2d_no_rot
);
950 TAG_TAB_2
[MATRIX_3D
] = TAG(transform_points2_3d
);
953 TAG_TAB_3
[MATRIX_GENERAL
] = TAG(transform_points3_general
);
954 TAG_TAB_3
[MATRIX_IDENTITY
] = TAG(transform_points3_identity
);
955 TAG_TAB_3
[MATRIX_3D_NO_ROT
] = TAG(transform_points3_3d_no_rot
);
956 TAG_TAB_3
[MATRIX_PERSPECTIVE
] = TAG(transform_points3_perspective
);
957 TAG_TAB_3
[MATRIX_2D
] = TAG(transform_points3_2d
);
958 TAG_TAB_3
[MATRIX_2D_NO_ROT
] = TAG(transform_points3_2d_no_rot
);
959 TAG_TAB_3
[MATRIX_3D
] = TAG(transform_points3_3d
);
962 TAG_TAB_4
[MATRIX_GENERAL
] = TAG(transform_points4_general
);
963 TAG_TAB_4
[MATRIX_IDENTITY
] = TAG(transform_points4_identity
);
964 TAG_TAB_4
[MATRIX_3D_NO_ROT
] = TAG(transform_points4_3d_no_rot
);
965 TAG_TAB_4
[MATRIX_PERSPECTIVE
] = TAG(transform_points4_perspective
);
966 TAG_TAB_4
[MATRIX_2D
] = TAG(transform_points4_2d
);
967 TAG_TAB_4
[MATRIX_2D_NO_ROT
] = TAG(transform_points4_2d_no_rot
);
968 TAG_TAB_4
[MATRIX_3D
] = TAG(transform_points4_3d
);