From: Brian Paul Date: Thu, 12 Feb 2009 16:17:18 +0000 (-0700) Subject: mesa: move _mesa_transform_vector() from m_xform.c to m_matrix.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=987aedd7dc75c095a96cb20b21bbad2f71857776;p=mesa.git mesa: move _mesa_transform_vector() from m_xform.c to m_matrix.c m_xform.c is omitted from gallium builds but _mesa_transform_vector() is still needed. --- diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 244c7aaafc4..d2baecb92ac 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -34,7 +34,7 @@ #include "main/enums.h" #include "main/macros.h" #include "main/texgen.h" -#include "math/m_xform.h" +#include "math/m_matrix.h" diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 84b4cae4adb..58cae88b08b 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1620,3 +1620,24 @@ _math_transposefd( GLfloat to[16], const GLdouble from[16] ) /*@}*/ + +/** + * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This + * function is used for transforming clipping plane equations and spotlight + * directions. + * Mathematically, u = v * m. + * Input: v - input vector + * m - transformation matrix + * Output: u - transformed vector + */ +void +_mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) +{ + const GLfloat v0 = v[0], v1 = v[1], v2 = v[2], v3 = v[3]; +#define M(row,col) m[row + col*4] + u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); + u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); + u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); + u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); +#undef M +} diff --git a/src/mesa/math/m_matrix.h b/src/mesa/math/m_matrix.h index a8d9000e89b..3bc5de6cd4d 100644 --- a/src/mesa/math/m_matrix.h +++ b/src/mesa/math/m_matrix.h @@ -200,6 +200,9 @@ do { \ } while (0) +extern void +_mesa_transform_vector(GLfloat u[4], const GLfloat v[4], const GLfloat m[16]); + /*@}*/ diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index 4789a855d47..369f2c6e957 100644 --- a/src/mesa/math/m_xform.c +++ b/src/mesa/math/m_xform.c @@ -96,27 +96,6 @@ transform_func *_mesa_transform_tab[5]; #undef ARGS -/* - * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This - * function is used for transforming clipping plane equations and spotlight - * directions. - * Mathematically, u = v * m. - * Input: v - input vector - * m - transformation matrix - * Output: u - transformed vector - */ -void _mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) -{ - GLfloat v0=v[0], v1=v[1], v2=v[2], v3=v[3]; -#define M(row,col) m[row + col*4] - u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); - u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); - u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); - u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); -#undef M -} - - /* * This is called only once. It initializes several tables with pointers * to optimized transformation functions. This is where we can test for diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index c8144c00aec..7ef76e0b926 100644 --- a/src/mesa/math/m_xform.h +++ b/src/mesa/math/m_xform.h @@ -41,10 +41,6 @@ #endif -extern void -_mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]); - - extern void _math_init_transformation(void);