mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:38:00 +02:00
Fix build warning with cluster.jointIndex in FBXSerializer
This commit is contained in:
parent
f9dd3a9aec
commit
bf65711e04
1 changed files with 11 additions and 11 deletions
|
@ -1428,7 +1428,11 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
meshShapes.reserve(instanceModelIDs.size() * mesh.parts.size());
|
meshShapes.reserve(instanceModelIDs.size() * mesh.parts.size());
|
||||||
for (const QString& modelID : instanceModelIDs) {
|
for (const QString& modelID : instanceModelIDs) {
|
||||||
// The transform node has the same indexing order as the joints
|
// The transform node has the same indexing order as the joints
|
||||||
const uint32_t transformIndex = (uint32_t)modelIDs.indexOf(modelID);
|
int indexOfModelID = modelIDs.indexOf(modelID);
|
||||||
|
if (indexOfModelID == -1) {
|
||||||
|
qCDebug(modelformat) << "Model not in model list: " << modelID;
|
||||||
|
}
|
||||||
|
const uint32_t transformIndex = (indexOfModelID == -1) ? 0 : (uint32_t)indexOfModelID;
|
||||||
|
|
||||||
// accumulate local transforms
|
// accumulate local transforms
|
||||||
glm::mat4 globalTransform = hfmModel.joints[transformIndex].globalTransform;
|
glm::mat4 globalTransform = hfmModel.joints[transformIndex].globalTransform;
|
||||||
|
@ -1513,12 +1517,6 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto rootJointIndex = modelIDs.indexOf(modelID);
|
|
||||||
if (rootJointIndex == -1) {
|
|
||||||
qCDebug(modelformat) << "Model not in model list: " << modelID;
|
|
||||||
rootJointIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// whether we're skinned depends on how many clusters are attached
|
// whether we're skinned depends on how many clusters are attached
|
||||||
if (clusterIDs.size() > 1) {
|
if (clusterIDs.size() > 1) {
|
||||||
hfm::DynamicTransform dynamicTransform;
|
hfm::DynamicTransform dynamicTransform;
|
||||||
|
@ -1531,10 +1529,12 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
// see http://stackoverflow.com/questions/13566608/loading-skinning-information-from-fbx for a discussion
|
// see http://stackoverflow.com/questions/13566608/loading-skinning-information-from-fbx for a discussion
|
||||||
// of skinning information in FBX
|
// of skinning information in FBX
|
||||||
QString jointID = _connectionChildMap.value(clusterID);
|
QString jointID = _connectionChildMap.value(clusterID);
|
||||||
hfmCluster.jointIndex = modelIDs.indexOf(jointID);
|
int indexOfJointID = modelIDs.indexOf(jointID);
|
||||||
if (hfmCluster.jointIndex == -1) {
|
if (indexOfJointID == -1) {
|
||||||
qCDebug(modelformat) << "Joint not in model list: " << jointID;
|
qCDebug(modelformat) << "Joint not in model list: " << jointID;
|
||||||
hfmCluster.jointIndex = 0;
|
hfmCluster.jointIndex = 0;
|
||||||
|
} else {
|
||||||
|
hfmCluster.jointIndex = (uint32_t)indexOfJointID;
|
||||||
}
|
}
|
||||||
|
|
||||||
hfmCluster.inverseBindMatrix = glm::inverse(fbxCluster.transformLink) * globalTransform;
|
hfmCluster.inverseBindMatrix = glm::inverse(fbxCluster.transformLink) * globalTransform;
|
||||||
|
@ -1563,7 +1563,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
|
|
||||||
// the last cluster is the root cluster
|
// the last cluster is the root cluster
|
||||||
HFMCluster cluster;
|
HFMCluster cluster;
|
||||||
cluster.jointIndex = rootJointIndex;
|
cluster.jointIndex = transformIndex;
|
||||||
clusters.push_back(cluster);
|
clusters.push_back(cluster);
|
||||||
|
|
||||||
// Skinned mesh instances have a dynamic transform
|
// Skinned mesh instances have a dynamic transform
|
||||||
|
@ -1599,7 +1599,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this is a single-joint mesh
|
// this is a single-joint mesh
|
||||||
HFMJoint& joint = hfmModel.joints[rootJointIndex];
|
HFMJoint& joint = hfmModel.joints[transformIndex];
|
||||||
|
|
||||||
// Apply geometric offset, if present, by transforming the vertices directly
|
// Apply geometric offset, if present, by transforming the vertices directly
|
||||||
if (joint.hasGeometricOffset) {
|
if (joint.hasGeometricOffset) {
|
||||||
|
|
Loading…
Reference in a new issue