Skip to content

Commit

Permalink
Fix: Reduced animation position precision
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Feb 24, 2024
1 parent ef28085 commit 34b7516
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/ivis_opengl/imdload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,9 +1491,9 @@ static std::unique_ptr<iIMDShape> _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<float>(pos.x) / static_cast<float>(INT_SCALE);
s.objanimdata[i].pos.y = static_cast<float>(pos.z) / static_cast<float>(INT_SCALE);
s.objanimdata[i].pos.z = static_cast<float>(pos.y) / static_cast<float>(INT_SCALE);
s.objanimdata[i].rot.pitch = static_cast<uint16_t>(static_cast<int32_t>(-(rot.x * DEG_1 / INT_SCALE)));
s.objanimdata[i].rot.direction = static_cast<uint16_t>(static_cast<int32_t>(-(rot.z * DEG_1 / INT_SCALE)));
s.objanimdata[i].rot.roll = static_cast<uint16_t>(static_cast<int32_t>(-(rot.y * DEG_1 / INT_SCALE)));
Expand Down
2 changes: 1 addition & 1 deletion lib/ivis_opengl/ivisdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 34b7516

Please sign in to comment.