summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-18 10:42:47 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-18 11:41:12 -0600
commit5bd119f9438b680f5e42458ef0b250662af36235 (patch)
treea1fdc0b9804c9b1ad18f57e391be07af49ad6bd0 /src/mesa/state_tracker
parent66586762f1d2a3a310cf83e177d3c659a93486c8 (diff)
handle fogcoord/raster distance
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index eb6ee51939..40807fc05a 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -187,6 +187,7 @@ update_rasterpos(GLcontext *ctx,
const float clipPos[4],
const float color0[4],
const float color1[4],
+ const float *fog,
const float *tex)
{
uint i;
@@ -232,15 +233,17 @@ update_rasterpos(GLcontext *ctx,
ctx->Current.RasterPos[3] = clipPos[3];
/* compute raster distance */
+#if 0
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
else {
-#if 0
/* XXX we don't have an eye coord! */
ctx->Current.RasterDistance =
SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] );
-#endif
}
+#else
+ ctx->Current.RasterDistance = fog[0];
+#endif
/* colors and texcoords */
COPY_4FV(ctx->Current.RasterColor, color0);
@@ -314,7 +317,7 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
/* extract values and update rasterpos state */
{
const GLuint *outputMapping = st->vertex_result_to_slot;
- const float *pos, *color0, *color1, *tex0;
+ const float *pos, *color0, *color1, *fog, *tex0;
float *buf = buf_map;
assert(outputMapping[VERT_RESULT_HPOS] != ~0);
@@ -337,6 +340,14 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
color1 = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
}
+ if (outputMapping[VERT_RESULT_FOGC] != ~0) {
+ fog = buf;
+ buf += 4;
+ }
+ else {
+ fog = ctx->Current.Attrib[VERT_ATTRIB_FOG];
+ }
+
if (outputMapping[VERT_RESULT_TEX0] != ~0) {
tex0 = buf;
buf += 4;
@@ -345,7 +356,7 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
tex0 = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
}
- update_rasterpos(ctx, pos, color0, color1, tex0);
+ update_rasterpos(ctx, pos, color0, color1, fog, tex0);
}
/* free vertex feedback buffer */