static void DontSeparateIslands( optimizeGroup_t* opt )
{
	int		i;
	optIsland_t	island;
	
	DrawAllEdges();
	
	memset( &island, 0, sizeof( island ) );
	island.group = opt;
	
	// link everything together
	for( i = 0 ; i < numOptVerts ; i++ )
	{
		optVerts[i].islandLink = island.verts;
		island.verts = &optVerts[i];
	}
	
	for( i = 0 ; i < numOptEdges ; i++ )
	{
		optEdges[i].islandLink = island.edges;
		island.edges = &optEdges[i];
	}
	
	OptimizeIsland( &island );
}
示例#2
0
/*
====================
SeparateIslands

While the algorithm should theoretically handle any collection
of triangles, there are speed and stability benefits to making
it work on as small a list as possible, so separate disconnected
collections of edges and process separately.

FIXME: we need to separate the source triangles before
doing this, because PointInSourceTris() can give a bad answer if
the source list has triangles not used in the optimization
====================
*/
static void SeparateIslands( optimizeGroup_t *opt ) {
	int		i;
	optIsland_t	island;
	int		numIslands;

	DrawAllEdges();

	numIslands = 0;
	for ( i = 0 ; i < numOptVerts ; i++ ) {
		if ( optVerts[i].addedToIsland ) {
			continue;
		}
		numIslands++;
		memset( &island, 0, sizeof( island ) );
		island.group = opt;
		AddVertexToIsland_r( &optVerts[i], &island );
		OptimizeIsland( &island );
	}
	if ( dmapGlobals.verbose ) {
		common->Printf( "%6i islands\n", numIslands );
	}
}