diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2001-04-28 08:39:17 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2001-04-28 08:39:17 +0000 |
commit | 51c0c71811508b6658e0d5dcff8426b618322a73 (patch) | |
tree | 05ccb4905625b200ed1a5de00acb2295e1babec9 /src/mesa/swrast_setup | |
parent | 27b0758a940f19ce344f21b8db708d91933ce06d (diff) |
Support for floating point color representation in tnl module.
Diffstat (limited to 'src/mesa/swrast_setup')
-rw-r--r-- | src/mesa/swrast_setup/ss_triangle.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast_setup/ss_tritmp.h | 10 | ||||
-rw-r--r-- | src/mesa/swrast_setup/ss_vbtmp.h | 18 |
3 files changed, 19 insertions, 15 deletions
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index 958eae3a29a..a12429e26df 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -1,4 +1,4 @@ -/* $Id: ss_triangle.c,v 1.12 2001/03/12 00:48:43 gareth Exp $ */ +/* $Id: ss_triangle.c,v 1.13 2001/04/28 08:39:18 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -141,8 +141,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx, } } -#define SS_COLOR(a,b) COPY_CHAN4(a,b) -#define SS_SPEC(a,b) COPY_CHAN4(a,b) +#define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b) +#define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b) #define SS_IND(a,b) (a = b) #define IND (0) diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 0c81fb891fc..0db792ba2b5 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -1,4 +1,4 @@ -/* $Id: ss_tritmp.h,v 1.11 2001/03/21 17:11:32 pesco Exp $ */ +/* $Id: ss_tritmp.h,v 1.12 2001/04/28 08:39:18 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -61,8 +61,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (facing == 1) { if (IND & SS_TWOSIDE_BIT) { if (IND & SS_RGBA_BIT) { - GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data; - GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + GLfloat (*vbcolor)[4] = (GLfloat (*)[4])VB->ColorPtr[1]->Ptr; + GLfloat (*vbspec)[4] = (GLfloat (*)[4])VB->SecondaryColorPtr[1]->Ptr; SS_COLOR(v[0]->color, vbcolor[e0]); SS_COLOR(v[1]->color, vbcolor[e1]); SS_COLOR(v[2]->color, vbcolor[e2]); @@ -134,8 +134,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (IND & SS_TWOSIDE_BIT) { if (facing == 1) { if (IND & SS_RGBA_BIT) { - GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data; - GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data; + GLfloat (*vbcolor)[4] = (GLfloat (*)[4])VB->ColorPtr[0]->Ptr; + GLfloat (*vbspec)[4] = (GLfloat (*)[4])VB->SecondaryColorPtr[0]->Ptr; SS_COLOR(v[0]->color, vbcolor[e0]); SS_COLOR(v[1]->color, vbcolor[e1]); SS_COLOR(v[2]->color, vbcolor[e2]); diff --git a/src/mesa/swrast_setup/ss_vbtmp.h b/src/mesa/swrast_setup/ss_vbtmp.h index 0a7c1ded545..7e924b5a7e1 100644 --- a/src/mesa/swrast_setup/ss_vbtmp.h +++ b/src/mesa/swrast_setup/ss_vbtmp.h @@ -1,4 +1,4 @@ -/* $Id: ss_vbtmp.h,v 1.13 2001/03/29 16:50:33 brianp Exp $ */ +/* $Id: ss_vbtmp.h,v 1.14 2001/04/28 08:39:18 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -35,8 +35,8 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) SWvertex *v; GLfloat (*proj)[4]; /* projected clip coordinates */ GLfloat (*tc[MAX_TEXTURE_UNITS])[4]; - GLchan (*color)[4]; - GLchan (*spec)[4]; + GLfloat (*color)[4]; + GLfloat (*spec)[4]; GLuint *index; GLfloat *fog; GLfloat *pointSize; @@ -57,6 +57,10 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) } /* TODO: Get import_client_data to pad vectors out to 4 cleanly. + * + * NOTE: This has the effect of converting any remaining ubyte + * colors to floats... As they're already there 90% of the + * time, this isn't a bad thing. */ if (VB->importable_data) VB->import_data( ctx, VB->importable_data & newinputs, @@ -92,9 +96,9 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) if (IND & FOG) fog = VB->FogCoordPtr->data; if (IND & COLOR) - color = VB->ColorPtr[0]->data; + color = (GLfloat (*)[4])VB->ColorPtr[0]->Ptr; if (IND & SPEC) - spec = VB->SecondaryColorPtr[0]->data; + spec = (GLfloat (*)[4])VB->SecondaryColorPtr[0]->Ptr; if (IND & INDEX) index = VB->IndexPtr[0]->data; if (IND & POINT) @@ -120,10 +124,10 @@ static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) } if (IND & COLOR) - COPY_CHAN4(v->color, color[i]); + UNCLAMPED_FLOAT_TO_RGBA_CHAN(v->color, color[i]); if (IND & SPEC) - COPY_CHAN4(v->specular, spec[i]); + UNCLAMPED_FLOAT_TO_RGBA_CHAN(v->specular, spec[i]); if (IND & FOG) v->fog = fog[i]; |