Пример #1
0
/*
==================
PortalizeTree

Builds the exact polyhedrons for the nodes and leafs
==================
*/
void PortalizeTree (tree_t *tree)
{
	qprintf ("----- portalize ----\n");

	MakeHeadnodePortals (tree->headnode, tree->mins, tree->maxs);
	CutNodePortals_r (tree->headnode);
}
Пример #2
0
/*
==================
PortalizeWorld

Builds the exact polyhedrons for the nodes and leafs
==================
*/
void PortalizeWorld (node_t *headnode)
{
	qprintf ("----- portalize ----\n");

	MakeHeadnodePortals (headnode);
	CutNodePortals_r (headnode);	
}
Пример #3
0
/*
==================
MakeTreePortals
==================
*/
void MakeTreePortals (tree_t *tree)
{
    Sys_FPrintf (SYS_VRB, "--- MakeTreePortals ---\n");
    MakeHeadnodePortals (tree);
    MakeTreePortals_r (tree->headnode);
    Sys_FPrintf( SYS_VRB, "%9d tiny portals\n", c_tinyportals );
    Sys_FPrintf( SYS_VRB, "%9d bad portals\n", c_badportals );	/* ydnar */
}
Пример #4
0
/*
   ================
   WritePortalFile
   ================
 */
void WritePortalFile( tree_t *tree ){
	char filename[1024];
	node_t *headnode;

	Sys_FPrintf( SYS_VRB, "--- WritePortalFile ---\n" );

	headnode = tree->headnode;
	num_visclusters = 0;
	num_visportals = 0;

	FreeTreePortals_r( headnode );

	MakeHeadnodePortals( tree );

	CreateVisPortals_r( headnode );

// set the cluster field in every leaf and count the total number of portals

	NumberLeafs_r( headnode );

// write the file
	sprintf( filename, "%s.prt", source );
	Sys_Printf( "writing %s\n", filename );
	pf = fopen( filename, "w" );
	if ( !pf ) {
		Error( "Error opening %s", filename );
	}

	fprintf( pf, "%s\n", PORTALFILE );
	fprintf( pf, "%i\n", num_visclusters );
	fprintf( pf, "%i\n", num_visportals );

	Sys_FPrintf( SYS_VRB, "%5i visclusters\n", num_visclusters );
	Sys_FPrintf( SYS_VRB, "%5i visportals\n", num_visportals );

	WritePortalFile_r( headnode );

	fclose( pf );

	// we need to store the clusters out now because ordering
	// issues made us do this after writebsp...
	clusterleaf = 1;
	SaveClusters_r( headnode );
}
Пример #5
0
/*
 * @brief
 */
void WritePortalFile(tree_t *tree) {
    char filename[MAX_OSPATH];
    node_t *head_node;

    Com_Verbose("--- WritePortalFile ---\n");

    head_node = tree->head_node;
    num_visclusters = 0;
    num_visportals = 0;

    FreeTreePortals_r(head_node);

    MakeHeadnodePortals(tree);

    CreateVisPortals_r(head_node);

    // set the cluster field in every leaf and count the total number of portals
    NumberLeafs_r(head_node);

    // write the file
    StripExtension(map_name, filename);
    strcat(filename, ".prt");

    if (!(prtfile = Fs_OpenWrite(filename)))
        Com_Error(ERR_FATAL, "Error opening %s\n", filename);

    Fs_Print(prtfile, "%s\n", PORTALFILE);
    Fs_Print(prtfile, "%i\n", num_visclusters);
    Fs_Print(prtfile, "%i\n", num_visportals);

    Com_Verbose("%5i visclusters\n", num_visclusters);
    Com_Verbose("%5i visportals\n", num_visportals);

    WritePortalFile_r(head_node);

    Fs_Close(prtfile);

    // we need to store the clusters out now because ordering
    // issues made us do this after writebsp...
    clusterleaf = 1;
    SaveClusters_r(head_node);

    Com_Verbose("--- WritePortalFile complete ---\n");
}
Пример #6
0
/*
==================
PortalizeWorld

Builds the exact polyhedrons for the nodes and leafs
==================
*/
void
PortalizeWorld(node_t *headnode)
{
    Message(msgProgress, "Portalize");

    iNodesDone = 0;

    MakeHeadnodePortals(headnode);
    CutNodePortals_r(headnode);

    if (hullnum)
	return;

    // save portal file for vis tracing
    WritePortalfile(headnode);

    Message(msgStat, "%5i vis leafs", num_visleafs);
    Message(msgStat, "%5i vis portals", num_visportals);
}
Пример #7
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
void MakeTreePortals( tree_t *tree ) {

#ifdef ME
	Log_Print( "---- Node Portalization ----\n" );
	c_numportalizednodes = 0;
	c_portalmemory = 0;
	qprintf( "%6d nodes portalized", c_numportalizednodes );
#endif //ME

	MakeHeadnodePortals( tree );
	MakeTreePortals_r( tree->headnode );

#ifdef ME
	qprintf( "\n" );
	Log_Write( "\r%6d nodes portalized\r\n", c_numportalizednodes );
	Log_Print( "%6d tiny portals\r\n", c_tinyportals );
	Log_Print( "%6d KB of portal memory\r\n", c_portalmemory >> 10 );
	Log_Print( "%6i KB of winding memory\r\n", WindingMemory() >> 10 );
#endif //ME
} //end of the function MakeTreePortals
Пример #8
0
/*
==================
SolidBSP

Takes a chain of surfaces plus a split type, and
returns a bsp tree with faces off the nodes.

The original surface chain will be completely freed.
==================
*/
node_t *SolidBSP (surfchain_t *surfhead)
{
	int		i;
	node_t	*headnode;
	
	qprintf ("----- SolidBSP -----\n");

	headnode = AllocNode ();
	headnode->surfaces = surfhead->surfaces;
	
	Draw_ClearWindow ();
	c_splitnodes = 0;
	c_nodefaces = 0;
	c_leaffaces = 0;

	if (!surfhead->surfaces)
	{
		// nothing at all to build
		headnode->planenum = -1;
		headnode->contents = CONTENTS_EMPTY;
		return headnode;
	}

	//
	// generate six portals that enclose the entire world
	//
	MakeHeadnodePortals (headnode, surfhead->mins, surfhead->maxs);
	
	//
	// recursively partition everything
	//
	BuildBspTree_r (headnode);

	qprintf ("%5i split nodes\n", c_splitnodes);
	qprintf ("%5i node faces\n", c_nodefaces);
	qprintf ("%5i leaf faces\n", c_leaffaces);
	
	return headnode;
}
Пример #9
0
/*
==================
MakeTreePortals
==================
*/
void MakeTreePortals (tree_t *tree)
{
	MakeHeadnodePortals (tree);
	MakeTreePortals_r (tree->headnode);
}
Пример #10
0
/*
==================
MakeTreePortals
==================
*/
void MakeTreePortals( tree_t *tree ) {
	common->Printf( "----- MakeTreePortals -----\n" );
	MakeHeadnodePortals( tree );
	MakeTreePortals_r( tree->headnode );
}