From 34b751620c9984580ce556e379ac585449fe400a Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:38:27 -0500 Subject: [PATCH] Fix: Reduced animation position precision --- lib/ivis_opengl/imdload.cpp | 6 +++--- lib/ivis_opengl/ivisdef.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ivis_opengl/imdload.cpp b/lib/ivis_opengl/imdload.cpp index 72e7e42bc12..8aa0e810368 100644 --- a/lib/ivis_opengl/imdload.cpp +++ b/lib/ivis_opengl/imdload.cpp @@ -1491,9 +1491,9 @@ static std::unique_ptr _imd_load_level(const WzString &filename, cons debug(LOG_ERROR, "%s: Invalid object animation level %" PRIu32 ", line %d, frame %d", filename.toUtf8().c_str(), level, i, frame); } ASSERT(frame == i, "%s: Invalid frame enumeration object animation (level %" PRIu32 ") %d: %d", filename.toUtf8().c_str(), level, i, frame); - s.objanimdata[i].pos.x = pos.x / INT_SCALE; - s.objanimdata[i].pos.y = pos.z / INT_SCALE; - s.objanimdata[i].pos.z = pos.y / INT_SCALE; + s.objanimdata[i].pos.x = static_cast(pos.x) / static_cast(INT_SCALE); + s.objanimdata[i].pos.y = static_cast(pos.z) / static_cast(INT_SCALE); + s.objanimdata[i].pos.z = static_cast(pos.y) / static_cast(INT_SCALE); s.objanimdata[i].rot.pitch = static_cast(static_cast(-(rot.x * DEG_1 / INT_SCALE))); s.objanimdata[i].rot.direction = static_cast(static_cast(-(rot.z * DEG_1 / INT_SCALE))); s.objanimdata[i].rot.roll = static_cast(static_cast(-(rot.y * DEG_1 / INT_SCALE))); diff --git a/lib/ivis_opengl/ivisdef.h b/lib/ivis_opengl/ivisdef.h index 5ffe4e50e5e..cec2b2dff5d 100644 --- a/lib/ivis_opengl/ivisdef.h +++ b/lib/ivis_opengl/ivisdef.h @@ -77,7 +77,7 @@ struct EDGE struct ANIMFRAME { Vector3f scale = Vector3f(0.f, 0.f, 0.f); - Position pos = Position(0, 0, 0); + Vector3f pos = Vector3f(0.f, 0.f, 0.f); Rotation rot; };