[PATCH] qbsp: use fast sphere test in SplitFace
Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
parent
1d2cc1b780
commit
9da84b6ee1
12
qbsp/csg4.c
12
qbsp/csg4.c
|
|
@ -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]) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue