mirror of
https://github.com/overte-org/overte.git
synced 2025-06-16 13:40:11 +02:00
apply axis rotation to translation and meshes
This commit is contained in:
parent
ff7995ae18
commit
b2d08e9d42
1 changed files with 8 additions and 3 deletions
|
@ -1281,8 +1281,9 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
|
||||||
joint.geometricScaling = fbxModel.geometricScaling;
|
joint.geometricScaling = fbxModel.geometricScaling;
|
||||||
joint.isSkeletonJoint = fbxModel.isLimbNode;
|
joint.isSkeletonJoint = fbxModel.isLimbNode;
|
||||||
hfmModel.hasSkeletonJoints = (hfmModel.hasSkeletonJoints || joint.isSkeletonJoint);
|
hfmModel.hasSkeletonJoints = (hfmModel.hasSkeletonJoints || joint.isSkeletonJoint);
|
||||||
if (applyUpAxisZRotation && joint.parentIndex == -1 && !joint.isSkeletonJoint) {
|
if (applyUpAxisZRotation && joint.parentIndex == -1) {
|
||||||
joint.rotation *= upAxisZRotation;
|
joint.rotation *= upAxisZRotation;
|
||||||
|
joint.translation = upAxisZRotation * joint.translation;
|
||||||
}
|
}
|
||||||
glm::quat combinedRotation = joint.preRotation * joint.rotation * joint.postRotation;
|
glm::quat combinedRotation = joint.preRotation * joint.rotation * joint.postRotation;
|
||||||
if (joint.parentIndex == -1) {
|
if (joint.parentIndex == -1) {
|
||||||
|
@ -1678,8 +1679,12 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applyUpAxisZRotation) {
|
if (applyUpAxisZRotation) {
|
||||||
hfmModelPtr->meshExtents.rotate(upAxisZRotation);
|
hfmModelPtr->meshExtents.transform(glm::mat4_cast(upAxisZRotation));
|
||||||
hfmModelPtr->bindExtents.rotate(upAxisZRotation);
|
hfmModelPtr->bindExtents.transform(glm::mat4_cast(upAxisZRotation));
|
||||||
|
for (auto &mesh : hfmModelPtr->meshes) {
|
||||||
|
mesh.modelTransform *= glm::mat4_cast(upAxisZRotation);
|
||||||
|
mesh.meshExtents.transform(glm::mat4_cast(upAxisZRotation));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return hfmModelPtr;
|
return hfmModelPtr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue