summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-04-26 17:35:45 +0000
committerBrian Paul <[email protected]>2005-04-26 17:35:45 +0000
commitd09df24082d69e534470f9a5f667b30c34ae6d74 (patch)
tree7a69534922ecef730101a3ac1bb1abcd95a97737 /src/mesa/swrast
parentc03b6f40baae1d11deaa9d1c7951ec8b5f80be81 (diff)
added interpolate_fog()
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_span.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 449ae837dcf..a541b66ceb5 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -280,6 +280,26 @@ interpolate_specular(GLcontext *ctx, struct sw_span *span)
}
+/* Fill in the span.array.fog values from the interpolation values */
+static void
+interpolate_fog(const GLcontext *ctx, struct sw_span *span)
+{
+ GLfloat *fog = span->array->fog;
+ const GLfloat fogStep = span->fogStep;
+ GLfloat fogCoord = span->fog;
+ const GLuint haveW = (span->interpMask & SPAN_W);
+ const GLfloat wStep = haveW ? span->dwdx : 0.0F;
+ GLfloat w = haveW ? span->w : 1.0F;
+ GLuint i;
+ for (i = 0; i < span->end; i++) {
+ fog[i] = fogCoord / w;
+ fogCoord += fogStep;
+ w += wStep;
+ }
+ span->arrayMask |= SPAN_FOG;
+}
+
+
/* Fill in the span.zArray array from the interpolation values */
void
_swrast_span_interpolate_z( const GLcontext *ctx, struct sw_span *span )
@@ -1150,6 +1170,9 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
if (span->interpMask & SPAN_SPEC)
interpolate_specular(ctx, span);
+ if (span->interpMask & SPAN_FOG)
+ interpolate_fog(ctx, span);
+
/* Compute fragment colors with fragment program or texture lookups */
if (ctx->FragmentProgram._Enabled)
/* XXX interpolate depth values here??? */
@@ -1226,6 +1249,9 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
if (span->interpMask & SPAN_SPEC)
interpolate_specular(ctx, span);
+ if (span->interpMask & SPAN_FOG)
+ interpolate_fog(ctx, span);
+
if (ctx->FragmentProgram._Enabled)
_swrast_exec_fragment_program( ctx, span );
else if (ctx->ATIFragmentShader._Enabled)