mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-08 01:53:52 +00:00
fix(painter): reject NaN brush center / non-positive radius
NaN comparisons return false, so the dist >= radius early-out would never fire and the falloff path would skip its inner check too — the brush would paint full strength on every texel in the chunk. Reject upfront.
This commit is contained in:
parent
891bb711a0
commit
9207d54f20
1 changed files with 6 additions and 0 deletions
|
|
@ -82,6 +82,12 @@ glm::vec2 TexturePainter::worldToChunkUV(int chunkIdx, const glm::vec3& worldPos
|
|||
|
||||
void TexturePainter::modifyAlpha(int chunkIdx, int layerIdx, const glm::vec3& center,
|
||||
float radius, float strength, float falloff, bool erasing) {
|
||||
// Reject NaN center / non-positive radius up front. Without this, every
|
||||
// dist comparison below becomes NaN-vs-finite (which returns false), so
|
||||
// the falloff path falls through and paints full strength on every
|
||||
// texel in the chunk — the opposite of what was asked.
|
||||
if (!std::isfinite(center.x) || !std::isfinite(center.y) ||
|
||||
!std::isfinite(radius) || radius <= 0.0f) return;
|
||||
auto& chunk = terrain_->chunks[chunkIdx];
|
||||
auto& layer = chunk.layers[layerIdx];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue