Merge pull request #15082 from SamGondelman/modelCrash

Case 21528: Possible fix for model crash
This commit is contained in:
Sam Gondelman 2019-03-05 11:27:46 -08:00 committed by GitHub
commit fd5e2b4672
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1346,14 +1346,19 @@ void Model::updateRig(float deltaTime, glm::mat4 parentTransform) {
}
void Model::computeMeshPartLocalBounds() {
for (auto& part : _modelMeshRenderItems) {
const Model::MeshState& state = _meshStates.at(part->_meshIndex);
if (_useDualQuaternionSkinning) {
part->computeAdjustedLocalBound(state.clusterDualQuaternions);
} else {
part->computeAdjustedLocalBound(state.clusterMatrices);
}
render::Transaction transaction;
auto meshStates = _meshStates;
for (auto renderItem : _modelMeshRenderItemIDs) {
transaction.updateItem<ModelMeshPartPayload>(renderItem, [this, meshStates](ModelMeshPartPayload& data) {
const Model::MeshState& state = meshStates.at(data._meshIndex);
if (_useDualQuaternionSkinning) {
data.computeAdjustedLocalBound(state.clusterDualQuaternions);
} else {
data.computeAdjustedLocalBound(state.clusterMatrices);
}
});
}
AbstractViewStateInterface::instance()->getMain3DScene()->enqueueTransaction(transaction);
}
// virtual