From 8c2f6c5059a60d845716277973c826f4069926e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 26 Jun 2001 01:32:48 +0000 Subject: added GL_IBM_rasterpos_clip extension --- src/mesa/main/rastpos.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/rastpos.c') diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index adc81ed478..c4f87c2ba4 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.26 2001/06/18 17:26:08 brianp Exp $ */ +/* $Id: rastpos.c,v 1.27 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -66,6 +66,20 @@ viewclip_point( const GLfloat v[] ) } +/* As above, but only clip test against far/near Z planes */ +static GLuint +viewclip_point_z( const GLfloat v[] ) +{ + if (v[2] > v[3] || v[2] < -v[3] ) { + return 0; + } + else { + return 1; + } +} + + + /* * Clip a point against the user clipping planes. * Input: v - vertex-vector describing the point to clip. @@ -292,7 +306,13 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) TRANSFORM_POINT( clip, ctx->ProjectionMatrix.m, eye ); /* clip to view volume */ - if (viewclip_point( clip )==0) { + if (ctx->Transform.RasterPositionUnclipped) { + /* GL_IBM_rasterpos_clip: only clip against Z */ + if (viewclip_point_z(clip) == 0) + ctx->Current.RasterPosValid = GL_FALSE; + } + else if (viewclip_point(clip) == 0) { + /* Normal OpenGL behaviour */ ctx->Current.RasterPosValid = GL_FALSE; return; } -- cgit v1.2.3