diff options
Diffstat (limited to 'src/mesa/math')
-rw-r--r-- | src/mesa/math/descrip.mms | 47 | ||||
-rw-r--r-- | src/mesa/math/m_debug_util.h | 2 | ||||
-rw-r--r-- | src/mesa/math/m_matrix.c | 21 | ||||
-rw-r--r-- | src/mesa/math/m_matrix.h | 15 | ||||
-rw-r--r-- | src/mesa/math/m_vector.h | 5 | ||||
-rw-r--r-- | src/mesa/math/m_xform.c | 102 | ||||
-rw-r--r-- | src/mesa/math/m_xform.h | 23 | ||||
-rw-r--r-- | src/mesa/math/mathmod.h | 41 | ||||
-rw-r--r-- | src/mesa/math/sources | 25 |
9 files changed, 88 insertions, 193 deletions
diff --git a/src/mesa/math/descrip.mms b/src/mesa/math/descrip.mms new file mode 100644 index 0000000000..3aaa6eb8b4 --- /dev/null +++ b/src/mesa/math/descrip.mms @@ -0,0 +1,47 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl +# Last revision : 3 October 2007 + +.first + define gl [---.include.gl] + define math [-.math] + define glapi [-.glapi] + define main [-.main] + +.include [---]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [---.include],[-.main],[-.glapi] +LIBDIR = [---.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm + +SOURCES = m_debug_clip.c m_debug_norm.c m_debug_xform.c m_eval.c m_matrix.c\ + m_translate.c m_vector.c m_xform.c + +OBJECTS = m_debug_clip.obj,m_debug_norm.obj,m_debug_xform.obj,m_eval.obj,\ + m_matrix.obj,m_translate.obj,m_vector.obj,m_xform.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +m_debug_clip.obj : m_debug_clip.c +m_debug_norm.obj : m_debug_norm.c +m_debug_xform.obj : m_debug_xform.c +m_eval.obj : m_eval.c +m_matrix.obj : m_matrix.c +m_translate.obj : m_translate.c +m_vector.obj : m_vector.c +m_xform.obj : m_xform.c diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h index 776c26475e..7abe6f2565 100644 --- a/src/mesa/math/m_debug_util.h +++ b/src/mesa/math/m_debug_util.h @@ -185,7 +185,7 @@ extern char *mesa_profile; #endif -#elif defined(__amd64__) +#elif defined(__x86_64__) #define rdtscll(val) do { \ unsigned int a,d; \ diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 84b4cae4ad..58cae88b08 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 e8303f3ac5..3bc5de6cd4 100644 --- a/src/mesa/math/m_matrix.h +++ b/src/mesa/math/m_matrix.h @@ -189,6 +189,21 @@ do { \ } while (0) +/** + * Transform a direction by a matrix. + */ +#define TRANSFORM_DIRECTION( TO, DIR, MAT ) \ +do { \ + TO[0] = DIR[0] * MAT[0] + DIR[1] * MAT[4] + DIR[2] * MAT[8]; \ + TO[1] = DIR[0] * MAT[1] + DIR[1] * MAT[5] + DIR[2] * MAT[9]; \ + TO[2] = DIR[0] * MAT[2] + DIR[1] * MAT[6] + DIR[2] * MAT[10];\ +} 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_vector.h b/src/mesa/math/m_vector.h index b1a65b3356..647388ac7d 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 7.3 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index 901ae5b416..369f2c6e95 100644 --- a/src/mesa/math/m_xform.c +++ b/src/mesa/math/m_xform.c @@ -40,7 +40,6 @@ #include "m_matrix.h" #include "m_translate.h" #include "m_xform.h" -#include "mathmod.h" #ifdef DEBUG_MATH @@ -97,99 +96,6 @@ transform_func *_mesa_transform_tab[5]; #undef ARGS - - -GLvector4f *_mesa_project_points( GLvector4f *proj_vec, - const GLvector4f *clip_vec ) -{ - const GLuint stride = clip_vec->stride; - const GLfloat *from = (GLfloat *)clip_vec->start; - const GLuint count = clip_vec->count; - GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; - GLuint i; - - for (i = 0 ; i < count ; i++, STRIDE_F(from, stride)) - { - GLfloat oow = 1.0F / from[3]; - vProj[i][3] = oow; - vProj[i][0] = from[0] * oow; - vProj[i][1] = from[1] * oow; - vProj[i][2] = from[2] * oow; - } - - proj_vec->flags |= VEC_SIZE_4; - proj_vec->size = 3; - proj_vec->count = clip_vec->count; - return proj_vec; -} - - - - - - -/* - * 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 -} - - -/* Useful for one-off point transformations, as in clipping. - * Note that because the matrix isn't analysed we do too many - * multiplies, and that the result is always 4-clean. - */ -void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16], - const GLfloat P[4], GLuint sz ) -{ - if (Q == P) - return; - - if (sz == 4) - { - Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; - Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; - Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; - Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; - } - else if (sz == 3) - { - Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; - Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; - Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; - Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; - } - else if (sz == 2) - { - Q[0] = M[0] * P[0] + M[4] * P[1] + M[12]; - Q[1] = M[1] * P[0] + M[5] * P[1] + M[13]; - Q[2] = M[2] * P[0] + M[6] * P[1] + M[14]; - Q[3] = M[3] * P[0] + M[7] * P[1] + M[15]; - } - else if (sz == 1) - { - Q[0] = M[0] * P[0] + M[12]; - Q[1] = M[1] * P[0] + M[13]; - Q[2] = M[2] * P[0] + M[14]; - Q[3] = M[3] * P[0] + M[15]; - } -} - - /* * This is called only once. It initializes several tables with pointers * to optimized transformation functions. This is where we can test for @@ -220,11 +126,3 @@ _math_init_transformation( void ) _mesa_init_all_x86_64_transform_asm(); #endif } - -void -_math_init( void ) -{ - _math_init_transformation(); - _math_init_translate(); - _math_init_eval(); -} diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index d1b974f043..7ef76e0b92 100644 --- a/src/mesa/math/m_xform.h +++ b/src/mesa/math/m_xform.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -42,10 +42,6 @@ extern void -_mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]); - - -extern void _math_init_transformation(void); @@ -148,18 +144,6 @@ typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, CONST GLvector4f *from_vec ); -extern GLvector4f *_mesa_project_points( GLvector4f *to, - CONST GLvector4f *from ); - -extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask, - CONST GLfloat m[16], - CONST GLfloat src[][3] ); - -extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask, - CONST GLfloat m[16], - CONST GLfloat src[][3] ); - - extern dotprod_func _mesa_dotprod_tab[5]; extern vec_copy_func _mesa_copy_tab[0x10]; extern vec_copy_func _mesa_copy_clean_tab[5]; @@ -173,9 +157,6 @@ extern normal_func _mesa_normal_tab[0xf]; extern transform_func *_mesa_transform_tab[5]; -extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], - CONST GLfloat P[4], GLuint sz ); - #define TransformRaw( to, mat, from ) \ ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ diff --git a/src/mesa/math/mathmod.h b/src/mesa/math/mathmod.h deleted file mode 100644 index 6fbaaea94b..0000000000 --- a/src/mesa/math/mathmod.h +++ /dev/null @@ -1,41 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \mainpage Mesa Math Module - * - * This module contains math-related utility functions for transforming - * vertices, translating arrays of numbers from one data type to another, - * evaluating curved surfaces, etc. - */ - - -#ifndef _MESA_MATH_H_ -#define _MESA_MATH_H_ - -extern void _math_init( void ); - -#endif diff --git a/src/mesa/math/sources b/src/mesa/math/sources deleted file mode 100644 index 7c7dcccedf..0000000000 --- a/src/mesa/math/sources +++ /dev/null @@ -1,25 +0,0 @@ -MESA_MATH_SOURCES = \ -m_debug_clip.c \ -m_debug_norm.c \ -m_debug_xform.c \ -m_eval.c \ -m_matrix.c \ -m_translate.c \ -m_vector.c \ -m_xform.c - -MESA_MATH_HEADERS = \ -m_clip_tmp.h \ -m_copy_tmp.h \ -m_debug.h \ -m_debug_util.h \ -m_dotprod_tmp.h \ -m_eval.h \ -m_matrix.h \ -m_norm_tmp.h \ -m_trans_tmp.h \ -m_translate.h \ -m_vector.h \ -m_xform.h \ -m_xform_tmp.h \ -mathmod.h |