level/solidbsp.c
/*	Selects a surface from a linked list of surfaces to split the group on
	returns NULL if the surface list can not be divided any more (a leaf)
*/
Selects a surface from a linked list of surfaces to split the group on
returns NULL if the surface list can not be divided any more (a leaf)
Selects a surface from a linked list of surfaces to split the group on returns NULL if the surface list can not be divided any more ( a leaf )
surface_t *SelectPartition( surface_t *surfaces )
{
	int			i;
	vec3_t		mins, maxs;
	surface_t	*p, *bestsurface;
	ClearBounds( mins, maxs );
	i = 0;
	bestsurface = NULL;
	for( p = surfaces; p; p = p->next ) {
		AddPointToBounds( p->mins, mins, maxs );
		AddPointToBounds( p->maxs, mins, maxs );
		if( !p->onnode ) {
			i++;
			bestsurface = p;
		}
	}
	if( !i )
		return NULL;
	else if( i == 1 )
		return bestsurface;	
	if( usemidsplit ) 
		return ChooseMidPlaneFromList( surfaces, mins, maxs );
	return ChoosePlaneFromList( surfaces, mins, maxs );
}
surface_t * SelectPartition ( surface_t * surfaces ) { int i ; vec3_t mins , maxs ; surface_t * p , * bestsurface ; ClearBounds ( mins , maxs ) ; i = 0 ; bestsurface = NULL ; for ( p = surfaces ; p ; p = p -> next ) { AddPointToBounds ( p -> mins , mins , maxs ) ; AddPointToBounds ( p -> maxs , mins , maxs ) ; if ( ! p -> onnode ) { i ++ ; bestsurface = p ; } } if ( ! i ) return NULL ; else if ( i == 1 ) return bestsurface ; if ( usemidsplit ) return ChooseMidPlaneFromList ( surfaces , mins , maxs ) ; return ChoosePlaneFromList ( surfaces , mins , maxs ) ; }
Selects a surface from a linked list of surfaces to split the group on
returns NULL if the surface list can not be divided any more (a leaf)
Selects a surface from a linked list of surfaces to split the group on returns NULL if the surface list can not be divided any more ( a leaf )
// calculate a bounding box of the entire surfaceset // count onnode surfaces // this is a final split // do fast way for clipping hull // do slow way to save poly splits for drawing hull