mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-08 01:53:52 +00:00
fix(wob): doodad euler->quat uses glm convention to round-trip with fromWMO
Manual qx*qy*qz product was XYZ intrinsic, but fromWMO uses glm::eulerAngles which returns YXZ Tait-Bryan extrinsic. The mismatch introduced rotation drift on every save/load cycle. Using glm::quat constructed from euler radians directly applies the inverse convention of eulerAngles so the round-trip is clean.
This commit is contained in:
parent
560b4a9d35
commit
497997c50a
1 changed files with 3 additions and 6 deletions
|
|
@ -312,12 +312,9 @@ bool WoweeBuildingLoader::toWMOModel(const WoweeBuilding& building, WMOModel& ou
|
|||
WMODoodad d{};
|
||||
d.nameIndex = doodadOffset;
|
||||
d.position = dp.position;
|
||||
// Convert euler degrees -> quaternion (XYZ order)
|
||||
glm::vec3 r = glm::radians(dp.rotation);
|
||||
glm::quat qx = glm::angleAxis(r.x, glm::vec3(1, 0, 0));
|
||||
glm::quat qy = glm::angleAxis(r.y, glm::vec3(0, 1, 0));
|
||||
glm::quat qz = glm::angleAxis(r.z, glm::vec3(0, 0, 1));
|
||||
d.rotation = qx * qy * qz;
|
||||
// Convert euler degrees -> quaternion using the same convention that
|
||||
// glm::eulerAngles uses (so this round-trips cleanly with fromWMO).
|
||||
d.rotation = glm::quat(glm::radians(dp.rotation));
|
||||
d.scale = dp.scale;
|
||||
d.color = glm::vec4(1.0f);
|
||||
outModel.doodads.push_back(d);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue