/* ================== CalcVis ================== */ void CalcVis( void ){ int i; const char *value; /* ydnar: rr2do2's farplane code */ farPlaneDist = 0.0f; value = ValueForKey( &entities[ 0 ], "_farplanedist" ); /* proper '_' prefixed key */ if ( value[ 0 ] == '\0' ) { value = ValueForKey( &entities[ 0 ], "fogclip" ); /* wolf compatibility */ } if ( value[ 0 ] == '\0' ) { value = ValueForKey( &entities[ 0 ], "distancecull" ); /* sof2 compatibility */ } if ( value[ 0 ] != '\0' ) { farPlaneDist = atof( value ); if ( farPlaneDist > 0.0f ) { Sys_Printf( "farplane distance = %.1f\n", farPlaneDist ); } else{ farPlaneDist = 0.0f; } } Sys_Printf( "\n--- BasePortalVis (%d) ---\n", numportals * 2 ); RunThreadsOnIndividual( numportals * 2, qtrue, BasePortalVis ); // RunThreadsOnIndividual (numportals*2, qtrue, BetterPortalVis); SortPortals(); if ( fastvis ) { CalcFastVis(); } else if ( noPassageVis ) { CalcPortalVis(); } else if ( passageVisOnly ) { CalcPassageVis(); } else { CalcPassagePortalVis(); } // // assemble the leaf vis lists by oring and compressing the portal lists // Sys_Printf( "creating leaf vis...\n" ); for ( i = 0 ; i < portalclusters ; i++ ) ClusterMerge( i ); Sys_Printf( "Total visible clusters: %i\n", totalvis ); Sys_Printf( "Average clusters visible: %i\n", totalvis / portalclusters ); }
/* ================== CalcVis ================== */ void CalcVis(void) { int i, minvis, maxvis; const char *value; double mu, sigma, totalvis, totalvis2; /* ydnar: rr2do2's farplane code */ farPlaneDist = 0.0f; value = ValueForKey(&entities[0], "_farplanedist"); /* proper '_' prefixed key */ if(value[0] == '\0') value = ValueForKey(&entities[0], "fogclip"); /* wolf compatibility */ if(value[0] == '\0') value = ValueForKey(&entities[0], "distancecull"); /* sof2 compatibility */ if(value[0] != '\0') { farPlaneDist = atof(value); if(farPlaneDist > 0.0f) Sys_Printf("farplane distance = %.1f\n", farPlaneDist); else farPlaneDist = 0.0f; } Sys_Printf("\n--- BasePortalVis (%d) ---\n", numportals * 2); RunThreadsOnIndividual(numportals * 2, qtrue, BasePortalVis); // RunThreadsOnIndividual (numportals*2, qtrue, BetterPortalVis); SortPortals(); if(fastvis) { CalcFastVis(); } else if(noPassageVis) { CalcPortalVis(); } else if(passageVisOnly) { CalcPassageVis(); } else { CalcPassagePortalVis(); } // // assemble the leaf vis lists by oring and compressing the portal lists // Sys_Printf("creating leaf vis...\n"); for(i = 0; i < portalclusters; i++) ClusterMerge(i); totalvis = 0; totalvis2 = 0; minvis = -1; maxvis = -1; for(i = 0; i < MAX_MAP_LEAFS; ++i) if(clustersizehistogram[i]) { if(debugCluster) Sys_FPrintf(SYS_VRB, "%4i clusters have exactly %4i visible clusters\n", clustersizehistogram[i], i); /* cast is to prevent integer overflow */ totalvis += ((double)i) * ((double)clustersizehistogram[i]); totalvis2 += ((double)i) * ((double)i) * ((double)clustersizehistogram[i]); if(minvis < 0) minvis = i; maxvis = i; } mu = totalvis / portalclusters; sigma = sqrt(totalvis2 / portalclusters - mu * mu); Sys_Printf("Total clusters: %i\n", portalclusters); Sys_Printf("Total visible clusters: %.0f\n", totalvis); Sys_Printf("Average clusters visible: %.2f (%.3f%%/total)\n", mu, mu / portalclusters * 100.0); Sys_Printf(" Standard deviation: %.2f (%.3f%%/total, %.3f%%/avg)\n", sigma, sigma / portalclusters * 100.0, sigma / mu * 100.0); Sys_Printf(" Minimum: %i (%.3f%%/total, %.3f%%/avg)\n", minvis, minvis / (double)portalclusters * 100.0, minvis / mu * 100.0); Sys_Printf(" Maximum: %i (%.3f%%/total, %.3f%%/avg)\n", maxvis, maxvis / (double)portalclusters * 100.0, maxvis / mu * 100.0); }