Skip to content

Commit b19a430

Browse files
author
Jean Dumoulin
committed
Defers batch destruction until next update
1 parent 4779b3a commit b19a430

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
"compression": "^1.7.4",
6363
"esbuild": "^0.25.8",
6464
"eslint": "^9.32.0",
65+
"eslint-config-prettier": "^10.1.8",
6566
"eslint-plugin-html": "^8.1.1",
67+
"eslint-plugin-n": "^17.21.3",
6668
"express": "^5.1.0",
6769
"globals": "^16.0.0",
6870
"globby": "^14.0.0",
@@ -158,4 +160,4 @@
158160
"packages/engine",
159161
"packages/widgets"
160162
]
161-
}
163+
}

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+
false,
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)