#include "qbsp.h"
Include dependency graph for tree.c:

Go to the source code of this file.
Functions | |
| void | FreeTree (tree_t *tree) |
| void | FreeTree_r (node_t *node) |
| void | FreeTreePortals_r (node_t *node) |
| node_t * | NodeForPoint (node_t *node, vec3_t origin) |
| void | PrintTree_r (node_t *node, int depth) |
| void | RemovePortalFromNode (portal_t *portal, node_t *l) |
Variables | |
| int | c_nodes |
|
|
Definition at line 110 of file tree.c. References free(), FreeTree_r(), FreeTreePortals_r(), and tree(). Referenced by ProcessSubModel(), and ProcessWorldModel(). 00111 {
00112 FreeTreePortals_r (tree->headnode);
00113 FreeTree_r (tree->headnode);
00114 free (tree);
00115 }
|
Here is the call graph for this function:

|
|
Definition at line 83 of file tree.c. References node_s::brushlist, c_nodes, node_s::children, free(), FreeBrush(), FreeBrushList(), node_t, numthreads, node_s::planenum, and node_s::volume. Referenced by FreeTree(). 00084 {
00085 // free children
00086 if (node->planenum != PLANENUM_LEAF)
00087 {
00088 FreeTree_r (node->children[0]);
00089 FreeTree_r (node->children[1]);
00090 }
00091
00092 // free bspbrushes
00093 FreeBrushList (node->brushlist);
00094
00095 // free the node
00096 if (node->volume)
00097 FreeBrush (node->volume);
00098
00099 if (numthreads == 1)
00100 c_nodes--;
00101 free (node);
00102 }
|
Here is the call graph for this function:

|
|
Definition at line 54 of file tree.c. References node_s::children, FreePortal(), portal_s::next, node_t, portal_s::nodes, p, node_s::planenum, portal_t, node_s::portals, RemovePortalFromNode(), and s. Referenced by FreeTree(). 00055 {
00056 portal_t *p, *nextp;
00057 int s;
00058
00059 // free children
00060 if (node->planenum != PLANENUM_LEAF)
00061 {
00062 FreeTreePortals_r (node->children[0]);
00063 FreeTreePortals_r (node->children[1]);
00064 }
00065
00066 // free portals
00067 for (p=node->portals ; p ; p=nextp)
00068 {
00069 s = (p->nodes[1] == node);
00070 nextp = p->next[s];
00071
00072 RemovePortalFromNode (p, p->nodes[!s]);
00073 FreePortal (p);
00074 }
00075 node->portals = NULL;
00076 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 29 of file tree.c. References node_s::children, d, plane_t::dist, DotProduct, mapplanes, node_t, plane_t::normal, node_s::planenum, and vec_t. 00030 {
00031 plane_t *plane;
00032 vec_t d;
00033
00034 while (node->planenum != PLANENUM_LEAF)
00035 {
00036 plane = &mapplanes[node->planenum];
00037 d = DotProduct (origin, plane->normal) - plane->dist;
00038 if (d >= 0)
00039 node = node->children[0];
00040 else
00041 node = node->children[1];
00042 }
00043
00044 return node;
00045 }
|
|
||||||||||||
|
Definition at line 119 of file tree.c. References _printf(), node_s::brushlist, mapbrush_s::brushnum, bspbrush_t, node_s::children, plane_t::dist, i, mapplanes, bspbrush_s::next, node_t, plane_t::normal, bspbrush_s::original, and node_s::planenum. 00120 {
00121 int i;
00122 plane_t *plane;
00123 bspbrush_t *bb;
00124
00125 for (i=0 ; i<depth ; i++)
00126 _printf (" ");
00127 if (node->planenum == PLANENUM_LEAF)
00128 {
00129 if (!node->brushlist)
00130 _printf ("NULL\n");
00131 else
00132 {
00133 for (bb=node->brushlist ; bb ; bb=bb->next)
00134 _printf ("%i ", bb->original->brushnum);
00135 _printf ("\n");
00136 }
00137 return;
00138 }
00139
00140 plane = &mapplanes[node->planenum];
00141 _printf ("#%i (%5.2f %5.2f %5.2f):%5.2f\n", node->planenum,
00142 plane->normal[0], plane->normal[1], plane->normal[2],
00143 plane->dist);
00144 PrintTree_r (node->children[0], depth+1);
00145 PrintTree_r (node->children[1], depth+1);
00146 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 211 of file portals.c. References Error(), i, l, n, portal_s::next, node_t, portal_s::nodes, p, portal_t, node_s::portals, portals, s, and t. Referenced by FreeTreePortals_r(), SplitNodePortals(), and Tree_FreePortals_r(). 00212 {
00213 portal_t **pp, *t;
00214
00215 int s, i, n;
00216 portal_t *p;
00217 portal_t *portals[4096];
00218
00219 // remove reference to the current portal
00220 pp = &l->portals;
00221 while (1)
00222 {
00223 t = *pp;
00224 if (!t)
00225 Error ("RemovePortalFromNode: portal not in leaf");
00226
00227 if ( t == portal )
00228 break;
00229
00230 if (t->nodes[0] == l)
00231 pp = &t->next[0];
00232 else if (t->nodes[1] == l)
00233 pp = &t->next[1];
00234 else
00235 Error ("RemovePortalFromNode: portal not bounding leaf");
00236 }
00237
00238 if (portal->nodes[0] == l)
00239 {
00240 *pp = portal->next[0];
00241 portal->nodes[0] = NULL;
00242 } //end if
00243 else if (portal->nodes[1] == l)
00244 {
00245 *pp = portal->next[1];
00246 portal->nodes[1] = NULL;
00247 } //end else if
00248 else
00249 {
00250 Error("RemovePortalFromNode: mislinked portal");
00251 } //end else
00252 //#ifdef ME
00253 n = 0;
00254 for (p = l->portals; p; p = p->next[s])
00255 {
00256 for (i = 0; i < n; i++)
00257 {
00258 if (p == portals[i]) Error("RemovePortalFromNode: circular linked\n");
00259 } //end for
00260 if (p->nodes[0] != l && p->nodes[1] != l)
00261 {
00262 Error("RemovePortalFromNodes: portal does not belong to node\n");
00263 } //end if
00264 portals[n] = p;
00265 s = (p->nodes[1] == l);
00266 // if (++n >= 4096) Error("RemovePortalFromNode: more than 4096 portals\n");
00267 } //end for
00268 //#endif
00269 } //end of the function RemovePortalFromNode
|
Here is the call graph for this function:

|
|
Definition at line 50 of file brushbsp.c. |
1.3.9.1