David Luebke (luebke++at++cs.unc.edu)
Wed, 19 Apr 1995 04:13:18 -0400 (EDT)
So here's my problem: after a nested series of prePortalCull() calls,
postPortalCull() seems to be called only once, for the most recently
visited portal node. As a result the cells attached to the rest of the
portals never get removed, and those portals thereby inherit another
child each frame. My question is, why might the traversal mechanism
be skipping every postPortalCull after the first call? I've checked
carefully and I'm quite sure that the correct callbacks are assigned
to all the appropriate nodes. Any ideas?
I know this probably isn't very clear. Here's the relevant portions of
my code:
typedef struct
{
int numverts; /* Number of verts in the portal */
pfGroup *attached_cell; /* cell on the 'other side' */
pfVec3 verts[MAXPORTALVERTS]; /* The actual vertices */
} pfPortalData;
long
enterPortalCull(pfTraverser *trav, void *data)
{
pfChannel *chan; /* pfChannel derives from pfFrustum */
pfGroup *node;
pfPortalData *p = (pfPortalData *) data;
if (!globalUsePortals) /* First, are portals enabled? */
{
DEBUG(("\tPortals aren't enabled; pruning.\n"));
return PFTRAV_PRUNE;
}
node = (pfGroup *) pfGetTravNode(trav);
chan = pfGetTravChan(trav); /* Get the current view frustum */
if (chan == NULL) /* If this is an intersection, prune */
{
return PFTRAV_PRUNE;
}
...
/* First test the normal of the portal to see if its backfacing */
...
/* Next test the portal to see if its visible */
...
if (it's not visible)
return PFTRAV_PRUNE;
/* It's visible, go ahead and traverse the other side */
pfAddChild(node, p->attached_cell);
return PFTRAV_CONT;
}
long
exitPortalCull(pfTraverser *trav, void *data)
{
pfPortalData *p = (pfPortalData *) data;
pfChannel *chan;
pfGroup *node;
if (!globalUsePortals) /* First, are portals enabled? */
return PFTRAV_PRUNE; /* I think this is ignored */
chan = pfGetTravChan(trav); /* Get the current view frustum */
node = (pfGroup *) pfGetTravNode(trav);
if (chan == NULL) /* If this is an intersection, prune */
return PFTRAV_PRUNE; /* I think this is ignored */
pfRemoveChild(node, p->attached_cell);
return PFTRAV_CONT; /* I think this is ignored */
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:24 PDT