Merge pull request #1 from samcake/model-cleanup

Factorization of the modelTransform out of the cluster matrices
This commit is contained in:
Andrew Meadows 2017-01-11 06:33:59 -08:00 committed by GitHub
commit 1b5fd52165
2 changed files with 4 additions and 4 deletions

View file

@ -372,7 +372,7 @@ void ModelMeshPartPayload::updateTransformForSkinnedMesh(const Transform& transf
_worldBound.transform(transform);
if (clusterMatrices.size() == 1) {
_transform.worldTransform(Transform(clusterMatrices[0]));
_transform = _transform.worldTransform(Transform(clusterMatrices[0]));
}
}
}
@ -586,7 +586,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) const {
// Bind the model transform and the skinCLusterMatrices if needed
bool canCauterize = args->_renderMode != RenderArgs::SHADOW_RENDER_MODE;
// TODO: maybe get rid of this call?
_model->updateClusterMatrices(_transform.getTranslation(), _transform.getRotation());
// _model->updateClusterMatrices(_transform.getTranslation(), _transform.getRotation());
bindTransform(batch, locations, canCauterize);
//Bind the index buffer and vertex buffer and Blend shapes if needed

View file

@ -1174,8 +1174,8 @@ void Model::updateClusterMatrices(glm::vec3 modelPosition, glm::quat modelOrient
const FBXCluster& cluster = mesh.clusters.at(j);
auto jointMatrix = _rig->getJointTransform(cluster.jointIndex);
#if GLM_ARCH & GLM_ARCH_SSE2
glm::mat4 temp, out, inverseBindMatrix = cluster.inverseBindMatrix;
glm_mat4_mul((glm_vec4*)&temp, (glm_vec4*)&inverseBindMatrix, (glm_vec4*)&out);
glm::mat4 out, inverseBindMatrix = cluster.inverseBindMatrix;
glm_mat4_mul((glm_vec4*)&jointMatrix, (glm_vec4*)&inverseBindMatrix, (glm_vec4*)&out);
state.clusterMatrices[j] = out;
#else
state.clusterMatrices[j] = jointMatrix * cluster.inverseBindMatrix;