This commit is contained in:
Garux
2021-03-02 22:01:09 +03:00
parent 9446aeca8e
commit f9a424b6c8
30 changed files with 321 additions and 1000 deletions

View File

@@ -369,26 +369,21 @@ void CalcVis( void ){
==================
*/
void SetPortalSphere( vportal_t *p ){
int i;
Vector3 total( 0, 0, 0 );
fixedWinding_t *w;
float r, bestr;
w = p->winding;
for ( i = 0 ; i < w->numpoints ; i++ )
for ( int i = 0; i < w->numpoints; i++ )
{
total += w->points[i];
}
total /= w->numpoints;
bestr = 0;
for ( i = 0 ; i < w->numpoints ; i++ )
double bestr = 0;
for ( int i = 0; i < w->numpoints; i++ )
{
r = vector3_length( w->points[i] - total );
if ( r > bestr ) {
bestr = r;
}
value_maximize( bestr, vector3_length( w->points[i] - total ) );
}
p->origin = total;
p->radius = bestr;