Showing the changes to libraries/render-utils/src/Model.cpp (1 of 6 files). Show all
Unified · Split
| @@ -1418,20 +1418,21 @@ void Model::updateClusterMatrices() { · 1417 unmodified lines | ||
| 1418 | 1418 | const HFMModel& hfmModel = getHFMModel(); |
| 1419 | 1419 | for (int i = 0; i < (int) _meshStates.size(); i++) { |
| 1420 | 1420 | MeshState& state = _meshStates[i]; |
| 1421 | + int meshIndex = i; | |
| 1421 | 1422 | const HFMMesh& mesh = hfmModel.meshes.at(i); |
| 1422 | 1423 | for (int j = 0; j < mesh.clusters.size(); j++) { |
| 1423 | 1424 | const HFMCluster& cluster = mesh.clusters.at(j); |
| 1425 | + int clusterIndex = j; | |
| 1426 | + | |
| 1424 | 1427 | if (_useDualQuaternionSkinning) { |
| 1425 | 1428 | auto jointPose = _rig.getJointPose(cluster.jointIndex); |
| 1426 | 1429 | Transform jointTransform(jointPose.rot(), jointPose.scale(), jointPose.trans()); |
| 1427 | 1430 | Transform clusterTransform; |
| 1428 | − Transform::mult(clusterTransform, jointTransform, _rig.getAnimSkeleton()->_clusterBindMatrixOriginalValues[i][j].inverseBindTransform); | |
| 1429 | − //Transform::mult(clusterTransform, jointTransform, cluster.inverseBindTransform); | |
| 1431 | + Transform::mult(clusterTransform, jointTransform, _rig.getAnimSkeleton()->getClusterBindMatricesOriginalValues(meshIndex, clusterIndex).inverseBindTransform); | |
| 1430 | 1432 | state.clusterDualQuaternions[j] = Model::TransformDualQuaternion(clusterTransform); |
| 1431 | 1433 | } else { |
| 1432 | 1434 | auto jointMatrix = _rig.getJointTransform(cluster.jointIndex); |
| 1433 | − glm_mat4u_mul(jointMatrix, _rig.getAnimSkeleton()->_clusterBindMatrixOriginalValues[i][j].inverseBindMatrix, state.clusterMatrices[j]); | |
| 1434 | − // glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterMatrices[j]); | |
| 1435 | + glm_mat4u_mul(jointMatrix, _rig.getAnimSkeleton()->getClusterBindMatricesOriginalValues(meshIndex, clusterIndex).inverseBindMatrix, state.clusterMatrices[j]); | |
| 1435 | 1436 | } |
| 1436 | 1437 | } |
| 1437 | 1438 | } |