summaryrefslogtreecommitdiff
path: root/src/mesa/main/feedback.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-03-03 17:47:39 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-03-03 17:47:39 +0000
commited30dfa1264ec8875a3162c3c8778bc703bf11d5 (patch)
tree41e44fc1f73964396c96dea1452f235b42ff46ec /src/mesa/main/feedback.c
parent8df3d8ae6c48cbbe649e8cfeebd8a99f983784f7 (diff)
runtime selectable depth buffer depth
Diffstat (limited to 'src/mesa/main/feedback.c')
-rw-r--r--src/mesa/main/feedback.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 71c1025d90..3a38db1d62 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -1,4 +1,4 @@
-/* $Id: feedback.c,v 1.8 2000/01/25 16:49:20 brianp Exp $ */
+/* $Id: feedback.c,v 1.9 2000/03/03 17:47:39 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -133,6 +133,7 @@ void gl_feedback_vertex( GLcontext *ctx,
FEEDBACK_TOKEN( ctx, win[0] );
FEEDBACK_TOKEN( ctx, win[1] );
if (ctx->Feedback.Mask & FB_3D) {
+ printf("FB %g\n", win[2]);
FEEDBACK_TOKEN( ctx, win[2] );
}
if (ctx->Feedback.Mask & FB_4D) {
@@ -168,7 +169,7 @@ static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv )
win[0] = VB->Win.data[v][0];
win[1] = VB->Win.data[v][1];
- win[2] = VB->Win.data[v][2] / DEPTH_SCALE;
+ win[2] = VB->Win.data[v][2] / ctx->Visual->DepthMaxF;
win[3] = 1.0 / VB->Win.data[v][3];
if (ctx->Light.ShadeModel == GL_SMOOTH)
@@ -299,12 +300,13 @@ void gl_update_hitflag( GLcontext *ctx, GLfloat z )
void gl_select_triangle( GLcontext *ctx,
GLuint v0, GLuint v1, GLuint v2, GLuint pv )
{
- struct vertex_buffer *VB = ctx->VB;
+ const struct vertex_buffer *VB = ctx->VB;
if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) {
- gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE );
- gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE );
- gl_update_hitflag( ctx, VB->Win.data[v2][2] / DEPTH_SCALE );
+ const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF;
+ gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs );
+ gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs );
+ gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs );
}
}
@@ -312,21 +314,22 @@ void gl_select_triangle( GLcontext *ctx,
void gl_select_line( GLcontext *ctx,
GLuint v0, GLuint v1, GLuint pv )
{
- struct vertex_buffer *VB = ctx->VB;
-
- gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE );
- gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE );
+ const struct vertex_buffer *VB = ctx->VB;
+ const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF;
+ gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs );
+ gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs );
}
void gl_select_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
+ const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF;
GLuint i;
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
- gl_update_hitflag( ctx, VB->Win.data[i][2] / DEPTH_SCALE);
+ gl_update_hitflag( ctx, VB->Win.data[i][2] * zs );
}
}
}