mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 17:43:51 +00:00
fix(water): skip chunks with NaN water height in mesh build
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.
This commit is contained in:
parent
55f9616aa6
commit
c9c4665642
1 changed files with 5 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include "rendering/vk_shader.hpp"
|
||||
#include "core/logger.hpp"
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue