mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
fix(viewport): clear ghost preview on NaN/non-positive inputs
Without this guard, NaN cursor position from a degenerate raycast would feed directly into the M2 renderer instance transform and either crash on GPU or silently render at the origin.
This commit is contained in:
parent
303eeb9107
commit
07f4043343
1 changed files with 8 additions and 0 deletions
|
|
@ -658,6 +658,14 @@ void EditorViewport::update(float deltaTime) {
|
|||
void EditorViewport::setGhostPreview(const std::string& path, const glm::vec3& pos,
|
||||
const glm::vec3& rotDeg, float scale) {
|
||||
if (!m2Renderer_) return;
|
||||
// Reject NaN inputs — would propagate into the M2 renderer transform
|
||||
// and either crash on the GPU or silently render at the origin.
|
||||
if (!std::isfinite(pos.x) || !std::isfinite(pos.y) || !std::isfinite(pos.z) ||
|
||||
!std::isfinite(rotDeg.x) || !std::isfinite(rotDeg.y) || !std::isfinite(rotDeg.z) ||
|
||||
!std::isfinite(scale) || scale <= 0.0f) {
|
||||
clearGhostPreview();
|
||||
return;
|
||||
}
|
||||
|
||||
// Load model if path changed
|
||||
if (path != ghostModelPath_ || ghostModelId_ == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue