[PATCH] qbsp: use fast sphere test in SplitFace

Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
Tyrann 2007-09-23 21:04:28 +09:30
parent 1d2cc1b780
commit 9da84b6ee1
1 changed files with 11 additions and 1 deletions

View File

@ -105,7 +105,17 @@ SplitFace(face_t *in, plane_t *split, face_t **front, face_t **back)
if (in->w.numpoints < 0)
Message(msgError, errFreedFace);
CalcSides(&in->w, split, sides, dists, counts);
/* Fast test */
dot = DotProduct(in->origin, split->normal) - split->dist;
if (dot > in->radius) {
counts[SIDE_FRONT] = 1;
counts[SIDE_BACK] = 0;
} else if (dot < -in->radius) {
counts[SIDE_FRONT] = 0;
counts[SIDE_BACK] = 1;
} else {
CalcSides(&in->w, split, sides, dists, counts);
}
// Plane doesn't split this face after all
if (!counts[SIDE_FRONT]) {