From 9da84b6ee1048cfafec854542da8151f850ee00a Mon Sep 17 00:00:00 2001 From: Tyrann Date: Sun, 23 Sep 2007 21:04:28 +0930 Subject: [PATCH] [PATCH] qbsp: use fast sphere test in SplitFace Signed-off-by: Tyrann --- qbsp/csg4.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/qbsp/csg4.c b/qbsp/csg4.c index 7dc31368..19bdefd4 100644 --- a/qbsp/csg4.c +++ b/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]) {