From acc722d4b890da7ed0ede24751e2bcaf28cc1468 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 26 Jun 2001 21:15:35 +0000 Subject: More raster fog coord fixes. New truncate vs. floor comments in drawpixels.c Added current raster secondary color state, not used yet. --- src/mesa/swrast/s_bitmap.c | 20 +++++++++----------- src/mesa/swrast/s_copypix.c | 34 +++++++++++++--------------------- src/mesa/swrast/s_drawpix.c | 18 +++++++----------- 3 files changed, 29 insertions(+), 43 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 17387ba0af..5f12993314 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -1,4 +1,4 @@ -/* $Id: s_bitmap.c,v 1.11 2001/06/18 23:55:18 brianp Exp $ */ +/* $Id: s_bitmap.c,v 1.12 2001/06/26 21:15:36 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -49,7 +49,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, struct pixel_buffer *PB = swrast->PB; GLint row, col; GLdepth fragZ; - GLfloat fogCoord; + GLfloat fog; ASSERT(ctx->RenderMode == GL_RENDER); ASSERT(bitmap); @@ -75,15 +75,13 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, fragZ = (GLdepth) ( ctx->Current.RasterPos[2] * ctx->DepthMaxF); if (ctx->Fog.Enabled) { - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fogCoord = ctx->Current.FogCoord; - } - else { - fogCoord = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.FogCoord); + else + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); } else { - fogCoord = 0.0; + fog = 0.0; } for (row=0; rowSkipPixels & 0x7); for (col=0; col> (unpack->SkipPixels & 0x7); for (col=0; colFog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fog = ctx->Current.RasterFogCoord; - } - else { + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); + else fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } for (i = 0; i < width; i++) { zspan[i] = z; @@ -354,12 +352,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); GLfloat fog; - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fog = ctx->Current.RasterFogCoord; - } - else { + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); + else fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } for (i=0;iCurrent.RasterPos[2] * ctx->DepthMax); GLfloat fog; - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fog = ctx->Current.RasterFogCoord; - } - else { + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); + else fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } for (i=0;iFog.Enabled) { GLfloat fog; - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fog = ctx->Current.RasterFogCoord; - } - else { + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); + else fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } for (i = 0; i < width; i++) { fogSpan[i] = fog; diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index fb11af5e44..e618dc0a23 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -1,4 +1,4 @@ -/* $Id: s_drawpix.c,v 1.21 2001/06/18 23:55:18 brianp Exp $ */ +/* $Id: s_drawpix.c,v 1.22 2001/06/26 21:15:36 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -501,12 +501,10 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, GLfloat fog; GLint i; - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fog = ctx->Current.RasterFogCoord; - } - else { + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); + else fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } for (i = 0; i < drawWidth; i++) { zspan[i] = zval; @@ -747,12 +745,10 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, GLfloat fog; GLint i; - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { - fog = ctx->Current.RasterFogCoord; - } - else { + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); + else fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - } for (i=0;i