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

Go to the source code of this file.
Defines | |
| #define | PORTALFILE "PRT1" |
Functions | |
| void | CreateVisPortals_r (node_t *node) |
| void | FillLeafNumbers_r (node_t *node, int num) |
| void | FinishVisPortals2_r (node_t *node) |
| void | FinishVisPortals_r (node_t *node) |
| void | NumberLeafs_r (node_t *node) |
| void | SaveClusters_r (node_t *node) |
| void | WriteFloat2 (FILE *f, vec_t v) |
| void | WritePortalFile (tree_t *tree) |
| void | WritePortalFile_r (node_t *node) |
Variables | |
| int | clusterleaf |
| int | num_visclusters |
| int | num_visportals |
| FILE * | pf |
|
|
Definition at line 35 of file prtfile.c. Referenced by LoadPortals(), VL_LoadPortals(), VS_LoadPortals(), WritePortalFile(), and WritePortals(). |
|
|
Definition at line 179 of file prtfile.c. References node_s::children, node_s::detail_seperator, MakeNodePortal(), node_t, node_s::planenum, PLANENUM_LEAF, and SplitNodePortals(). Referenced by WritePortalFile(). 00180 {
00181 // stop as soon as we get to a detail_seperator, which
00182 // means that everything below is in a single cluster
00183 if (node->planenum == PLANENUM_LEAF || node->detail_seperator )
00184 return;
00185
00186 MakeNodePortal (node);
00187 SplitNodePortals (node);
00188
00189 CreateVisPortals_r (node->children[0]);
00190 CreateVisPortals_r (node->children[1]);
00191 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 115 of file prtfile.c. References node_s::children, node_s::cluster, node_s::contents, node_t, and node_s::planenum. Referenced by NumberLeafs_r(). 00116 {
00117 if (node->planenum == PLANENUM_LEAF)
00118 {
00119 if (node->contents & CONTENTS_SOLID)
00120 node->cluster = -1;
00121 else
00122 node->cluster = num;
00123 return;
00124 }
00125 node->cluster = num;
00126 FillLeafNumbers_r (node->children[0], num);
00127 FillLeafNumbers_r (node->children[1], num);
00128 }
|
|
|
Definition at line 198 of file prtfile.c. References node_s::children, MakeNodePortal(), node_t, node_s::planenum, and SplitNodePortals(). Referenced by FinishVisPortals_r(). 00199 {
00200 if (node->planenum == PLANENUM_LEAF)
00201 return;
00202
00203 MakeNodePortal (node);
00204 SplitNodePortals (node);
00205
00206 FinishVisPortals2_r (node->children[0]);
00207 FinishVisPortals2_r (node->children[1]);
00208 }
|
Here is the call graph for this function:

|
|
Definition at line 210 of file prtfile.c. References node_s::children, node_s::detail_seperator, FinishVisPortals2_r(), node_t, and node_s::planenum. 00211 {
00212 if (node->planenum == PLANENUM_LEAF)
00213 return;
00214
00215 if (node->detail_seperator)
00216 {
00217 FinishVisPortals2_r (node);
00218 return;
00219 }
00220
00221 FinishVisPortals_r (node->children[0]);
00222 FinishVisPortals_r (node->children[1]);
00223 }
|
Here is the call graph for this function:

|
|
Definition at line 135 of file prtfile.c. References node_s::children, node_s::cluster, node_s::contents, node_s::detail_seperator, FillLeafNumbers_r(), portal_s::next, node_t, portal_s::nodes, num_visclusters, num_visportals, NumberLeafs_r(), p, node_s::planenum, PLANENUM_LEAF, portal_t, Portal_VisFlood(), and node_s::portals. 00136 {
00137 portal_t *p;
00138
00139 if (node->planenum != PLANENUM_LEAF && !node->detail_seperator)
00140 { // decision node
00141 node->cluster = -99;
00142 NumberLeafs_r (node->children[0]);
00143 NumberLeafs_r (node->children[1]);
00144 return;
00145 }
00146
00147 // either a leaf or a detail cluster
00148
00149 if ( node->contents & CONTENTS_SOLID )
00150 { // solid block, viewpoint never inside
00151 node->cluster = -1;
00152 return;
00153 }
00154
00155 FillLeafNumbers_r (node, num_visclusters);
00156 num_visclusters++;
00157
00158 // count the portals
00159 for (p = node->portals ; p ; )
00160 {
00161 if (p->nodes[0] == node) // only write out from first leaf
00162 {
00163 if (Portal_VisFlood (p))
00164 num_visportals++;
00165 p = p->next[0];
00166 }
00167 else
00168 p = p->next[1];
00169 }
00170
00171 }
|
Here is the call graph for this function:

|
|
Definition at line 227 of file prtfile.c. References node_s::children, node_s::cluster, dleaf_t::cluster, clusterleaf, dleafs, node_t, and node_s::planenum. Referenced by WritePortalFile(). 00228 {
00229 if (node->planenum == PLANENUM_LEAF)
00230 {
00231 dleafs[clusterleaf++].cluster = node->cluster;
00232 return;
00233 }
00234 SaveClusters_r (node->children[0]);
00235 SaveClusters_r (node->children[1]);
00236 }
|
|
||||||||||||
|
Definition at line 41 of file prtfile.c. References f, fabs(), fprintf(), Q_rint(), and v. Referenced by WritePortalFile_r(). 00042 {
00043 if ( fabs(v - Q_rint(v)) < 0.001 )
00044 fprintf (f,"%i ",(int)Q_rint(v));
00045 else
00046 fprintf (f,"%f ",v);
00047 }
|
Here is the call graph for this function:

|
|
Definition at line 243 of file prtfile.c. 00244 {
00245 char filename[1024];
00246 node_t *headnode;
00247
00248 qprintf ("--- WritePortalFile ---\n");
00249
00250 headnode = tree->headnode;
00251 num_visclusters = 0;
00252 num_visportals = 0;
00253
00254 Tree_FreePortals_r (headnode);
00255
00256 MakeHeadnodePortals (tree);
00257
00258 CreateVisPortals_r (headnode);
00259
00260 // set the cluster field in every leaf and count the total number of portals
00261
00262 NumberLeafs_r (headnode);
00263
00264 // write the file
00265 sprintf (filename, "%s.prt", source);
00266 printf ("writing %s\n", filename);
00267 pf = fopen (filename, "w");
00268 if (!pf)
00269 Error ("Error opening %s", filename);
00270
00271 fprintf (pf, "%s\n", PORTALFILE);
00272 fprintf (pf, "%i\n", num_visclusters);
00273 fprintf (pf, "%i\n", num_visportals);
00274
00275 qprintf ("%5i visclusters\n", num_visclusters);
00276 qprintf ("%5i visportals\n", num_visportals);
00277
00278 WritePortalFile_r (headnode);
00279
00280 fclose (pf);
00281
00282 // we need to store the clusters out now because ordering
00283 // issues made us do this after writebsp...
00284 clusterleaf = 1;
00285 SaveClusters_r (headnode);
00286 }
|
|
|
Definition at line 54 of file prtfile.c. References node_s::children, node_s::cluster, node_s::contents, node_s::detail_seperator, DotProduct, fprintf(), i, portal_s::next, node_t, portal_s::nodes, plane_t::normal, winding_t::numpoints, winding_t::p, p, pf, portal_s::plane, node_s::planenum, PLANENUM_LEAF, portal_t, Portal_VisFlood(), node_s::portals, s, vec3_t, vec_t, w, portal_s::winding, WindingPlane(), WriteFloat2(), and WritePortalFile_r(). 00055 {
00056 int i, s;
00057 portal_t *p;
00058 winding_t *w;
00059 vec3_t normal;
00060 vec_t dist;
00061
00062 // decision node
00063 if (node->planenum != PLANENUM_LEAF && !node->detail_seperator)
00064 {
00065 WritePortalFile_r (node->children[0]);
00066 WritePortalFile_r (node->children[1]);
00067 return;
00068 }
00069
00070 if (node->contents & CONTENTS_SOLID)
00071 return;
00072
00073 for (p = node->portals ; p ; p=p->next[s])
00074 {
00075 w = p->winding;
00076 s = (p->nodes[1] == node);
00077 if (w && p->nodes[0] == node)
00078 {
00079 if (!Portal_VisFlood (p))
00080 continue;
00081 // write out to the file
00082
00083 // sometimes planes get turned around when they are very near
00084 // the changeover point between different axis. interpret the
00085 // plane the same way vis will, and flip the side orders if needed
00086 // FIXME: is this still relevent?
00087 WindingPlane (w, normal, &dist);
00088 if ( DotProduct (p->plane.normal, normal) < 0.99 )
00089 { // backwards...
00090 fprintf (pf,"%i %i %i ",w->numpoints, p->nodes[1]->cluster, p->nodes[0]->cluster);
00091 }
00092 else
00093 fprintf (pf,"%i %i %i ",w->numpoints, p->nodes[0]->cluster, p->nodes[1]->cluster);
00094 for (i=0 ; i<w->numpoints ; i++)
00095 {
00096 fprintf (pf,"(");
00097 WriteFloat2 (pf, w->p[i][0]);
00098 WriteFloat2 (pf, w->p[i][1]);
00099 WriteFloat2 (pf, w->p[i][2]);
00100 fprintf (pf,") ");
00101 }
00102 fprintf (pf,"\n");
00103 }
00104 }
00105
00106 }
|
Here is the call graph for this function:

|
|
Definition at line 226 of file prtfile.c. Referenced by SaveClusters_r(), and WritePortalFile(). |
|
|
Definition at line 38 of file prtfile.c. Referenced by NumberClusters(), NumberLeafs_r(), and WritePortalFile(). |
|
|
Definition at line 39 of file prtfile.c. Referenced by NumberClusters(), NumberLeafs_r(), and WritePortalFile(). |
|
|
Definition at line 37 of file prtfile.c. Referenced by CM_GeneratePatchCollide(), CM_PatchCollideFromGrid(), Str::Find(), PointInMoveList(), Terrain_PointInMoveList(), WriteFaceFile_r(), WritePortalFile(), WritePortalFile_r(), and WritePortals(). |
1.3.9.1