/* =================== OptimizeGroupList This will also fix tjunctions =================== */ void OptimizeGroupList( optimizeGroup_t *groupList ) { int c_in, c_edge, c_tjunc2; optimizeGroup_t *group; if ( !groupList ) { return; } c_in = CountGroupListTris( groupList ); // optimize and remove colinear edges, which will // re-introduce some t junctions for ( group = groupList ; group ; group = group->nextGroup ) { OptimizeOptList( group ); } c_edge = CountGroupListTris( groupList ); // fix t junctions again FixAreaGroupsTjunctions( groupList ); FreeTJunctionHash(); c_tjunc2 = CountGroupListTris( groupList ); SetGroupTriPlaneNums( groupList ); common->Printf( "----- OptimizeAreaGroups Results -----\n" ); common->Printf( "%6i tris in\n", c_in ); common->Printf( "%6i tris after edge removal optimization\n", c_edge ); common->Printf( "%6i tris after final t junction fixing\n", c_tjunc2 ); }
/* ==================== OptimizeOptList ==================== */ static void OptimizeOptList( optimizeGroup_t *opt ) { optimizeGroup_t *oldNext; // fix the t junctions among this single list // so we can match edges // can we avoid doing this if colinear vertexes break edges? oldNext = opt->nextGroup; opt->nextGroup = NULL; FixAreaGroupsTjunctions( opt ); opt->nextGroup = oldNext; // create the 2D vectors dmapGlobals.mapPlanes[opt->planeNum].Normal().NormalVectors( opt->axis[0], opt->axis[1] ); AddOriginalEdges( opt ); SplitOriginalEdgesAtCrossings( opt ); #if 0 // seperate any discontinuous areas for individual optimization // to reduce the scope of the problem SeparateIslands( opt ); #else DontSeparateIslands( opt ); #endif // now free the hash verts FreeTJunctionHash(); // free the original list and use the new one FreeTriList( opt->triList ); opt->triList = opt->regeneratedTris; opt->regeneratedTris = NULL; }
/* ================== FixEntityTjunctions ================== */ void FixEntityTjunctions( uEntity_t *e ) { int i; for ( i = 0 ; i < e->numAreas ; i++ ) { FixAreaGroupsTjunctions( e->areas[i].groups ); FreeTJunctionHash(); } }