3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * New (3.1) transformation code written by Keith Whitwell.
31 /* Note - respects the stride of the output vector.
33 static void TAG(dotprod_vec2)( GLfloat *out,
35 const GLvector4f *coord_vec,
36 const GLfloat plane[4] )
38 GLuint stride = coord_vec->stride;
39 GLfloat *coord = coord_vec->start;
40 GLuint count = coord_vec->count;
44 const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3];
46 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
47 *out = (coord[0] * plane0 +
53 static void TAG(dotprod_vec3)( GLfloat *out,
55 const GLvector4f *coord_vec,
56 const GLfloat plane[4] )
58 GLuint stride = coord_vec->stride;
59 GLfloat *coord = coord_vec->start;
60 GLuint count = coord_vec->count;
64 const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
65 const GLfloat plane3 = plane[3];
67 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
68 *out = (coord[0] * plane0 +
75 static void TAG(dotprod_vec4)( GLfloat *out,
77 const GLvector4f *coord_vec,
78 const GLfloat plane[4] )
80 GLuint stride = coord_vec->stride;
81 GLfloat *coord = coord_vec->start;
82 GLuint count = coord_vec->count;
85 const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
86 const GLfloat plane3 = plane[3];
88 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
89 *out = (coord[0] * plane0 +
97 static void TAG(init_dotprod)( void )
99 _mesa_dotprod_tab[2] = TAG(dotprod_vec2);
100 _mesa_dotprod_tab[3] = TAG(dotprod_vec3);
101 _mesa_dotprod_tab[4] = TAG(dotprod_vec4);