From 51c0c71811508b6658e0d5dcff8426b618322a73 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 28 Apr 2001 08:39:17 +0000 Subject: Support for floating point color representation in tnl module. --- src/mesa/drivers/common/t_dd_tritmp.h | 79 +++++++++++++---------------------- 1 file changed, 29 insertions(+), 50 deletions(-) (limited to 'src/mesa/drivers/common/t_dd_tritmp.h') diff --git a/src/mesa/drivers/common/t_dd_tritmp.h b/src/mesa/drivers/common/t_dd_tritmp.h index 963db08826..22eff7f252 100644 --- a/src/mesa/drivers/common/t_dd_tritmp.h +++ b/src/mesa/drivers/common/t_dd_tritmp.h @@ -1,4 +1,4 @@ -/* $Id: t_dd_tritmp.h,v 1.8 2001/04/06 16:26:41 alanh Exp $ */ +/* $Id: t_dd_tritmp.h,v 1.9 2001/04/28 08:39:18 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -177,23 +177,30 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } else { - GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data; - ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLchan)); + GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->Ptr; + ASSERT(VB->ColorPtr[1]->Type == GL_FLOAT); + ASSERT(VB->ColorPtr[1]->StrideB == 4*sizeof(GLfloat)); (void) vbcolor; if (!DO_FLAT) { + VERT_SAVE_RGBA( 0 ); + VERT_SAVE_RGBA( 1 ); VERT_SET_RGBA( v[0], vbcolor[e0] ); VERT_SET_RGBA( v[1], vbcolor[e1] ); } + VERT_SAVE_RGBA( 2 ); VERT_SET_RGBA( v[2], vbcolor[e2] ); if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { - GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr; if (!DO_FLAT) { + VERT_SAVE_SPEC( 0 ); + VERT_SAVE_SPEC( 1 ); VERT_SET_SPEC( v[0], vbspec[e0] ); VERT_SET_SPEC( v[1], vbspec[e1] ); } + VERT_SAVE_SPEC( 2 ); VERT_SET_SPEC( v[2], vbspec[e2] ); } } @@ -288,37 +295,17 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (DO_TWOSIDE && facing == 1) { if (HAVE_RGBA) { - if (HAVE_BACK_COLORS) { + if (!DO_FLAT) { VERT_RESTORE_RGBA( 0 ); VERT_RESTORE_RGBA( 1 ); - VERT_RESTORE_RGBA( 2 ); - if (HAVE_SPEC) { - VERT_RESTORE_SPEC( 0 ); - VERT_RESTORE_SPEC( 1 ); - VERT_RESTORE_SPEC( 2 ); - } } - else { - GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data; - ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan)); - (void) vbcolor; - + VERT_RESTORE_RGBA( 2 ); + if (HAVE_SPEC) { if (!DO_FLAT) { - VERT_SET_RGBA( v[0], vbcolor[e0] ); - VERT_SET_RGBA( v[1], vbcolor[e1] ); - } - VERT_SET_RGBA( v[2], vbcolor[e2] ); - - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { - GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data; - ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan)); - - if (!DO_FLAT) { - VERT_SET_SPEC( v[0], vbspec[e0] ); - VERT_SET_SPEC( v[1], vbspec[e1] ); - } - VERT_SET_SPEC( v[2], vbspec[e2] ); + VERT_RESTORE_SPEC( 0 ); + VERT_RESTORE_SPEC( 1 ); } + VERT_RESTORE_SPEC( 2 ); } } else { @@ -398,7 +385,7 @@ static void TAG(quad)( GLcontext *ctx, if (DO_TWOSIDE && facing == 1) { if (HAVE_RGBA) { - GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data; + GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->Ptr; (void)vbcolor; if (!DO_FLAT) { @@ -409,8 +396,8 @@ static void TAG(quad)( GLcontext *ctx, VERT_SET_RGBA( v[3], vbcolor[e3] ); if (HAVE_SPEC && VB->SecondaryColorPtr[facing]) { - GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; - ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLchan)); + GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr; + ASSERT(VB->SecondaryColorPtr[1]->StrideB==4*sizeof(GLfloat)); if (!DO_FLAT) { VERT_SET_SPEC( v[0], vbspec[e0] ); @@ -521,27 +508,19 @@ static void TAG(quad)( GLcontext *ctx, if (DO_TWOSIDE && facing == 1) { if (HAVE_RGBA) { - GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data; - ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan)); - (void) vbcolor; - if (!DO_FLAT) { - VERT_SET_RGBA( v[0], vbcolor[e0] ); - VERT_SET_RGBA( v[1], vbcolor[e1] ); - VERT_SET_RGBA( v[2], vbcolor[e2] ); + VERT_RESTORE_RGBA( 0 ); + VERT_RESTORE_RGBA( 1 ); + VERT_RESTORE_RGBA( 2 ); } - VERT_SET_RGBA( v[3], vbcolor[e3] ); - - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { - GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data; - ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan)); - + VERT_RESTORE_RGBA( 3 ); + if (HAVE_SPEC) { if (!DO_FLAT) { - VERT_SET_SPEC( v[0], vbspec[e0] ); - VERT_SET_SPEC( v[1], vbspec[e1] ); - VERT_SET_SPEC( v[2], vbspec[e2] ); + VERT_RESTORE_SPEC( 0 ); + VERT_RESTORE_SPEC( 1 ); + VERT_RESTORE_SPEC( 2 ); } - VERT_SET_SPEC( v[3], vbspec[e3] ); + VERT_RESTORE_SPEC( 3 ); } } else { -- cgit v1.2.3