示例#1
0
static void
CalcVis (void)
{
	int         i;

	BasePortalVis ();
	CalcPortalVis ();

	// assemble the leaf vis lists by oring and compressing the portal lists
	for (i = 0; i < portalclusters; i++)
		ClusterFlow (i);

	for (i = 0; i < numrealleafs; i++) {
		bsp->leafs[i + 1].visofs = clusters[leafcluster[i]].visofs;
	}
	if (options.verbosity >= 0)
		printf ("average clusters visible: %i\n", totalvis / portalclusters);
}
示例#2
0
/*
  ==================
  CalcVis
  ==================
*/
void
CalcVis(const bsp2_t *bsp)
{
    int i;

    if (LoadVisState()) {
        logprint("Loaded previous state. Resuming progress...\n");
    } else {
        logprint("Calculating Base Vis:\n");
        BasePortalVis();
    }

    logprint("Calculating Full Vis:\n");
    CalcPortalVis(bsp);

//
// assemble the leaf vis lists by oring and compressing the portal lists
//
    if (portalleafs == portalleafs_real) {
        for (i = 0; i < portalleafs; i++)
            LeafFlow(i, &bsp->dleafs[i + 1]);
    } else {
        leafbits_t *buffer;

        logprint("Expanding clusters...\n");
        buffer = malloc(LeafbitsSize(portalleafs));
        for (i = 0; i < portalleafs; i++) {
            memset(buffer, 0, LeafbitsSize(portalleafs));
            ClusterFlow(i, buffer);
        }
        free(buffer);
        
        // Set pointers
        for (i = 0; i < portalleafs_real; i++) {
            bsp->dleafs[i + 1].visofs = leafs[clustermap[i]].visofs;
        }
    }

    logprint("average leafs visible: %i\n", totalvis / portalleafs_real);
}