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.

References count, Error(), fclose(), fopen(), fprintf(), GetVectorForKey(), portal_s::next, next, node_t, portal_s::nodes, node_s::occupant, node_s::occupied, p, portal_t, node_s::portals, qprintf(), s, sprintf(), tree(), vec3_t, portal_s::winding, and WindingCenter().

Referenced by AAS_Create(), and ProcessWorldModel().

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     linefile = fopen (filename, "w");
00062     if (!linefile)
00063         Error ("Couldn't open %s\n", filename);
00064 
00065     count = 0;
00066     node = &tree->outside_node;
00067     while (node->occupied > 1)
00068     {
00069         int         next;
00070         portal_t    *p, *nextportal;
00071         node_t      *nextnode;
00072         int         s;
00073 
00074         // find the best portal exit
00075         next = node->occupied;
00076         for (p=node->portals ; p ; p = p->next[!s])
00077         {
00078             s = (p->nodes[0] == node);
00079             if (p->nodes[s]->occupied
00080                 && p->nodes[s]->occupied < next)
00081             {
00082                 nextportal = p;
00083                 nextnode = p->nodes[s];
00084                 next = nextnode->occupied;
00085             }
00086         }
00087         node = nextnode;
00088         WindingCenter (nextportal->winding, mid);
00089         fprintf (linefile, "%f %f %f\n", mid[0], mid[1], mid[2]);
00090         count++;
00091     }
00092     // add the occupant center
00093     GetVectorForKey (node->occupant, "origin", mid);
00094 
00095     fprintf (linefile, "%f %f %f\n", mid[0], mid[1], mid[2]);
00096     qprintf ("%5i point linefile\n", count+1);
00097 
00098     fclose (linefile);
00099 }

Here is the call graph for this function:


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