diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/swrast_setup/ss_triangle.c | 24 | ||||
-rw-r--r-- | src/mesa/swrast_setup/ss_tritmp.h | 6 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index 9633469df1c..d2f140f7ff8 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -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); diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index f84e4b91205..4407fc1e1b6 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -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; |