adding the member variable to keep track of the orig bind matrices to fbx.h

This commit is contained in:
amantley 2018-11-12 14:39:48 -08:00
parent 3f732baf86
commit bcd651a65d
3 changed files with 13 additions and 4 deletions

View file

@ -52,6 +52,10 @@ AnimSkeleton::AnimSkeleton(const HFMModel& hfmModel) {
AnimPose localOffset(hfmModel.jointRotationOffsets[cluster.jointIndex], glm::vec3());
//AnimPose localOffset(offset2, glm::vec3());
cluster.inverseBindMatrix = (glm::mat4)localOffset.inverse() * cluster.inverseBindMatrix;
qCDebug(animation) << "the new bind matrix num: " << cluster.jointIndex << cluster.inverseBindMatrix;
//if ((hfmModel.clusterBindMatrixOriginalValues.size() > i) && (hfmModel.clusterBindMatrixOriginalValues[i].contains(cluster.jointIndex))) {
// qCDebug(animation) << "the saved orig matrix num: " << cluster.jointIndex << hfmModel.clusterBindMatrixOriginalValues[i][cluster.jointIndex];
//}
cluster.inverseBindTransform.evalFromRawMatrix(cluster.inverseBindMatrix);
}

View file

@ -349,7 +349,7 @@ public:
Extents meshExtents;
QVector<HFMAnimationFrame> animationFrames;
std::vector<std::vector<glm::mat4>> clusterBindMatrixOriginalValues;
std::vector<QMap<int,glm::mat4>> clusterBindMatrixOriginalValues;
int getJointIndex(const QString& name) const { return jointIndices.value(name) - 1; }
QStringList getJointNames() const;

View file

@ -2033,15 +2033,20 @@ HFMModel* FBXReader::extractHFMModel(const QVariantHash& mapping, const QString&
}
//hfmModel.jointRotationOffsets.insert(13, glm::quat(0.5f, 0.5f, 0.5f, -0.5f));
//hfmModel.jointRotationOffsets.insert(62, glm::quat(0.7071f, 0.0f, -0.7071f, 0.0f));
/*
for (int i = 0; i < (int)hfmModel.meshes.size(); i++) {
const HFMMesh& mesh = hfmModel.meshes.at(i);
QMap<int,glm::mat4> tempBindMat;
for (int j = 0; j < mesh.clusters.size(); j++) {
const HFMCluster& cluster = mesh.clusters.at(j);
hfmModel.clusterBindMatrixOriginalValues[i][cluster.jointIndex] = cluster.inverseBindMatrix;
tempBindMat.insert(cluster.jointIndex, cluster.inverseBindMatrix);
//if(hfmModel.clusterBindMatrixOriginalValues[i])
//hfmModel.clusterBindMatrixOriginalValues[i].insert(cluster.jointIndex,Matrices::IDENTITY);// cluster.inverseBindMatrix;
//glm::mat4 testMat = cluster.inverseBindMatrix;
}
hfmModel.clusterBindMatrixOriginalValues.push_back(tempBindMat);
}
*/
return hfmModelPtr;
}