History

modelToWorld rotation not in cluster matrices

Andrew Meadows committed 9 years ago

Commit 44699fc1 parent 0b574e13 files · +17 −26Browse files

Showing the changes to libraries/render-utils/src/Model.cpp (1 of 3 files). Show all

Unified · Split

libraries/render-utils/src/Model.cpp+4−6
@@ -245,7 +245,7 @@ void Model::updateRenderItems() { · 244 unmodified lines
245245
246246 // update the model transform and bounding box for this render item.
247247 const Model::MeshState& state = data._model->_meshStates.at(data._meshIndex);
248− data.updateTransformForSkinnedMesh(modelTransform, modelMeshOffset, state.clusterMatrices);
248+ data.updateTransformForSkinnedMesh(modelTransform, state.clusterMatrices);
249249 }
250250 }
251251 });
@@ -1167,7 +1167,6 @@ void Model::updateClusterMatrices(glm::vec3 modelPosition, glm::quat modelOrient · 915 unmodified lines
11671167 glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
11681168 auto cauterizeMatrix = _rig->getJointTransform(geometry.neckJointIndex) * zeroScale;
11691169
1170− glm::mat4 modelToWorld = glm::mat4_cast(modelOrientation);
11711170 for (int i = 0; i < _meshStates.size(); i++) {
11721171 MeshState& state = _meshStates[i];
11731172 const FBXMesh& mesh = geometry.meshes.at(i);
@@ -1176,11 +1175,10 @@ void Model::updateClusterMatrices(glm::vec3 modelPosition, glm::quat modelOrient · 2 unmodified lines
11761175 auto jointMatrix = _rig->getJointTransform(cluster.jointIndex);
11771176 #if GLM_ARCH & GLM_ARCH_SSE2
11781177 glm::mat4 temp, out, inverseBindMatrix = cluster.inverseBindMatrix;
1179− glm_mat4_mul((glm_vec4*)&modelToWorld, (glm_vec4*)&jointMatrix, (glm_vec4*)&temp);
11801178 glm_mat4_mul((glm_vec4*)&temp, (glm_vec4*)&inverseBindMatrix, (glm_vec4*)&out);
11811179 state.clusterMatrices[j] = out;
1182−#else
1183− state.clusterMatrices[j] = modelToWorld * jointMatrix * cluster.inverseBindMatrix;
1180+#else
1181+ state.clusterMatrices[j] = jointMatrix * cluster.inverseBindMatrix;
11841182 #endif
11851183
11861184 // as an optimization, don't build cautrizedClusterMatrices if the boneSet is empty.
@@ -1188,7 +1186,7 @@ void Model::updateClusterMatrices(glm::vec3 modelPosition, glm::quat modelOrient · 1 unmodified line
11881186 if (_cauterizeBoneSet.find(cluster.jointIndex) != _cauterizeBoneSet.end()) {
11891187 jointMatrix = cauterizeMatrix;
11901188 }
1191− state.cauterizedClusterMatrices[j] = modelToWorld * jointMatrix * cluster.inverseBindMatrix;
1189+ state.cauterizedClusterMatrices[j] = jointMatrix * cluster.inverseBindMatrix;
11921190 }
11931191 }
11941192