Skip to content

Commit

Permalink
add validation check for invalid plane normals (fixes #89)
Browse files Browse the repository at this point in the history
doesn't actually fix the problem but it looks it was a bug in xash.
  • Loading branch information
wootguy committed Apr 23, 2024
1 parent a9468f7 commit 64f0ad9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bsp/Bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3525,6 +3525,14 @@ bool Bsp::validate() {
}
}
}
for (int i = 0; i < planeCount; i++) {
BSPPLANE& plane = planes[i];

if (plane.vNormal.length() < 0.5f) {
logf("Bad normal for plane %d\n", i);
isValid = false;
}
}

for (int i = 0; i < clipnodeCount; i++) {
if (clipnodes[i].iPlane < 0 || clipnodes[i].iPlane >= planeCount) {
Expand Down

0 comments on commit 64f0ad9

Please sign in to comment.