Skip to content

Commit 6e7eb4f

Browse files
authored
Merge pull request #6364 from AnalyticalGraphicsInc/processing-queue
Better handling of processing 3d tiles
2 parents fa3a642 + 70a73cb commit 6e7eb4f

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Change Log
3535
* Added support for ordering in `DataSourceCollection` [#6316](https://github.com/AnalyticalGraphicsInc/cesium/pull/6316)
3636
* All ground geometry from one `DataSource` will render in front of all ground geometry from another `DataSource` in the same collection with a lower index.
3737
* Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection.
38+
* Improved processing order of 3D tiles. [#6364](https://github.com/AnalyticalGraphicsInc/cesium/pull/6364)
3839

3940
##### Fixes :wrench:
4041
* Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302)

Source/Scene/Cesium3DTileset.js

+23-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ define([
2828
'./Axis',
2929
'./Cesium3DTile',
3030
'./Cesium3DTileColorBlendMode',
31+
'./Cesium3DTileContentState',
3132
'./Cesium3DTileOptimizations',
3233
'./Cesium3DTilesetStatistics',
3334
'./Cesium3DTilesetTraversal',
@@ -72,6 +73,7 @@ define([
7273
Axis,
7374
Cesium3DTile,
7475
Cesium3DTileColorBlendMode,
76+
Cesium3DTileContentState,
7577
Cesium3DTileOptimizations,
7678
Cesium3DTilesetStatistics,
7779
Cesium3DTilesetTraversal,
@@ -1484,16 +1486,13 @@ define([
14841486

14851487
function removeFromProcessingQueue(tileset, tile) {
14861488
return function() {
1487-
var index = tileset._processingQueue.indexOf(tile);
1488-
if (index === -1) {
1489+
if (tile._contentState === Cesium3DTileContentState.FAILED) {
14891490
// Not in processing queue
14901491
// For example, when a url request fails and the ready promise is rejected
14911492
--tileset._statistics.numberOfPendingRequests;
14921493
return;
14931494
}
14941495

1495-
// Remove from processing queue
1496-
tileset._processingQueue.splice(index, 1);
14971496
--tileset._statistics.numberOfTilesProcessing;
14981497

14991498
if (tile.hasRenderableContent) {
@@ -1510,13 +1509,31 @@ define([
15101509
};
15111510
}
15121511

1512+
function filterProcessingQueue(tileset) {
1513+
var tiles = tileset._processingQueue;
1514+
var length = tiles.length;
1515+
1516+
var removeCount = 0;
1517+
for (var i = 0; i < length; ++i) {
1518+
var tile = tiles[i];
1519+
if (tile._contentState !== Cesium3DTileContentState.PROCESSING) {
1520+
++removeCount;
1521+
continue;
1522+
}
1523+
if (removeCount > 0) {
1524+
tiles[i - removeCount] = tile;
1525+
}
1526+
}
1527+
tiles.length -= removeCount;
1528+
}
1529+
15131530
function processTiles(tileset, frameState) {
1531+
filterProcessingQueue(tileset);
15141532
var tiles = tileset._processingQueue;
15151533
var length = tiles.length;
15161534

15171535
// Process tiles in the PROCESSING state so they will eventually move to the READY state.
1518-
// Traverse backwards in case a tile is removed as a result of calling process()
1519-
for (var i = length - 1; i >= 0; --i) {
1536+
for (var i = 0; i < length; ++i) {
15201537
tiles[i].process(tileset, frameState);
15211538
}
15221539
}

0 commit comments

Comments
 (0)