qbsp: don't use brush sides to texture a portal if they're not coplanar

This commit is contained in:
Eric Wasylishen 2022-09-08 21:20:49 -06:00
parent d4dde8350c
commit b19527c3fd
2 changed files with 17 additions and 0 deletions

View File

@ -988,6 +988,18 @@ public:
return counts;
}
vec_t max_dist_off_plane(const qplane3d& plane)
{
vec_t max_dist = 0.0;
for (size_t i = 0; i < size(); i++) {
vec_t dist = abs(plane.distance_to(at(i)));
if (dist > max_dist) {
max_dist = dist;
}
}
return max_dist;
}
/*
==================
ClipWinding

View File

@ -835,6 +835,11 @@ static void FindPortalSide(portal_t *p, visible_faces_stats_t &stats)
for (auto &side : brush->sides) {
if (side.bevel)
continue;
if (p->winding.max_dist_off_plane(side.get_plane()) > 0.1) {
continue;
}
if ((side.planenum & ~1) == p->onnode->planenum) {
// exact match (undirectional)