Fix ESM4 base terrain layer opacity overflow

std::max specializations cast the argument to the type, so the layer opacity subtraction result would turn positive and cause bright spots
This commit is contained in:
Alexei Kotov
2026-04-02 08:38:43 +03:00
parent 319d0cb534
commit 274b93b2d9
+1 -1
View File
@@ -467,7 +467,7 @@ namespace ESMTerrain
}
size_t index = static_cast<size_t>((starty + y) * blendmapSize + startx + x);
auto delta = static_cast<unsigned char>(std::clamp(static_cast<int>(v.opacity * 255.f), 0, 255));
baseBlendmap[index] = std::max<unsigned char>(0, baseBlendmap[index] - delta);
baseBlendmap[index] -= std::min(baseBlendmap[index], delta);
layerBlendmap[index] = delta;
}
}