From 199f18cdac6abfcdde3c9bf95a2479ae91bbdc37 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 04:57:09 -0700 Subject: [PATCH] fix(wob): clamp doodad scale to 1.0 when loaded value is 0/NaN/inf Without this guard, a corrupted or partially-written WoB with scale=0 would render the doodad at zero size (invisible) and a NaN/inf would crash the renderer's matrix math. Now defaults to 1.0 for any non- finite or near-zero value. --- src/pipeline/wowee_building.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pipeline/wowee_building.cpp b/src/pipeline/wowee_building.cpp index ee002b9d..5204c2fc 100644 --- a/src/pipeline/wowee_building.cpp +++ b/src/pipeline/wowee_building.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace wowee { @@ -105,6 +106,10 @@ WoweeBuilding WoweeBuildingLoader::load(const std::string& basePath) { f.read(reinterpret_cast(&dp.position), 12); f.read(reinterpret_cast(&dp.rotation), 12); f.read(reinterpret_cast(&dp.scale), 4); + // Guard against corrupted scale (older WoBs that hadn't initialized + // the field, or NaNs from a partial write). The renderer would + // collapse the doodad to a point with scale 0. + if (!std::isfinite(dp.scale) || dp.scale <= 0.0001f) dp.scale = 1.0f; bld.doodads.push_back(dp); }