From ff908a36d60abbcedb4156ab94cbcdace8992a96 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Wed, 30 Oct 2019 11:49:28 -0700 Subject: [PATCH] Define separately globalTransformForCluster and localTransformForCluster for clarity --- libraries/fbx/src/FBXSerializer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index 548d2924d4..91e85cd1af 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -1336,10 +1336,13 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const // First, calculate the FBX-specific transform used for inverse bind transform calculations glm::quat jointBindCombinedRotation = fbxModel.preRotation * fbxModel.rotation * fbxModel.postRotation; - glm::mat4 globalTransformForCluster = glm::translate(fbxModel.translation) * fbxModel.preTransform * glm::mat4_cast(jointBindCombinedRotation) * fbxModel.postTransform; + const glm::mat4 localTransformForCluster = glm::translate(fbxModel.translation) * fbxModel.preTransform * glm::mat4_cast(jointBindCombinedRotation) * fbxModel.postTransform; + glm::mat4 globalTransformForCluster; if (fbxModel.parentIndex != -1 && fbxModel.parentIndex < (int)jointIndex && !needMixamoHack) { const glm::mat4& parentGlobalTransformForCluster = globalTransformForClusters[fbxModel.parentIndex]; - globalTransformForCluster = parentGlobalTransformForCluster * globalTransformForCluster; + globalTransformForCluster = parentGlobalTransformForCluster * localTransformForCluster; + } else { + globalTransformForCluster = localTransformForCluster; } if (fbxModel.hasGeometricOffset) { glm::mat4 geometricOffset = createMatFromScaleQuatAndPos(fbxModel.geometricScaling, fbxModel.geometricRotation, fbxModel.geometricTranslation);