summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-01-17 16:16:35 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-01-17 16:16:35 +0000
commitea28a5b5b30658771ce3da210e534d449be56805 (patch)
tree320c5fc7dbd5e69fcfc3c56f67c85c554e107adc /src/mesa/swrast
parent730fabd67ab86c6ab13b4b66de3f640a172e8e76 (diff)
use FABSF(fogCoord) to fix fog calculation problem (Soju Matsumoto)
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_fog.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 613759d1c1..0af9cd8f28 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.3
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -109,7 +109,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span )
GLuint i;
for (i = 0; i < span->end; i++) {
GLfloat f, oneMinusF;
- f = (fogEnd - fogCoord / w) * fogScale;
+ f = (fogEnd - FABSF(fogCoord) / w) * fogScale;
f = CLAMP(f, 0.0F, 1.0F);
oneMinusF = 1.0F - f;
rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog);
@@ -130,7 +130,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span )
GLuint i;
for (i = 0; i < span->end; i++) {
GLfloat f, oneMinusF;
- f = (GLfloat) exp(density * fogCoord / w);
+ f = (GLfloat) exp(density * FABSF(fogCoord) / w);
f = CLAMP(f, 0.0F, 1.0F);
oneMinusF = 1.0F - f;
rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog);