Showing the changes to libraries/render-utils/src/CauterizedModel.cpp (1 of 5 files). Show all
Unified · Split
| @@ -113,12 +113,7 @@ void CauterizedModel::updateClusterMatrices() { · 112 unmodified lines | ||
| 113 | 113 | for (int i = 0; i < (int)_meshStates.size(); i++) { |
| 114 | 114 | Model::MeshState& state = _meshStates[i]; |
| 115 | 115 | const FBXMesh& mesh = geometry.meshes.at(i); |
| 116 | −#if defined(SKIN_DQ) | |
| 117 | − // HACK: FOR DQ go thru reverse order! | |
| 118 | − for (int j = mesh.clusters.size() - 1; j >= 0; j--) { | |
| 119 | −#else | |
| 120 | 116 | for (int j = 0; j < mesh.clusters.size(); j++) { |
| 121 | −#endif | |
| 122 | 117 | const FBXCluster& cluster = mesh.clusters.at(j); |
| 123 | 118 | |
| 124 | 119 | auto jointMatrix = _rig.getJointTransform(cluster.jointIndex); |
| @@ -132,25 +127,6 @@ void CauterizedModel::updateClusterMatrices() { · 7 unmodified lines | ||
| 132 | 127 | glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, m); |
| 133 | 128 | AnimPose p(m); |
| 134 | 129 | state.clusterTransforms[j] = Model::TransformDualQuaternion(m); |
| 135 | − | |
| 136 | − // AJT: HACK n^2!!!! fix me, find parent clusterTransform. | |
| 137 | − int parentIndex = _rig.getJointParentIndex(cluster.jointIndex); | |
| 138 | − int parentClusterIndex = -1; | |
| 139 | − // scan for parent! | |
| 140 | − for (int ii = mesh.clusters.size() - 1; ii > j; ii--) { | |
| 141 | − if (mesh.clusters[ii].jointIndex == parentIndex) { | |
| 142 | − parentClusterIndex = ii; | |
| 143 | − break; | |
| 144 | − } | |
| 145 | − } | |
| 146 | − | |
| 147 | − // ensure that we have the same polarity as our parent! | |
| 148 | − if (parentClusterIndex >= 0) { | |
| 149 | − //if (state.clusterTransforms[parentClusterIndex]._dq.dot(state.clusterTransforms[j]._dq) < 0.0f) { | |
| 150 | − if (glm::dot(state.clusterTransforms[parentClusterIndex]._dq.real(), state.clusterTransforms[j]._dq.real()) < 0.0f) { | |
| 151 | − state.clusterTransforms[j]._dq = -state.clusterTransforms[j]._dq; | |
| 152 | − } | |
| 153 | − } | |
| 154 | 130 | #else |
| 155 | 131 | glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterTransforms[j]); |
| 156 | 132 | #endif |
| @@ -171,12 +147,7 @@ void CauterizedModel::updateClusterMatrices() { · 14 unmodified lines | ||
| 171 | 147 | Model::MeshState& state = _cauterizeMeshStates[i]; |
| 172 | 148 | const FBXMesh& mesh = geometry.meshes.at(i); |
| 173 | 149 | |
| 174 | −#if defined(SKIN_DQ) | |
| 175 | − // HACK: FOR DQ go thru reverse order! | |
| 176 | − for (int j = mesh.clusters.size() - 1; j >= 0; j--) { | |
| 177 | −#else | |
| 178 | − for (int j = 0; j < mesh.clusters.size(); j++) { | |
| 179 | −#endif | |
| 150 | + for (int j = 0; j < mesh.clusters.size(); j++) { | |
| 180 | 151 | const FBXCluster& cluster = mesh.clusters.at(j); |
| 181 | 152 | |
| 182 | 153 | auto jointMatrix = _rig.getJointTransform(cluster.jointIndex); |
| @@ -194,25 +165,6 @@ void CauterizedModel::updateClusterMatrices() { · 11 unmodified lines | ||
| 194 | 165 | glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, m); |
| 195 | 166 | AnimPose p(m); |
| 196 | 167 | state.clusterTransforms[j] = Model::TransformDualQuaternion(m); |
| 197 | − | |
| 198 | − // AJT: HACK n^2!!!! fix me, find parent clusterTransform. | |
| 199 | − int parentIndex = _rig.getJointParentIndex(cluster.jointIndex); | |
| 200 | − int parentClusterIndex = -1; | |
| 201 | − // scan for parent! | |
| 202 | − for (int ii = mesh.clusters.size() - 1; ii > j; ii--) { | |
| 203 | − if (mesh.clusters[ii].jointIndex == parentIndex) { | |
| 204 | − parentClusterIndex = ii; | |
| 205 | − break; | |
| 206 | − } | |
| 207 | − } | |
| 208 | − | |
| 209 | − // ensure that we have the same polarity as our parent! | |
| 210 | − if (parentClusterIndex >= 0) { | |
| 211 | − //if (state.clusterTransforms[parentClusterIndex]._dq.dot(state.clusterTransforms[j]._dq) < 0.0f) { | |
| 212 | − if (glm::dot(state.clusterTransforms[parentClusterIndex]._dq.real(), state.clusterTransforms[j]._dq.real()) < 0.0f) { | |
| 213 | − state.clusterTransforms[j]._dq = -state.clusterTransforms[j]._dq; | |
| 214 | − } | |
| 215 | − } | |
| 216 | 168 | #else |
| 217 | 169 | glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterTransforms[j]); |
| 218 | 170 | #endif |