Defines | |
#define | CLIP_DOTPROD(K, A, B, C, D) X(K)*A + Y(K)*B + Z(K)*C + W(K)*D |
#define | POLY_CLIP(PLANE_BIT, A, B, C, D) |
#define | LINE_CLIP(PLANE_BIT, A, B, C, D) |
Functions | |
static INLINE void TAG() | clip_line (GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask) |
static INLINE void TAG() | clip_tri (GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask) |
static INLINE void TAG() | clip_quad (GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLubyte mask) |
#define CLIP_DOTPROD | ( | K, | |||
A, | |||||
B, | |||||
C, | |||||
D | ) | X(K)*A + Y(K)*B + Z(K)*C + W(K)*D |
#define LINE_CLIP | ( | PLANE_BIT, | |||
A, | |||||
B, | |||||
C, | |||||
D | ) |
Value:
do { \ if (mask & PLANE_BIT) { \ const GLfloat dp0 = CLIP_DOTPROD( v0, A, B, C, D ); \ const GLfloat dp1 = CLIP_DOTPROD( v1, A, B, C, D ); \ const GLboolean neg_dp0 = IS_NEGATIVE(dp0); \ const GLboolean neg_dp1 = IS_NEGATIVE(dp1); \ \ /* For regular clipping, we know from the clipmask that one \ * (or both) of these must be negative (otherwise we wouldn't \ * be here). \ * For userclip, there is only a single bit for all active \ * planes, so we can end up here when there is nothing to do, \ * hence the second IS_NEGATIVE() test: \ */ \ if (neg_dp0 && neg_dp1) \ return; /* both vertices outside clip plane: discard */ \ \ if (neg_dp1) { \ GLfloat t = dp1 / (dp1 - dp0); \ if (t > t1) t1 = t; \ } else if (neg_dp0) { \ GLfloat t = dp0 / (dp0 - dp1); \ if (t > t0) t0 = t; \ } \ if (t0 + t1 >= 1.0) \ return; /* discard */ \ } \ } while (0)
#define POLY_CLIP | ( | PLANE_BIT, | |||
A, | |||||
B, | |||||
C, | |||||
D | ) |
static INLINE void TAG() clip_quad | ( | GLcontext * | ctx, | |
GLuint | v0, | |||
GLuint | v1, | |||
GLuint | v2, | |||
GLuint | v3, | |||
GLubyte | mask | |||
) | [static] |
static INLINE void TAG() clip_tri | ( | GLcontext * | ctx, | |
GLuint | v0, | |||
GLuint | v1, | |||
GLuint | v2, | |||
GLubyte | mask | |||
) | [static] |