diff options
author | Brian Paul <[email protected]> | 2001-06-18 23:55:18 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-06-18 23:55:18 +0000 |
commit | af197f5f8f182c04ab29cd3c7a18a0cb95a1d9b7 (patch) | |
tree | 649bd925155c134f8cef5807ce356f227768db52 /src/mesa/swrast/s_copypix.c | |
parent | aba535e765336ceddd23a303514ef7e223b8dc28 (diff) |
fix glDraw/CopyPixels w/ fog bug. minor fog code clean-ups.
Diffstat (limited to 'src/mesa/swrast/s_copypix.c')
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 47 |
1 files changed, 38 insertions, 9 deletions
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;i<width;i++) { zspan[i] = z; fogSpan[i] = fog; @@ -603,8 +618,15 @@ static void copy_ci_pixels( GLcontext *ctx, 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;i<width;i++) { zspan[i] = z; fogSpan[i] = fog; @@ -745,8 +767,15 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } if (ctx->Fog.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; } |