From c4a1fe9a006ef3a17ea5f3a8842991a53cfa56a8 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 24 Sep 2019 11:05:33 -0700 Subject: [PATCH] Warnings --- libraries/fbx/src/GLTFSerializer.cpp | 18 +++++++++++------- libraries/hfm/src/hfm/HFM.cpp | 2 +- libraries/hfm/src/hfm/HFM.h | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp index 29b65e98c0..774c63e8dd 100755 --- a/libraries/fbx/src/GLTFSerializer.cpp +++ b/libraries/fbx/src/GLTFSerializer.cpp @@ -1094,20 +1094,25 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& setHFMMaterial(hfmMaterial, material); } + + for (int nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex) { + } + + int meshCount = _file.meshes.size(); hfmModel.meshes.resize(meshCount); hfmModel.meshExtents.reset(); - - hfmModel.meshes.resize(meshCount); for (int meshIndex = 0; meshIndex < meshCount; ++meshIndex) { const auto& gltfMesh = _file.meshes[meshIndex]; auto& mesh = hfmModel.meshes[meshIndex]; mesh.meshIndex = meshIndex; -#if 0 + if (!hfmModel.hasSkeletonJoints) { HFMCluster cluster; +#if 0 cluster.jointIndex = nodeIndex; +#endif cluster.inverseBindMatrix = glm::mat4(); cluster.inverseBindTransform = Transform(cluster.inverseBindMatrix); mesh.clusters.append(cluster); @@ -1125,7 +1130,6 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& root.inverseBindMatrix = jointInverseBindTransforms[root.jointIndex]; root.inverseBindTransform = Transform(root.inverseBindMatrix); mesh.clusters.append(root); -#endif QSet meshAttributes; for(const auto &primitive : gltfMesh.primitives) { @@ -1466,7 +1470,6 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& } } -#if 0 // Build weights (adapted from FBXSerializer.cpp) if (hfmModel.hasSkeletonJoints) { int prevMeshClusterIndexCount = mesh.clusterIndices.count(); @@ -1481,10 +1484,12 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& mesh.clusterWeights.push_back(0); } +#if 0 for (int c = 0; c < clusterJoints.size(); ++c) { mesh.clusterIndices[prevMeshClusterIndexCount + c] = originalToNewNodeIndexMap[_file.skins[node.skin].joints[clusterJoints[c]]]; } +#endif // normalize and compress to 16-bits for (int i = 0; i < numVertices; ++i) { @@ -1518,7 +1523,6 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& } } } -#endif #if 0 if (primitive.defined["material"]) { @@ -1622,9 +1626,9 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash& mesh.meshExtents.maximum += glm::vec3(EPSILON, EPSILON, EPSILON); hfmModel.meshExtents.minimum -= glm::vec3(EPSILON, EPSILON, EPSILON); hfmModel.meshExtents.maximum += glm::vec3(EPSILON, EPSILON, EPSILON); - } + for (int nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex) { const auto& node = _file.nodes[nodeIndex]; if (-1 == node.mesh) { diff --git a/libraries/hfm/src/hfm/HFM.cpp b/libraries/hfm/src/hfm/HFM.cpp index ae68c15045..3a61ebb6b9 100644 --- a/libraries/hfm/src/hfm/HFM.cpp +++ b/libraries/hfm/src/hfm/HFM.cpp @@ -175,7 +175,7 @@ void HFMModel::computeKdops() { // NOTE: points are in joint-frame ShapeVertices& points = shapeVertices.at(i); - glm::quat rotOffset = jointRotationOffsets.contains(i) ? glm::inverse(jointRotationOffsets[i]) : quat(); + glm::quat rotOffset = jointRotationOffsets.contains((int)i) ? glm::inverse(jointRotationOffsets[i]) : quat(); if (points.size() > 0) { // compute average point glm::vec3 avgPoint = glm::vec3(0.0f); diff --git a/libraries/hfm/src/hfm/HFM.h b/libraries/hfm/src/hfm/HFM.h index 39c123e9df..1a3a5ecdb2 100644 --- a/libraries/hfm/src/hfm/HFM.h +++ b/libraries/hfm/src/hfm/HFM.h @@ -124,7 +124,7 @@ class Cluster { public: static const uint32_t INVALID_JOINT_INDEX{ (uint32_t)-1 }; uint32_t jointIndex{ INVALID_JOINT_INDEX }; - glm::mat4 inverseBindMatrix; + glm::mat4 inverseBindMatrix{ glm::mat4{ 1.0 } }; Transform inverseBindTransform; };