Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tile refinement when leaf is empty #8996

Merged
merged 5 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### 1.72 - 2020-08-03

##### Fixes :wrench:

- Fixed 3D Tileset replacement refinement when leaf is empty. [#8996](https://github.com/CesiumGS/cesium/8996)

### 1.71 - 2020-07-01

##### Breaking Changes :mega:
Expand Down
13 changes: 8 additions & 5 deletions Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,14 @@ function executeEmptyTraversal(tileset, root, frameState) {
var childrenLength = children.length;

// Only traverse if the tile is empty - traversal stop at descendants with content
var traverse = hasEmptyContent(tile) && canTraverse(tileset, tile);

// Traversal stops but the tile does not have content yet.
// There will be holes if the parent tries to refine to its children, so don't refine.
if (!traverse && !tile.contentAvailable) {
var emptyContent = hasEmptyContent(tile);
var traverse = emptyContent && canTraverse(tileset, tile);
var emptyLeaf = emptyContent && tile.children.length === 0;

// Traversal stops but the tile does not have content yet
// There will be holes if the parent tries to refine to its children, so don't refine
// One exception: a parent may refine even if one of its descendants is an empty leaf
if (!traverse && !tile.contentAvailable && !emptyLeaf) {
allDescendantsLoaded = false;
}

Expand Down
26 changes: 26 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,32 @@ describe(
});
});

it("replacement refinement - refines if descendant is empty leaf tile", function () {
// Check that the root is refinable once its children with content are loaded
//
// C
// C C C E
//
viewAllTiles();
var originalLoadJson = Cesium3DTileset.loadJson;
spyOn(Cesium3DTileset, "loadJson").and.callFake(function (tilesetUrl) {
return originalLoadJson(tilesetUrl).then(function (tilesetJson) {
tilesetJson.root.refine = "REPLACE";
tilesetJson.root.children[3].content = undefined;
return tilesetJson;
});
});

return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function (
tileset
) {
tileset.skipLevelOfDetail = false;
var statistics = tileset._statistics;
scene.renderForSpecs();
expect(statistics.numberOfCommands).toEqual(3);
});
});

it("replacement and additive refinement", function () {
// A
// A R (not rendered)
Expand Down