fix(gizmo): hide on NaN target instead of building NaN geometry

setTarget previously stored the position raw, then updateBuffers
ran glm::normalize on axis offsets. NaN target → NaN normalized
axes → NaN gizmo vertices → Vulkan validation drops the whole
draw and the gizmo is invisible regardless of target value.

Hide the gizmo upfront so the user sees no gizmo (which is the
intent of the NaN handling) without leaking garbage into the
vertex buffer.
This commit is contained in:
Kelsi 2026-05-06 08:01:23 -07:00
parent cdc9bb94ee
commit 98f2a6c3bf

View file

@ -31,6 +31,14 @@ void TransformGizmo::shutdown() {
}
void TransformGizmo::setTarget(const glm::vec3& position, float scale) {
// Hide the gizmo on a NaN target. updateBuffers calls glm::normalize on
// axis offsets — non-finite targetPos_ would propagate NaN into the
// gizmo geometry and Vulkan validation would drop the whole batch.
if (!std::isfinite(position.x) || !std::isfinite(position.y) ||
!std::isfinite(position.z) || !std::isfinite(scale) || scale <= 0.0f) {
visible_ = false;
return;
}
targetPos_ = position;
targetScale_ = scale;
visible_ = true;