less spammy vis output

git-svn-id: svn://svn.icculus.org/netradiant/trunk@325 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
divverent 2009-04-23 16:49:14 +00:00
parent d909e5b8c7
commit e6fa8d7f3c
2 changed files with 22 additions and 9 deletions

View File

@ -2082,9 +2082,6 @@ Q_EXTERN qboolean hint; /* ydnar */
Q_EXTERN char inbase[ MAX_QPATH ]; Q_EXTERN char inbase[ MAX_QPATH ];
Q_EXTERN char globalCelShader[ MAX_QPATH ]; Q_EXTERN char globalCelShader[ MAX_QPATH ];
/* other bits */
Q_EXTERN int totalvis;
Q_EXTERN float farPlaneDist; /* rr2do2, rf, mre, ydnar all contributed to this one... */ Q_EXTERN float farPlaneDist; /* rr2do2, rf, mre, ydnar all contributed to this one... */
Q_EXTERN int numportals; Q_EXTERN int numportals;

View File

@ -167,6 +167,7 @@ ClusterMerge
Merges the portal visibility for a leaf Merges the portal visibility for a leaf
=============== ===============
*/ */
static int clustersizehistogram[MAX_MAP_LEAFS] = {0};
void ClusterMerge (int leafnum) void ClusterMerge (int leafnum)
{ {
leaf_t *leaf; leaf_t *leaf;
@ -212,9 +213,8 @@ void ClusterMerge (int leafnum)
numvis++; // count the leaf itself numvis++; // count the leaf itself
totalvis += numvis; //Sys_FPrintf (SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis);
++clustersizehistogram[numvis];
Sys_FPrintf (SYS_VRB,"cluster %4i : %4i visible\n", leafnum, numvis);
memcpy (bspVisBytes + VIS_HEADER_SIZE + leafnum*leafbytes, uncompressed, leafbytes); memcpy (bspVisBytes + VIS_HEADER_SIZE + leafnum*leafbytes, uncompressed, leafbytes);
} }
@ -312,6 +312,7 @@ void CalcVis (void)
{ {
int i; int i;
const char *value; const char *value;
double mu, sigma, totalvis, totalvis2;
/* ydnar: rr2do2's farplane code */ /* ydnar: rr2do2's farplane code */
@ -357,9 +358,24 @@ void CalcVis (void)
Sys_Printf("creating leaf vis...\n"); Sys_Printf("creating leaf vis...\n");
for (i=0 ; i<portalclusters ; i++) for (i=0 ; i<portalclusters ; i++)
ClusterMerge (i); ClusterMerge (i);
Sys_Printf( "Total visible clusters: %i\n", totalvis ); totalvis = 0;
Sys_Printf( "Average clusters visible: %i\n", totalvis / portalclusters ); totalvis2 = 0;
for(i = 0; i < MAX_MAP_LEAFS; ++i)
if(clustersizehistogram[i])
{
Sys_FPrintf(SYS_VRB, "%4i clusters have exactly %4i visible clusters\n", clustersizehistogram[i], i);
totalvis += ((double) i) * ((double) clustersizehistogram[i]);
totalvis2 += ((double) i) * ((double) i) * ((double) clustersizehistogram[i]);
/* cast is to prevent integer overflow */
}
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 sdev=%.2f\n", mu, sigma);
} }
/* /*