mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
Create edge information for the portals.
This commit is contained in:
parent
662c04dfdc
commit
297275e3de
3 changed files with 25 additions and 2 deletions
|
@ -123,6 +123,7 @@ typedef struct clipport_s {
|
|||
struct clipport_s *next[2]; ///< front, back
|
||||
struct clipleaf_s *leafs[2]; ///< front, back
|
||||
struct winding_s *winding;
|
||||
struct winding_s *edges; ///< unit vectors along edges
|
||||
} clipport_t;
|
||||
|
||||
typedef struct clipleaf_s {
|
||||
|
|
|
@ -171,11 +171,27 @@ nodeleaf_t *
|
|||
MOD_BuildBrushes (hull_t *hull)
|
||||
{
|
||||
int numnodes = hull->lastclipnode + 1;
|
||||
int i, j, side;
|
||||
nodeleaf_t *nodeleafs;
|
||||
clipleaf_t *root; // this will be carved into all the actual leafs
|
||||
|
||||
nodeleafs = calloc (numnodes, sizeof (nodeleaf_t));
|
||||
root = alloc_leaf ();
|
||||
carve_leaf (hull, nodeleafs, root, hull->firstclipnode);
|
||||
for (i = 0; i < numnodes; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
clipleaf_t *leaf = nodeleafs[i].leafs[j];
|
||||
clipport_t *p;
|
||||
|
||||
if (!leaf)
|
||||
continue;
|
||||
for (p = leaf->portals; p; p = p->next[side]) {
|
||||
side = p->leafs[1] == leaf;
|
||||
if (p->edges)
|
||||
continue;
|
||||
p->edges = WindingVectors (p->winding);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nodeleafs;
|
||||
}
|
||||
|
|
|
@ -451,8 +451,14 @@ run_test (test_t *test)
|
|||
portal_list = collect_portals (leaf->portals, portal_list);
|
||||
}
|
||||
}
|
||||
for (i = 0, p = portal_list; p; i++, p = p->next)
|
||||
;
|
||||
for (i = 0, p = portal_list; p; i++, p = p->next) {
|
||||
if (!p->portal->winding || !p->portal->edges) {
|
||||
res = 1;
|
||||
printf ("portal with missing vertex/edge information\n");
|
||||
}
|
||||
}
|
||||
if (res)
|
||||
goto nodeleaf_bail;
|
||||
if (i != test->expect.num_portals) {
|
||||
res = 1;
|
||||
printf ("bad portal count: %d %d\n", test->expect.num_portals, i);
|
||||
|
|
Loading…
Reference in a new issue