/** Set to 1 to enable printing of coords before/after clipping */
#define DEBUG_CLIP 0
-
-#ifndef DIFFERENT_SIGNS
-#define DIFFERENT_SIGNS(x, y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
-#endif
-
#define MAX_CLIPPED_VERTICES ((2 * (6 + PIPE_MAX_CLIP_PLANES))+1)
/*
* If we ever generated a tri (regardless if it had area or not),
* skip all subsequent null tris.
- * FIXME: it is unclear why we always have to emit at least one
- * tri. Maybe this is hiding bugs elsewhere.
+ * FIXME: I think this logic was hiding bugs elsewhere. It should
+ * be possible now to always emit all tris.
*/
if (tri_null && tri_emitted) {
continue;
for (i = 1; i <= n; i++) {
struct vertex_header *vert = inlist[i];
boolean *edge = &inEdges[i];
+ boolean different_sign;
float dp = getclipdist(clipper, vert, plane_idx);
return;
outEdges[outcount] = *edge_prev;
outlist[outcount++] = vert_prev;
+ different_sign = dp < 0.0f;
+ } else {
+ different_sign = !(dp < 0.0f);
}
- if (DIFFERENT_SIGNS(dp, dp_prev)) {
+ if (different_sign) {
struct vertex_header *new_vert;
boolean *new_edge;
if (dp < 0.0f) {
/* Going out of bounds. Avoid division by zero as we
- * know dp != dp_prev from DIFFERENT_SIGNS, above.
+ * know dp != dp_prev from different_sign, above.
*/
float t = dp / (dp - dp_prev);
interp( clipper, new_vert, t, vert, vert_prev, viewport_index );