[PATCH] qbsp: Use fast sphere test in FaceSide

Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
Tyrann 2007-09-23 20:46:28 +09:30
parent 67981816c7
commit 7ce4402dfc
1 changed files with 18 additions and 1 deletions

View File

@ -41,7 +41,7 @@ For BSP hueristic
==================
*/
static int
FaceSide(face_t *in, plane_t *split)
FaceSide__(face_t *in, plane_t *split)
{
bool frontcount, backcount;
vec_t dot;
@ -87,6 +87,23 @@ FaceSide(face_t *in, plane_t *split)
return SIDE_ON;
}
static int
FaceSide(face_t *in, plane_t *split)
{
vec_t dist;
int ret;
dist = DotProduct(in->origin, split->normal) - split->dist;
if (dist > in->radius)
ret = SIDE_FRONT;
else if (dist < -in->radius)
ret = SIDE_BACK;
else
ret = FaceSide__(in, split);
return ret;
}
/*
* Split a bounding box by a plane; The front and back bounds returned
* are such that they completely contain the portion of the input box