From b1a3c3d079c02ef242dc346b9355b492727ef06e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 27 Mar 2018 13:51:24 -0400 Subject: [PATCH 1/5] Better handling of processing tiles --- Source/Scene/Cesium3DTileset.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index e4590a8d60e1..97695b384a1b 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -28,6 +28,7 @@ define([ './Axis', './Cesium3DTile', './Cesium3DTileColorBlendMode', + './Cesium3DTileContentState', './Cesium3DTileOptimizations', './Cesium3DTilesetStatistics', './Cesium3DTilesetTraversal', @@ -72,6 +73,7 @@ define([ Axis, Cesium3DTile, Cesium3DTileColorBlendMode, + Cesium3DTileContentState, Cesium3DTileOptimizations, Cesium3DTilesetStatistics, Cesium3DTilesetTraversal, @@ -1484,16 +1486,13 @@ define([ function removeFromProcessingQueue(tileset, tile) { return function() { - var index = tileset._processingQueue.indexOf(tile); - if (index === -1) { + if (tile._contentState === Cesium3DTileContentState.FAILED) { // Not in processing queue // For example, when a url request fails and the ready promise is rejected --tileset._statistics.numberOfPendingRequests; return; } - // Remove from processing queue - tileset._processingQueue.splice(index, 1); --tileset._statistics.numberOfTilesProcessing; if (tile.hasRenderableContent) { @@ -1510,15 +1509,34 @@ define([ }; } + function filterProcessingQueue(tileset) { + var tiles = tileset._processingQueue; + var length = tiles.length; + + var removeCount = 0; + for (var i = 0; i < length; ++i) { + var tile = tiles[i]; + if (tile._contentState !== Cesium3DTileContentState.PROCESSING) { + ++removeCount; + continue; + } + if (removeCount > 0) { + tiles[i - removeCount] = tile; + } + } + tiles.length -= removeCount; + } + function processTiles(tileset, frameState) { var tiles = tileset._processingQueue; var length = tiles.length; // Process tiles in the PROCESSING state so they will eventually move to the READY state. - // Traverse backwards in case a tile is removed as a result of calling process() - for (var i = length - 1; i >= 0; --i) { + for (var i = 0; i < length; ++i) { tiles[i].process(tileset, frameState); } + + filterProcessingQueue(tileset); } /////////////////////////////////////////////////////////////////////////// From 7a445edbaf4abc2fba4ec9411b5c69e0fc393b10 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 27 Mar 2018 13:53:54 -0400 Subject: [PATCH 2/5] Updated CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 72ef4f9ff1d3..0fa6be338dac 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,6 +33,7 @@ Change Log * Added support for ordering in `DataSourceCollection` [#6316](https://github.com/AnalyticalGraphicsInc/cesium/pull/6316) * 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. * Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection. +* Improved processing order of 3D tiles. [#6364](https://github.com/AnalyticalGraphicsInc/cesium/pull/6364) ##### Fixes :wrench: * Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302) @@ -44,7 +45,6 @@ Change Log * Fixed animation for glTF models with missing animation targets. [#6351](https://github.com/AnalyticalGraphicsInc/cesium/pull/6351) * Fixed double-sided flag for glTF materials with `BLEND` enabled. [#6371](https://github.com/AnalyticalGraphicsInc/cesium/pull/6371) - ### 1.43 - 2018-03-01 ##### Major Announcements :loudspeaker: From 785a24aa846ef87c2de22fb7e7dd635ed2c8defa Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 27 Mar 2018 14:24:02 -0400 Subject: [PATCH 3/5] Rename file --- .../InstancedGltfExternal/{Box.glb => boxtemp.glb} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/{Box.glb => boxtemp.glb} (100%) diff --git a/Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/Box.glb b/Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/boxtemp.glb similarity index 100% rename from Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/Box.glb rename to Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/boxtemp.glb From acf21f4c9ac085f7aa5752782d5f56564fde3c09 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 27 Mar 2018 14:26:08 -0400 Subject: [PATCH 4/5] Rename file back to lowercase --- .../InstancedGltfExternal/{boxtemp.glb => box.glb} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/{boxtemp.glb => box.glb} (100%) diff --git a/Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/boxtemp.glb b/Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/box.glb similarity index 100% rename from Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/boxtemp.glb rename to Specs/Data/Cesium3DTiles/Instanced/InstancedGltfExternal/box.glb From 70370f7632924986b7361a319fd7d2d2a24b012b Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 28 Mar 2018 11:07:02 -0400 Subject: [PATCH 5/5] Move filter before loop in case tiles are already ready or failed --- Source/Scene/Cesium3DTileset.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 97695b384a1b..951a50829721 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1528,6 +1528,7 @@ define([ } function processTiles(tileset, frameState) { + filterProcessingQueue(tileset); var tiles = tileset._processingQueue; var length = tiles.length; @@ -1535,8 +1536,6 @@ define([ for (var i = 0; i < length; ++i) { tiles[i].process(tileset, frameState); } - - filterProcessingQueue(tileset); } ///////////////////////////////////////////////////////////////////////////