Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

leakfile.c File Reference

#include "qbsp.h"

Include dependency graph for leakfile.c:

Include dependency graph

Go to the source code of this file.

Functions

void LeakFile (tree_t *tree)


Function Documentation

void LeakFile tree_t tree  ) 
 

Definition at line 44 of file leakfile.c.

00045 {
00046     vec3_t  mid;
00047     FILE    *linefile;
00048     char    filename[1024];
00049     node_t  *node;
00050     int     count;
00051 
00052     if (!tree->outside_node.occupied)
00053         return;
00054 
00055     qprintf ("--- LeakFile ---\n");
00056 
00057     //
00058     // write the points to the file
00059     //
00060     sprintf (filename, "%s.lin", source);
00061     qprintf ("%s\n", filename);
00062     linefile = fopen (filename, "w");
00063     if (!linefile)
00064         Error ("Couldn't open %s\n", filename);
00065 
00066     count = 0;
00067     node = &tree->outside_node;
00068     while (node->occupied > 1)
00069     {
00070         int         next;
00071         portal_t    *p, *nextportal;
00072         node_t      *nextnode;
00073         int         s;
00074 
00075         // find the best portal exit
00076         next = node->occupied;
00077         for (p=node->portals ; p ; p = p->next[!s])
00078         {
00079             s = (p->nodes[0] == node);
00080             if (p->nodes[s]->occupied
00081                 && p->nodes[s]->occupied < next)
00082             {
00083                 nextportal = p;
00084                 nextnode = p->nodes[s];
00085                 next = nextnode->occupied;
00086             }
00087         }
00088         node = nextnode;
00089         WindingCenter (nextportal->winding, mid);
00090         fprintf (linefile, "%f %f %f\n", mid[0], mid[1], mid[2]);
00091         count++;
00092     }
00093     // add the occupant center
00094     GetVectorForKey (node->occupant, "origin", mid);
00095 
00096     fprintf (linefile, "%f %f %f\n", mid[0], mid[1], mid[2]);
00097     qprintf ("%5i point linefile\n", count+1);
00098 
00099     fclose (linefile);
00100 }


Generated on Thu Aug 25 12:54:43 2005 for Quake III Arena by  doxygen 1.3.9.1