Skip to content

Commit

Permalink
Select ancestor of empty tile that can't refine
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Sep 6, 2018
1 parent c36e4d3 commit 0ee1094
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change Log
==========

### 1.50 - 2018-10-01

##### Fixes :wrench:

* 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

##### Breaking Changes :mega:
Expand Down
26 changes: 17 additions & 9 deletions Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,15 @@ define([
var childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
var child = children[i];
if (child.contentAvailable) {
updateTile(tileset, child, frameState);
touchTile(tileset, child, frameState);
selectTile(tileset, child, frameState);
} else if (child._depth - root._depth < descendantSelectionDepth) {
// Continue traversing, but not too far
stack.push(child);
if (isVisible(child)) {
if (child.contentAvailable) {
updateTile(tileset, child, frameState);
touchTile(tileset, child, frameState);
selectTile(tileset, child, frameState);
} else if (child._depth - root._depth < descendantSelectionDepth) {
// Continue traversing, but not too far
stack.push(child);
}
}
}
}
Expand Down Expand Up @@ -469,11 +471,17 @@ define([
refines = updateAndPushChildren(tileset, tile, stack, frameState) && parentRefines;
}

var stoppedRefining = !refines && parentRefines;

if (hasEmptyContent(tile)) {
// Add empty tile just to show its debug bounding volume
// If the tile has tileset content load the external tileset
// If the tile cannot refine further select its nearest loaded ancestor
addEmptyTile(tileset, tile, frameState);
loadTile(tileset, tile, frameState);
if (stoppedRefining) {
selectDesiredTile(tileset, tile, frameState);
}
} else if (add) {
// Additive tiles are always loaded and selected
selectDesiredTile(tileset, tile, frameState);
Expand All @@ -483,13 +491,13 @@ define([
// Always load tiles in the base traversal
// Select tiles that can't refine further
loadTile(tileset, tile, frameState);
if (!refines && parentRefines) {
if (stoppedRefining) {
selectDesiredTile(tileset, tile, frameState);
}
} else {
// Load tiles that are not skipped or can't refine further. In practice roughly half the tiles stay unloaded.
// Select tiles that can't refine further. If the tile doesn't have loaded content it will try to select an ancestor with loaded content instead.
if (!refines) { // eslint-disable-line
if (stoppedRefining) { // eslint-disable-line
selectDesiredTile(tileset, tile, frameState);
loadTile(tileset, tile, frameState);
} else if (reachedSkippingThreshold(tileset, tile)) {
Expand Down
20 changes: 20 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,26 @@ defineSuite([
});
});

it('replacement refinement - selects upwards when traversal stops at empty tile', function() {
// No children have content, but all grandchildren have content
//
// C
// E E
// C C C C
//
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement1Url).then(function(tileset) {
tileset.root.geometricError = 90;
viewRootOnly();
scene.camera.zoomIn(20);
scene.renderForSpecs();

var statistics = tileset._statistics;
expect(statistics.selected).toEqual(1);
expect(statistics.visited).toEqual(3);
expect(isSelected(tileset, tileset.root)).toBe(true);
});
});

it('replacement refinement - selects root when sse is not met and subtree is not refinable (1)', function() {
// No children have content, but all grandchildren have content
//
Expand Down

0 comments on commit 0ee1094

Please sign in to comment.