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 | const HFMModel& hfmModel = getHFMModel(); | 1418 | const HFMModel& hfmModel = getHFMModel(); |
| 1419 | for (int i = 0; i < (int) _meshStates.size(); i++) { | 1419 | for (int i = 0; i < (int) _meshStates.size(); i++) { |
| 1420 | MeshState& state = _meshStates[i]; | 1420 | MeshState& state = _meshStates[i]; |
| 1421 | int meshIndex = i; | ||
| 1421 | const HFMMesh& mesh = hfmModel.meshes.at(i); | 1422 | const HFMMesh& mesh = hfmModel.meshes.at(i); |
| 1422 | for (int j = 0; j < mesh.clusters.size(); j++) { | 1423 | for (int j = 0; j < mesh.clusters.size(); j++) { |
| 1423 | const HFMCluster& cluster = mesh.clusters.at(j); | 1424 | const HFMCluster& cluster = mesh.clusters.at(j); |
| 1425 | int clusterIndex = j; | ||
| 1426 | |||
| 1424 | if (_useDualQuaternionSkinning) { | 1427 | if (_useDualQuaternionSkinning) { |
| 1425 | auto jointPose = _rig.getJointPose(cluster.jointIndex); | 1428 | auto jointPose = _rig.getJointPose(cluster.jointIndex); |
| 1426 | Transform jointTransform(jointPose.rot(), jointPose.scale(), jointPose.trans()); | 1429 | Transform jointTransform(jointPose.rot(), jointPose.scale(), jointPose.trans()); |
| 1427 | Transform clusterTransform; | 1430 | Transform clusterTransform; |
| 1428 | Transform::mult(clusterTransform, jointTransform, _rig.getAnimSkeleton()->_clusterBindMatrixOriginalValues[i][j].inverseBindTransform); | 1431 | Transform::mult(clusterTransform, jointTransform, _rig.getAnimSkeleton()->getClusterBindMatricesOriginalValues(meshIndex, clusterIndex).inverseBindTransform); |
| 1429 | //Transform::mult(clusterTransform, jointTransform, cluster.inverseBindTransform); | ||
| 1430 | state.clusterDualQuaternions[j] = Model::TransformDualQuaternion(clusterTransform); | 1432 | state.clusterDualQuaternions[j] = Model::TransformDualQuaternion(clusterTransform); |
| 1431 | } else { | 1433 | } else { |
| 1432 | auto jointMatrix = _rig.getJointTransform(cluster.jointIndex); | 1434 | auto jointMatrix = _rig.getJointTransform(cluster.jointIndex); |
| 1433 | glm_mat4u_mul(jointMatrix, _rig.getAnimSkeleton()->_clusterBindMatrixOriginalValues[i][j].inverseBindMatrix, state.clusterMatrices[j]); | 1435 | glm_mat4u_mul(jointMatrix, _rig.getAnimSkeleton()->getClusterBindMatricesOriginalValues(meshIndex, clusterIndex).inverseBindMatrix, state.clusterMatrices[j]); |
| 1434 | // glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterMatrices[j]); | ||
| 1435 | } | 1436 | } |
| 1436 | } | 1437 | } |
| 1437 | } | 1438 | } |