summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-06-26 21:15:35 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-06-26 21:15:35 +0000
commitacc722d4b890da7ed0ede24751e2bcaf28cc1468 (patch)
tree38472ec2d8479c98189f2ce0f4e365ece59ea14e /src/mesa/swrast
parent33170eeb185f5fe766374a749464497cdfab6931 (diff)
More raster fog coord fixes.
New truncate vs. floor comments in drawpixels.c Added current raster secondary color state, not used yet.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_bitmap.c20
-rw-r--r--src/mesa/swrast/s_copypix.c34
-rw-r--r--src/mesa/swrast/s_drawpix.c18
3 files changed, 29 insertions, 43 deletions
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; row<height; row++) {
@@ -95,7 +93,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
for (col=0; col<width; col++) {
if (*src & mask) {
- PB_WRITE_PIXEL( PB, px+col, py+row, fragZ, fogCoord );
+ PB_WRITE_PIXEL( PB, px+col, py+row, fragZ, fog );
}
if (mask == 128U) {
src++;
@@ -117,7 +115,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
for (col=0; col<width; col++) {
if (*src & mask) {
- PB_WRITE_PIXEL( PB, px+col, py+row, fragZ, fogCoord );
+ PB_WRITE_PIXEL( PB, px+col, py+row, fragZ, fog );
}
if (mask == 1U) {
src++;
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 3c7ee260d9..ab8198945c 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.20 2001/06/18 23:55:18 brianp Exp $ */
+/* $Id: s_copypix.c,v 1.21 2001/06/26 21:15:36 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -114,12 +114,10 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
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 < 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;i<width;i++) {
zspan[i] = z;
@@ -620,12 +616,10 @@ static void copy_ci_pixels( GLcontext *ctx,
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;i<width;i++) {
zspan[i] = z;
@@ -769,12 +763,10 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
if (ctx->Fog.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<width;i++) {
zspan[i] = z;