From c9c46656426ee840dce1767106e7f345cb40ffaa Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 08:04:44 -0700 Subject: [PATCH] fix(water): skip chunks with NaN water height in mesh build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Belt-and-braces — WOT load already scrubs the height to 0 if non- finite, but if a downstream caller mutates terrain.waterData in-memory the bad value would leak into the water mesh and Vulkan would drop the entire batch on a single bad chunk. --- tools/editor/editor_water.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/editor/editor_water.cpp b/tools/editor/editor_water.cpp index 8a69eddf..324c6bcc 100644 --- a/tools/editor/editor_water.cpp +++ b/tools/editor/editor_water.cpp @@ -3,6 +3,7 @@ #include "rendering/vk_shader.hpp" #include "core/logger.hpp" #include +#include namespace wowee { namespace editor { @@ -61,6 +62,10 @@ void EditorWater::update(const pipeline::ADTTerrain& terrain, int tileX, int til float y1 = y0 - CHUNK_SIZE; float h = water.layers[0].maxHeight; + // NaN water height would produce NaN vertex positions and + // Vulkan would drop the whole water mesh. WOT load already + // scrubs but defending here is cheap insurance. + if (!std::isfinite(h)) continue; // Water color by type float r = 0.1f, g = 0.3f, b = 0.7f, a = 0.45f;