Skip to content

Commit e04df47

Browse files
author
Jean Dumoulin
committed
Defers batch destruction until next update
1 parent 26756aa commit e04df47

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@
171171
}
172172
}
173173
}
174-
}
174+
}

packages/engine/Source/DataSources/StaticGeometryColorBatch.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,17 +468,18 @@ function moveItems(batch, items, time) {
468468
}
469469

470470
function updateItems(batch, items, time, isUpdated) {
471-
let length = items.length;
472-
let i;
473-
for (i = length - 1; i >= 0; i--) {
471+
for (let i = items.length - 1; i >= 0; i--) {
474472
const item = items[i];
475473
if (item.updaters.length === 0) {
476474
items.splice(i, 1);
477475
item.destroy();
478476
}
479477
}
480478

481-
return items.every(item => item.update(time));
479+
return items.reduce(
480+
(isUpdated, item) => isUpdated && item.update(time),
481+
isUpdated,
482+
);
482483
}
483484

484485
StaticGeometryColorBatch.prototype.update = function (time) {

packages/engine/Source/DataSources/StaticGeometryPerMaterialBatch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ StaticGeometryPerMaterialBatch.prototype.update = function (time) {
435435
}
436436
}
437437

438-
return items.every(item => item.update(time));
438+
return items.reduce(
439+
(isUpdated, item) => isUpdated && item.update(time),
440+
false,
441+
);
439442
};
440443

441444
StaticGeometryPerMaterialBatch.prototype.getBoundingSphere = function (

packages/engine/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,10 @@ StaticGroundPolylinePerMaterialBatch.prototype.update = function (time) {
381381
}
382382
}
383383

384-
return items.every(item => item.update(time));
384+
return items.reduce(
385+
(isUpdated, item) => isUpdated && item.update(time),
386+
false,
387+
);
385388
};
386389

387390
StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere = function (

0 commit comments

Comments
 (0)