Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Reduced animation position precision #3652

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading