diff options
author | Keith Whitwell <[email protected]> | 2000-11-16 21:05:34 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2000-11-16 21:05:34 +0000 |
commit | 23caf20169ac38436ee9c13914f1d6aa7cf6bb5e (patch) | |
tree | 21307f7bbcaf9ee1e841d7e7bee130570a7b5b95 /src/mesa/main/get.c | |
parent | 179516673211a2350e479d5321840291f339f5dd (diff) |
Move the transform and lighting code to two new directories
math: Provides basic matrix and vector functionality that
might be useful to multiple software t&l
implementations, and is used by core mesa to
manage the Model, Project, etc matrices.
tnl: The real transform & lighting code from core mesa,
including everything from glVertex3f through vertex
buffer handling, transformation, clipping, lighting
and handoff to a driver for rasterization.
The interfaces of these can be further tightened up, but the basic
splitting up of state and code move is done.
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 66 |
1 files changed, 47 insertions, 19 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 434e2e54005..980269d8544 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.40 2000/11/15 16:38:40 brianp Exp $ */ +/* $Id: get.c,v 1.41 2000/11/16 21:05:35 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -36,10 +36,10 @@ #include "extensions.h" #include "get.h" #include "macros.h" -#include "matrix.h" #include "mmath.h" #include "types.h" -#include "vb.h" + +#include "math/m_matrix.h" #endif @@ -228,15 +228,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = INT_TO_BOOL(ctx->Current.Color[0]); params[1] = INT_TO_BOOL(ctx->Current.Color[1]); params[2] = INT_TO_BOOL(ctx->Current.Color[2]); params[3] = INT_TO_BOOL(ctx->Current.Color[3]); break; case GL_CURRENT_INDEX: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = INT_TO_BOOL(ctx->Current.Index); break; case GL_CURRENT_NORMAL: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]); params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]); params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]); @@ -269,6 +272,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][0]); params[1] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][1]); params[2] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][2]); @@ -309,6 +313,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer); break; case GL_EDGE_FLAG: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -1077,7 +1082,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ColorMatrix.m); + _math_transposef(tm, ctx->ColorMatrix.m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1087,7 +1092,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ModelView.m); + _math_transposef(tm, ctx->ModelView.m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1097,7 +1102,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ProjectionMatrix.m); + _math_transposef(tm, ctx->ProjectionMatrix.m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1107,7 +1112,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); + _math_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1236,6 +1241,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]); params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]); params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]); @@ -1255,6 +1261,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = FLOAT_TO_BOOL(ctx->Current.FogCoord); break; case GL_FOG_COORDINATE_ARRAY_EXT: @@ -1419,15 +1426,18 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]); params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]); params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]); params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]); break; case GL_CURRENT_INDEX: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLdouble) ctx->Current.Index; break; case GL_CURRENT_NORMAL: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = (GLdouble) ctx->Current.Normal[0]; params[1] = (GLdouble) ctx->Current.Normal[1]; params[2] = (GLdouble) ctx->Current.Normal[2]; @@ -1460,6 +1470,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][0]; params[1] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][1]; params[2] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][2]; @@ -1500,6 +1511,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer); break; case GL_EDGE_FLAG: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLdouble) ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -2268,7 +2280,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ColorMatrix.m); + _math_transposef(tm, ctx->ColorMatrix.m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2278,7 +2290,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ModelView.m); + _math_transposef(tm, ctx->ModelView.m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2288,7 +2300,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ProjectionMatrix.m); + _math_transposef(tm, ctx->ProjectionMatrix.m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2298,7 +2310,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); + _math_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2427,6 +2439,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]); params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]); params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]); @@ -2446,6 +2459,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLdouble) ctx->Current.FogCoord; break; case GL_FOG_COORDINATE_ARRAY_EXT: @@ -2611,15 +2625,18 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]); params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]); params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]); params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]); break; case GL_CURRENT_INDEX: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLfloat) ctx->Current.Index; break; case GL_CURRENT_NORMAL: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = ctx->Current.Normal[0]; params[1] = ctx->Current.Normal[1]; params[2] = ctx->Current.Normal[2]; @@ -2652,6 +2669,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][0]; params[1] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][1]; params[2] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][2]; @@ -2692,6 +2710,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer); break; case GL_EDGE_FLAG: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLfloat) ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -3459,16 +3478,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - gl_matrix_transposef(params, ctx->ColorMatrix.m); + _math_transposef(params, ctx->ColorMatrix.m); break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - gl_matrix_transposef(params, ctx->ModelView.m); + _math_transposef(params, ctx->ModelView.m); break; case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - gl_matrix_transposef(params, ctx->ProjectionMatrix.m); + _math_transposef(params, ctx->ProjectionMatrix.m); break; case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - gl_matrix_transposef(params, ctx->TextureMatrix[texTransformUnit].m); + _math_transposef(params, ctx->TextureMatrix[texTransformUnit].m); break; /* GL_HP_occlusion_test */ @@ -3593,6 +3612,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]); params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]); params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]); @@ -3612,6 +3632,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLfloat) ctx->Current.FogCoord; break; case GL_FOG_COORDINATE_ARRAY_EXT: @@ -3779,15 +3800,18 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Polygon.CullFaceMode; break; case GL_CURRENT_COLOR: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[0] ) ); params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[1] ) ); params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[2] ) ); params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[3] ) ); break; case GL_CURRENT_INDEX: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLint) ctx->Current.Index; break; case GL_CURRENT_NORMAL: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] ); params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] ); params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] ); @@ -3820,6 +3844,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = (GLint) ctx->Current.Texcoord[texTransformUnit][0]; params[1] = (GLint) ctx->Current.Texcoord[texTransformUnit][1]; params[2] = (GLint) ctx->Current.Texcoord[texTransformUnit][2]; @@ -3860,6 +3885,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Color.DrawBuffer; break; case GL_EDGE_FLAG: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLint) ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -4628,7 +4654,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ColorMatrix.m); + _math_transposef(tm, ctx->ColorMatrix.m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -4638,7 +4664,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ModelView.m); + _math_transposef(tm, ctx->ModelView.m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -4648,7 +4674,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->ProjectionMatrix.m); + _math_transposef(tm, ctx->ProjectionMatrix.m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -4658,7 +4684,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - gl_matrix_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); + _math_transposef(tm, ctx->TextureMatrix[texTransformUnit].m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -4788,6 +4814,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[0] ) ); params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[1] ) ); params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[2] ) ); @@ -4807,6 +4834,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); *params = (GLint) ctx->Current.FogCoord; break; case GL_FOG_COORDINATE_ARRAY_EXT: |