qbsp: work around 45 degree plane issue in FindPortalSide

This commit is contained in:
Eric Wasylishen 2023-03-01 21:09:15 -07:00
parent 8130843fb3
commit 06f2363902
1 changed files with 6 additions and 0 deletions

View File

@ -869,6 +869,12 @@ static void FindPortalSide(portal_t *p, visible_faces_stats_t &stats)
// see how close the match is
const auto &p2 = side.get_positive_plane();
double dot = qv::dot(p1.get_normal(), p2.get_normal());
// HACK: both the node plane and side.get_positive_plane() are supposed to be "positive", but the
// which would imply dot >= 0, but the meaning of "positive" is ambiguous on 45 degree planes.
// so take the absolute value to work around that case (this is an undirectional test anyway).
dot = std::fabs(dot);
if (dot > bestdot) {
bestdot = dot;
if (generate_outside_face) {