mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
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:
parent
94181f8895
commit
0bb2a0854d
1 changed files with 27 additions and 16 deletions
|
@ -529,29 +529,40 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
|||
return;
|
||||
|
||||
// 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]) )
|
||||
{ // expand for rotation
|
||||
float max, v;
|
||||
int i;
|
||||
|
||||
max = 0;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
vec3_t f, r, u;
|
||||
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 (v > max)
|
||||
max = v;
|
||||
v =fabs( ent->v.maxs[i]);
|
||||
if (v > max)
|
||||
max = v;
|
||||
}
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
ent->v.absmin[i] = ent->v.origin[i] - max;
|
||||
ent->v.absmax[i] = ent->v.origin[i] + max;
|
||||
if (mn[i] < mx[i])
|
||||
{
|
||||
ent->v.absmin[i] = ent->v.origin[i]+mn[i];
|
||||
ent->v.absmax[i] = ent->v.origin[i]+mx[i];
|
||||
}
|
||||
else
|
||||
{ //box went inside out
|
||||
ent->v.absmin[i] = ent->v.origin[i]+mx[i];
|
||||
ent->v.absmax[i] = ent->v.origin[i]+mn[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else*/
|
||||
{
|
||||
VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
|
||||
VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax);
|
||||
|
|
Loading…
Reference in a new issue