From af197f5f8f182c04ab29cd3c7a18a0cb95a1d9b7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 Jun 2001 23:55:18 +0000 Subject: fix glDraw/CopyPixels w/ fog bug. minor fog code clean-ups. --- src/mesa/swrast/s_copypix.c | 47 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'src/mesa/swrast/s_copypix.c') diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index f9d84975a58..3c7ee260d9e 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -1,4 +1,4 @@ -/* $Id: s_copypix.c,v 1.19 2001/05/30 15:22:05 brianp Exp $ */ +/* $Id: s_copypix.c,v 1.20 2001/06/18 23:55:18 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -37,6 +37,7 @@ #include "s_context.h" #include "s_depth.h" +#include "s_fog.h" #include "s_histogram.h" #include "s_pixeltex.h" #include "s_span.h" @@ -110,9 +111,16 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); - GLfloat fog = (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ? - ctx->Current.RasterFogCoord : ctx->Current.RasterDistance; + GLfloat fog; GLint i; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { + fog = ctx->Current.RasterFogCoord; + } + else { + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + } + for (i = 0; i < width; i++) { zspan[i] = z; fogSpan[i] = fog; @@ -344,8 +352,15 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); - GLfloat fog = (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ? - ctx->Current.RasterFogCoord : ctx->Current.RasterDistance; + GLfloat fog; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { + fog = ctx->Current.RasterFogCoord; + } + else { + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + } + for (i=0;iDepth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); - GLfloat fog = (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ? - ctx->Current.RasterFogCoord : ctx->Current.RasterDistance; + GLfloat fog; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { + fog = ctx->Current.RasterFogCoord; + } + else { + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + } + for (i=0;iFog.Enabled) { - GLfloat fog = (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ? - ctx->Current.RasterFogCoord : ctx->Current.RasterDistance; + GLfloat fog; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { + fog = ctx->Current.RasterFogCoord; + } + else { + fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + } + for (i = 0; i < width; i++) { fogSpan[i] = fog; } -- cgit v1.2.3