Optimised the size of rotated bsp absmin/max. (doesn't use as many leafs, so the object does get broadcast across the net...)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@348 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-10-18 10:46:06 +00:00
parent 94181f8895
commit 0bb2a0854d

View file

@ -529,29 +529,40 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
return; return;
// set the abs box // set the abs box
if (ent->v.solid == SOLID_BSP && /* if (ent->v.solid == SOLID_BSP &&
(ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) ) (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) )
{ // expand for rotation { // expand for rotation
float max, v;
int i; int i;
max = 0; vec3_t f, r, u;
for (i=0 ; i<3 ; i++) vec3_t mn, mx;
//we need to link to the correct leaves
AngleVectors(ent->v.angles, f,r,u);
mn[0] = DotProduct(ent->v.mins, f);
mn[1] = -DotProduct(ent->v.mins, r);
mn[2] = DotProduct(ent->v.mins, u);
mx[0] = DotProduct(ent->v.maxs, f);
mx[1] = -DotProduct(ent->v.maxs, r);
mx[2] = DotProduct(ent->v.maxs, u);
for (i = 0; i < 3; i++)
{ {
v =fabs( ent->v.mins[i]); if (mn[i] < mx[i])
if (v > max) {
max = v; ent->v.absmin[i] = ent->v.origin[i]+mn[i];
v =fabs( ent->v.maxs[i]); ent->v.absmax[i] = ent->v.origin[i]+mx[i];
if (v > max) }
max = v; else
} { //box went inside out
for (i=0 ; i<3 ; i++) ent->v.absmin[i] = ent->v.origin[i]+mx[i];
{ ent->v.absmax[i] = ent->v.origin[i]+mn[i];
ent->v.absmin[i] = ent->v.origin[i] - max; }
ent->v.absmax[i] = ent->v.origin[i] + max;
} }
} }
else else*/
{ {
VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin); VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax); VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax);