fix(brush): NaN-guard EditorBrush::setPosition

applyBrush already early-outs on NaN brush position, but the stored
worldPos_ would still capture NaN and surface it to UI panels and
the brush-circle indicator (which renders a NaN ring). Reject NaN
at the setter so the editor state itself stays sane.
This commit is contained in:
Kelsi 2026-05-06 10:15:00 -07:00
parent 4c0f8dd5c0
commit 9e801f93b6

View file

@ -1,6 +1,7 @@
#pragma once
#include <glm/glm.hpp>
#include <cmath>
namespace wowee {
namespace editor {
@ -31,7 +32,13 @@ public:
void setActive(bool a) { active_ = a; }
const glm::vec3& getPosition() const { return worldPos_; }
void setPosition(const glm::vec3& pos) { worldPos_ = pos; }
void setPosition(const glm::vec3& pos) {
// applyBrush already early-outs on NaN, but rejecting at the
// setter keeps the stored state itself sane — handy for UI
// panels that read the current brush position back.
if (std::isfinite(pos.x) && std::isfinite(pos.y) && std::isfinite(pos.z))
worldPos_ = pos;
}
float getInfluence(float distance) const;