diff options
author | Brian Paul <brianp@vmware.com> | 2009-08-27 16:54:32 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-08-27 16:54:32 -0600 |
commit | e363ec1d08858735c6f2b1454c43f39c96d5bab6 (patch) | |
tree | af83e165bd5fba58851f6e65ed3071f2c221005d /src/mesa/swrast/s_triangle.c | |
parent | c2ef10803d6c30e13f8f762cc874e3bccc8a2881 (diff) | |
parent | 0d7bed9f8973547b675c35c0083996e946d7cecb (diff) |
Merge branch 'mesa_7_5_branch'
Diffstat (limited to 'src/mesa/swrast/s_triangle.c')
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 9260e35066..1d2fed7169 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -44,8 +44,9 @@ #include "s_triangle.h" -/* - * Just used for feedback mode. +/** + * Test if a triangle should be culled. Used for feedback and selection mode. + * \return GL_TRUE if the triangle is to be culled, GL_FALSE otherwise. */ GLboolean _swrast_culltriangle( GLcontext *ctx, @@ -53,16 +54,17 @@ _swrast_culltriangle( GLcontext *ctx, const SWvertex *v1, const SWvertex *v2 ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat ex = v1->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; GLfloat ey = v1->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; GLfloat fx = v2->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; GLfloat c = ex*fy-ey*fx; - if (c * SWRAST_CONTEXT(ctx)->_BackfaceCullSign > 0) - return 0; + if (c * swrast->_BackfaceSign * swrast->_BackfaceCullSign < 0.0F) + return GL_FALSE; - return 1; + return GL_TRUE; } |