-
-
- ctx->ClipInterpFunc = clip_interp_tab[mask];
- ctx->poly_clip_tab = gl_poly_clip_tab[0];
- ctx->line_clip_tab = gl_line_clip_tab[0];
-
- if (ctx->TriangleCaps & DD_TRI_UNFILLED) {
- ctx->poly_clip_tab = gl_poly_clip_tab[1];
- ctx->line_clip_tab = gl_line_clip_tab[0];
- }
-}
-
-
-#define USER_CLIPTEST(NAME, SZ) \
-static void NAME( struct vertex_buffer *VB ) \
-{ \
- GLcontext *ctx = VB->ctx; \
- GLubyte *clipMask = VB->ClipMask; \
- GLubyte *userClipMask = VB->UserClipMask; \
- GLuint start = VB->Start; \
- GLuint count = VB->Count; \
- GLuint p, i; \
- GLubyte bit; \
- \
- \
- for (bit = 1, p = 0; p < MAX_CLIP_PLANES ; p++, bit *=2) \
- if (ctx->Transform.ClipEnabled[p]) { \
- GLuint nr = 0; \
- const GLfloat a = ctx->Transform.ClipUserPlane[p][0]; \
- const GLfloat b = ctx->Transform.ClipUserPlane[p][1]; \
- const GLfloat c = ctx->Transform.ClipUserPlane[p][2]; \
- const GLfloat d = ctx->Transform.ClipUserPlane[p][3]; \
- GLfloat *coord = VB->ClipPtr->start; \
- GLuint stride = VB->ClipPtr->stride; \
- \
- for (i = start ; i < count ; i++, STRIDE_F(coord, stride)) { \
- GLfloat dp = coord[0] * a + coord[1] * b; \
- if (SZ > 2) dp += coord[2] * c; \
- if (SZ > 3) dp += coord[3] * d; else dp += d; \
- \
- if (dp < 0) { \
- clipMask[i] |= CLIP_USER_BIT; \
- userClipMask[i] |= bit; \
- nr++; \
- } \
- } \
- \
- if (nr > 0) { \
- VB->ClipOrMask |= CLIP_USER_BIT; \
- VB->CullMode |= CLIP_MASK_ACTIVE; \
- if (nr == count - start) { \
- VB->ClipAndMask |= CLIP_USER_BIT; \
- VB->Culled = 1; \
- return; \
- } \
- } \
- } \
-}
-
-
-USER_CLIPTEST(userclip2, 2)
-USER_CLIPTEST(userclip3, 3)
-USER_CLIPTEST(userclip4, 4)
-
-static void (*(usercliptab[5]))( struct vertex_buffer * ) = {
- 0,
- 0,
- userclip2,
- userclip3,
- userclip4
-};
-
-void gl_user_cliptest( struct vertex_buffer *VB )
-{
- usercliptab[VB->ClipPtr->size]( VB );