Fix incorrect loop back logic in recursive section

This commit is contained in:
Jarrod Doyle 2025-01-04 21:03:57 +00:00
parent f0cec24cf6
commit 74228a2851
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 4 additions and 3 deletions

View File

@ -179,8 +179,8 @@ public class PotentiallyVisibleSet
foreach (var edgeIndex in _portalGraph[currentCellIdx])
{
var edge = _edges[edgeIndex];
var destination = edge.Left == previousCellIdx ? edge.Right : edge.Left;
if (destination == previousCellIdx || previousPoly.IsCoplanar(edge.Poly))
var loopsBack = edge.Left == previousCellIdx || edge.Right == previousCellIdx;
if (loopsBack || previousPoly.IsCoplanar(edge.Poly))
{
continue;
}
@ -191,6 +191,7 @@ public class PotentiallyVisibleSet
continue;
}
var destination = edge.Left == currentCellIdx ? edge.Right : edge.Left;
ComputeClippedVisibility(visible, sourcePoly, poly, currentCellIdx, destination, depth + 1);
}
}