From 3ff4d23f7cf0ad3db3006e52bcdc833fa6d7adb2 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 11 Sep 2018 20:40:27 -0400 Subject: [PATCH] Add test --- CHANGES.md | 1 + Source/Scene/Cesium3DTilesetTraversal.js | 5 +---- .../Tilesets/TilesetOfTilesets/tileset.json | 2 +- .../Tilesets/TilesetOfTilesets/tileset2.json | 2 +- Specs/Scene/Cesium3DTilesetSpec.js | 12 ++++++++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bf2ba5572d65..2ec8b3570589 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Change Log * Added `cartographicLimitRectangle` to `Globe`. Use this to limit terrain and imagery to a specific `Rectangle` area. [#6987](https://github.com/AnalyticalGraphicsInc/cesium/pull/6987) ##### Fixes :wrench: +* Fixed an issue in the 3D Tiles traversal where external tilesets would not always traverse to their root tile. [#7035](https://github.com/AnalyticalGraphicsInc/cesium/pull/7035) * Fixed an issue in the 3D Tiles traversal where empty tiles would be selected instead of their nearest loaded ancestors. [#7011](https://github.com/AnalyticalGraphicsInc/cesium/pull/7011) ### 1.49 - 2018-09-04 diff --git a/Source/Scene/Cesium3DTilesetTraversal.js b/Source/Scene/Cesium3DTilesetTraversal.js index eb58780142f1..0aff0d6fa1e1 100644 --- a/Source/Scene/Cesium3DTilesetTraversal.js +++ b/Source/Scene/Cesium3DTilesetTraversal.js @@ -443,13 +443,10 @@ define([ return false; } if (tile.hasTilesetContent) { - // Traverse external tileset to visit its root tile. + // Traverse external tileset to visit its root tile // Don't traverse if the subtree is expired because it will be destroyed return !tile.contentExpired; } - if (tile.hasTilesetContent) { - return true; - } return tile._screenSpaceError > tileset._maximumScreenSpaceError; } diff --git a/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset.json b/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset.json index ec20e19e4225..fffe09adbcf0 100644 --- a/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset.json +++ b/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset.json @@ -33,7 +33,7 @@ 88 ] }, - "geometricError": 240, + "geometricError": 70, "refine": "ADD", "content": { "uri": "tileset2.json" diff --git a/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset2.json b/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset2.json index dc862f884d68..53f5aeb9f759 100644 --- a/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset2.json +++ b/Specs/Data/Cesium3DTiles/Tilesets/TilesetOfTilesets/tileset2.json @@ -31,7 +31,7 @@ 20 ] }, - "geometricError": 70, + "geometricError": 0, "content": { "uri": "tileset3/tileset3.json" } diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 204ae8911bc9..5f27bc510ad1 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1079,8 +1079,7 @@ defineSuite([ // return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement1Url).then(function(tileset) { tileset.root.geometricError = 90; - viewRootOnly(); - scene.camera.zoomIn(20); + setZoom(80); scene.renderForSpecs(); var statistics = tileset._statistics; @@ -1364,6 +1363,15 @@ defineSuite([ }); }); + it('always visits external tileset root', function() { + viewRootOnly(); + return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) { + var statistics = tileset._statistics; + expect(statistics.visited).toEqual(2); // Visits external tileset tile, and external tileset root + expect(statistics.numberOfCommands).toEqual(1); // Renders external tileset root + }); + }); + it('set tile color', function() { return Cesium3DTilesTester.loadTileset(scene, noBatchIdsUrl).then(function(tileset) { // Get initial color