Exemplo n.º 1
0
/*
 * @brief
 */
static void CalcVis(void) {
	uint32_t i;

	RunThreadsOn(map_vis.num_portals * 2, true, BaseVis);

	SortPortals();

	// fast vis just uses migh_tsee for a very loose bound
	if (fastvis) {
		for (i = 0; i < map_vis.num_portals * 2; i++) {
			map_vis.portals[i].vis = map_vis.portals[i].flood;
			map_vis.portals[i].status = stat_done;
		}
	} else {
		RunThreadsOn(map_vis.num_portals * 2, true, FinalVis);
	}

	// assemble the leaf vis lists by OR-ing and compressing the portal lists
	for (i = 0; i < map_vis.portal_clusters; i++)
		ClusterMerge(i);

	if (map_vis.portal_clusters)
		Com_Print("Average clusters visible: %i\n", visibility_count / map_vis.portal_clusters);
	else
		Com_Print("Average clusters visible: 0\n");
}
Exemplo n.º 2
0
/*
   ==================
   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 );
}
Exemplo n.º 3
0
/*
==================
CalcVis
==================
*/
void CalcVis (void)
{
	int		i;

	RunThreadsOn (numportals*2, true, BasePortalVis);

	SortPortals ();
	
	CalcPortalVis ();

//
// assemble the leaf vis lists by oring and compressing the portal lists
//
	for (i=0 ; i<portalclusters ; i++)
		ClusterMerge (i);
		
	Con_Print("Average clusters visible: %i\n", totalvis / portalclusters);
}
Exemplo n.º 4
0
/*
==================
CalcVis
==================
*/
void CalcVis (void)
{
    int		i;

    if (g_bUseMPI)
    {
        RunMPIBasePortalVis();
    }
    else
    {
        RunThreadsOnIndividual (g_numportals*2, true, BasePortalVis);
    }

    SortPortals ();

    CalcPortalVis ();

    //
    // assemble the leaf vis lists by oring the portal lists
    //
    for ( i = 0; i < portalclusters; i++ )
    {
        ClusterMerge( i );
    }

    int count = 0;
    // Now crosscheck each leaf's vis and compress
    for ( i = 0; i < portalclusters; i++ )
    {
        count += CompressAndCrosscheckClusterVis( i );
    }


    Msg ("Optimized: %d visible clusters (%.2f%%)\n", count, totalvis, count*100/totalvis);
    Msg ("Total clusters visible: %i\n", totalvis);
    Msg ("Average clusters visible: %i\n", totalvis / portalclusters);
}
Exemplo n.º 5
0
/*
==================
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);
}