mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
fix(wot): scrub NaN water height on load
A WOT water entry with non-finite height would push NaN through the water mesh builder and produce a degenerate Vulkan draw (invisible water at best, GPU hang at worst).
This commit is contained in:
parent
b8e2d08b17
commit
1c1250a37c
1 changed files with 3 additions and 0 deletions
|
|
@ -138,6 +138,9 @@ bool WoweeTerrainLoader::loadMetadata(const std::string& wotPath, ADTTerrain& te
|
|||
ADTTerrain::WaterLayer wl;
|
||||
wl.liquidType = w.value("type", 0u);
|
||||
wl.maxHeight = w.value("height", 0.0f);
|
||||
// NaN water height would produce NaN vertex positions and
|
||||
// a degenerate GPU draw, or crash the water mesh build.
|
||||
if (!std::isfinite(wl.maxHeight)) wl.maxHeight = 0.0f;
|
||||
wl.minHeight = wl.maxHeight;
|
||||
wl.x = 0; wl.y = 0; wl.width = 9; wl.height = 9;
|
||||
wl.heights.assign(81, wl.maxHeight);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue