From 14352452793f4e9d1b477c86176276b9e4fdbbcf Mon Sep 17 00:00:00 2001 From: raveenajain Date: Tue, 2 Apr 2019 21:18:16 +0100 Subject: [PATCH] root cluster --- libraries/fbx/src/GLTFSerializer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp index 84609be250..5e4716c56d 100755 --- a/libraries/fbx/src/GLTFSerializer.cpp +++ b/libraries/fbx/src/GLTFSerializer.cpp @@ -861,11 +861,11 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) { // Build skeleton std::vector jointInverseBindTransforms; + jointInverseBindTransforms.resize(numNodes); if (!_file.skins.isEmpty()) { int matrixIndex = 0; std::vector> inverseBindValues; getSkinInverseBindMatrices(inverseBindValues); - jointInverseBindTransforms.resize(numNodes); int jointIndex = finalNode; while (jointIndex != rootNode) { @@ -941,6 +941,12 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) { mesh.clusters.append(cluster); } } + HFMCluster root; + root.jointIndex = rootNode; + if (root.jointIndex == -1) { root.jointIndex = 0; } + root.inverseBindMatrix = jointInverseBindTransforms[root.jointIndex]; + root.inverseBindTransform = Transform(root.inverseBindMatrix); + mesh.clusters.append(root); HFMMeshPart part = HFMMeshPart(); @@ -1131,6 +1137,8 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) { for (int k = j; k < j + WEIGHTS_PER_VERTEX; ++k) { mesh.clusterWeights[k] = (uint16_t)(weightScalingFactor * clusterWeights[k] + ALMOST_HALF); } + } else { + mesh.clusterWeights[j] = (uint16_t)((float)(UINT16_MAX) + ALMOST_HALF); } } }