History

cleaning more code

Sam Gateau committed 9 years ago

Commit 390f5b51 parent c11f46a2 files · +31 −42Browse files

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

Unified · Split

libraries/render-utils/src/Model.cpp+12−18
@@ -218,7 +218,6 @@ void Model::updateRenderItems() { · 217 unmodified lines
218 _needsUpdateClusterMatrices = true;218 _needsUpdateClusterMatrices = true;
219 _renderItemsNeedUpdate = false;219 _renderItemsNeedUpdate = false;
220 220
221
222 // queue up this work for later processing, at the end of update and just before rendering.221 // queue up this work for later processing, at the end of update and just before rendering.
223 // the application will ensure only the last lambda is actually invoked.222 // the application will ensure only the last lambda is actually invoked.
224 void* key = (void*)this;223 void* key = (void*)this;
@@ -227,7 +226,7 @@ void Model::updateRenderItems() { · 2 unmodified lines
227 226
228 // do nothing, if the model has already been destroyed.227 // do nothing, if the model has already been destroyed.
229 auto self = weakSelf.lock();228 auto self = weakSelf.lock();
230 if (!self) {229 if (!self || !self->isLoaded()) {
231 return;230 return;
232 }231 }
233 232
@@ -238,26 +237,21 @@ void Model::updateRenderItems() { · 4 unmodified lines
238 Transform modelTransform = self->getTransform();237 Transform modelTransform = self->getTransform();
239 modelTransform.setScale(glm::vec3(1.0f));238 modelTransform.setScale(glm::vec3(1.0f));
240 239
241 uint32_t deleteGeometryCounter = self->_deleteGeometryCounter;
242
243 render::Transaction transaction;240 render::Transaction transaction;
244 for (int i = 0; i < self->_modelMeshRenderItemIDs.size(); i++) {241 for (int i = 0; i < self->_modelMeshRenderItemIDs.size(); i++) {
242
245 auto itemID = self->_modelMeshRenderItemIDs[i];243 auto itemID = self->_modelMeshRenderItemIDs[i];
246 auto meshIndex = self->_modelMeshRenderItemShapes[i].meshIndex;244 auto meshIndex = self->_modelMeshRenderItemShapes[i].meshIndex;
247 if (self && self->isLoaded()) {245 auto clusterMatrices(self->getMeshState(meshIndex).clusterMatrices);
248 const Model::MeshState& state = self->getMeshState(meshIndex);246
249 auto clusterMatrices(state.clusterMatrices);247 transaction.updateItem<ModelMeshPartPayload>(itemID, [modelTransform, clusterMatrices](ModelMeshPartPayload& data) {
250 248 data.updateClusterBuffer(clusterMatrices);
251 transaction.updateItem<ModelMeshPartPayload>(itemID, [deleteGeometryCounter, modelTransform, clusterMatrices](ModelMeshPartPayload& data) {249 Transform renderTransform = modelTransform;
252 data.updateClusterBuffer(clusterMatrices);250 if (clusterMatrices.size() == 1) {
253 251 renderTransform = modelTransform.worldTransform(Transform(clusterMatrices[0]));
254 Transform renderTransform = modelTransform;252 }
255 if (clusterMatrices.size() == 1) {253 data.updateTransformForSkinnedMesh(renderTransform, modelTransform);
256 renderTransform = modelTransform.worldTransform(Transform(clusterMatrices[0]));254 });
257 }
258 data.updateTransformForSkinnedMesh(renderTransform, modelTransform);
259 });
260 }
261 }255 }
262 256
263 Transform collisionMeshOffset;257 Transform collisionMeshOffset;