vis: fix for microleafs blocking vis

Fixes #261
This commit is contained in:
Eric Wasylishen 2019-03-24 20:46:27 -06:00
parent ee256f339e
commit 74e1a0f6f0
2 changed files with 19 additions and 6 deletions

View File

@ -168,8 +168,11 @@ RecursiveLeafFlow(int leafnum, threaddata_t *thread, pstack_t *prevstack)
*/ */
err = CheckStack(leaf, thread); err = CheckStack(leaf, thread);
if (err) { if (err) {
logprint("WARNING: %s: recursion on leaf %d\n", __func__, leafnum); // ericw -- this seems harmless and the fix for https://github.com/ericwa/ericw-tools/issues/261
LogLeaf(leaf); // causes it to happen a lot.
//logprint("WARNING: %s: recursion on leaf %d\n", __func__, leafnum);
//LogLeaf(leaf);
return; return;
} }
@ -457,7 +460,7 @@ BasePortalThread(void *dummy)
for (j = 0; j < tw->numpoints; j++) { for (j = 0; j < tw->numpoints; j++) {
d = DotProduct(tw->points[j], p->plane.normal) - p->plane.dist; d = DotProduct(tw->points[j], p->plane.normal) - p->plane.dist;
if (d > ON_EPSILON) if (d > -ON_EPSILON) // ericw -- changed from > ON_EPSILON for https://github.com/ericwa/ericw-tools/issues/261
break; break;
} }
if (j == tw->numpoints) if (j == tw->numpoints)
@ -470,7 +473,7 @@ BasePortalThread(void *dummy)
for (j = 0; j < w->numpoints; j++) { for (j = 0; j < w->numpoints; j++) {
d = DotProduct(w->points[j], tp->plane.normal) - tp->plane.dist; d = DotProduct(w->points[j], tp->plane.normal) - tp->plane.dist;
if (d < -ON_EPSILON) if (d < ON_EPSILON) // ericw -- changed from < -ON_EPSILON for https://github.com/ericwa/ericw-tools/issues/261
break; break;
} }
if (j == w->numpoints) if (j == w->numpoints)

View File

@ -283,6 +283,12 @@ ClipStackWinding(winding_t *in, pstack_t *stack, plane_t *split)
sides[i] = sides[0]; sides[i] = sides[0];
dists[i] = dists[0]; dists[i] = dists[0];
// ericw -- coplanar portals: return without clipping. Otherwise when two portals are less than ON_EPSILON apart,
// one will get fully clipped away and we can't see through it causing https://github.com/ericwa/ericw-tools/issues/261
if (counts[SIDE_ON] == in->numpoints) {
return in;
}
if (!counts[0]) { if (!counts[0]) {
FreeStackWinding(in, stack); FreeStackWinding(in, stack);
return NULL; return NULL;
@ -654,8 +660,12 @@ ClusterFlow(int clusternum, leafbits_t *buffer)
for (j = 0; j < numblocks; j++) for (j = 0; j < numblocks; j++)
buffer->bits[j] |= p->visbits->bits[j]; buffer->bits[j] |= p->visbits->bits[j];
} }
if (TestLeafBit(buffer, clusternum))
logprint("WARNING: Leaf portals saw into cluster (%i)\n", clusternum); // ericw -- this seems harmless and the fix for https://github.com/ericwa/ericw-tools/issues/261
// causes it to happen a lot.
//if (TestLeafBit(buffer, clusternum))
// logprint("WARNING: Leaf portals saw into cluster (%i)\n", clusternum);
SetLeafBit(buffer, clusternum); SetLeafBit(buffer, clusternum);
/* /*