mirror of
https://github.com/overte-org/overte.git
synced 2025-05-31 13:51:00 +02:00
Merge pull request #1 from samcake/model-cleanup
Factorization of the modelTransform out of the cluster matrices
This commit is contained in:
commit
1b5fd52165
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue