fix culling problem (bug 630649)

This commit is contained in:
Brian Paul 2002-10-29 22:25:57 +00:00
parent 05a4b37707
commit 46b3f97654
2 changed files with 24 additions and 6 deletions

View file

@ -1,4 +1,4 @@
/* $Id: ss_triangle.c,v 1.19 2002/10/29 20:29:00 brianp Exp $ */
/* $Id: ss_triangle.c,v 1.20 2002/10/29 22:25:57 brianp Exp $ */
/*
* Mesa 3-D graphics library
@ -48,7 +48,8 @@ static quad_func quad_tab[SS_MAX_TRIFUNC];
static void _swsetup_render_line_tri( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2 )
GLuint e0, GLuint e1, GLuint e2,
GLuint facing )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
@ -61,6 +62,14 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
GLchan s[2][4];
GLuint i[2];
/* cull testing */
if (ctx->Polygon.CullFlag) {
if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT)
return;
if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK)
return;
}
if (ctx->_TriangleCaps & DD_FLATSHADE) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
@ -98,7 +107,8 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
}
static void _swsetup_render_point_tri( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2 )
GLuint e0, GLuint e1, GLuint e2,
GLuint facing )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
@ -111,6 +121,14 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
GLchan s[2][4];
GLuint i[2];
/* cull testing */
if (ctx->Polygon.CullFlag) {
if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT)
return;
if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK)
return;
}
if (ctx->_TriangleCaps & DD_FLATSHADE) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);

View file

@ -1,4 +1,4 @@
/* $Id: ss_tritmp.h,v 1.18 2002/10/29 20:29:00 brianp Exp $ */
/* $Id: ss_tritmp.h,v 1.19 2002/10/29 22:25:57 brianp Exp $ */
/*
* Mesa 3-D graphics library
@ -112,14 +112,14 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
v[1]->win[2] += offset;
v[2]->win[2] += offset;
}
_swsetup_render_point_tri( ctx, e0, e1, e2 );
_swsetup_render_point_tri( ctx, e0, e1, e2, facing );
} else if (mode == GL_LINE) {
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
v[2]->win[2] += offset;
}
_swsetup_render_line_tri( ctx, e0, e1, e2 );
_swsetup_render_line_tri( ctx, e0, e1, e2, facing );
} else {
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) {
v[0]->win[2] += offset;