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

Tileset mixed refinement fix #7099

Merged
merged 4 commits into from
Oct 1, 2018
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Change Log

##### Fixes :wrench:
* Fixed picking for overlapping translucent primitives. [#7039](https://github.com/AnalyticalGraphicsInc/cesium/pull/7039)
* Fixed an issue in the 3D Tiles traversal where tilesets would render with mixed level of detail if an external tileset was visible but its root tile was not. [#7099](https://github.com/AnalyticalGraphicsInc/cesium/pull/7099)
* 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)
* Fixed an issue where scaling near zero with an model animation could cause rendering to stop. [#6954](https://github.com/AnalyticalGraphicsInc/cesium/pull/6954)
Expand Down
12 changes: 11 additions & 1 deletion Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,17 @@ define([
return;
}

var hasChildren = tile.children.length > 0;
if (tile.hasTilesetContent && hasChildren) {
// Use the root tile's visibility instead of this tile's visibility.
// The root tile may be culled by the children bounds optimization in which
// case this tile should also be culled.
var child = tile.children[0];
updateTileVisibility(tileset, child, frameState);
tile._visible = child._visible;
return;
}

if (meetsScreenSpaceErrorEarly(tileset, tile, frameState)) {
tile._visible = false;
return;
Expand All @@ -324,7 +335,6 @@ define([
// Optimization - if none of the tile's children are visible then this tile isn't visible
var replace = tile.refine === Cesium3DTileRefine.REPLACE;
var useOptimization = tile._optimChildrenWithinParent === Cesium3DTileOptimizationHint.USE_OPTIMIZATION;
var hasChildren = tile.children.length > 0;
if (replace && useOptimization && hasChildren) {
if (!anyChildrenVisible(tileset, tile, frameState)) {
++tileset._statistics.numberOfTilesCulledWithChildrenUnion;
Expand Down
17 changes: 17 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,23 @@ defineSuite([
});
});

it('does not select external tileset whose root has invisible children', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) {
var center = Cartesian3.fromRadians(centerLongitude, centerLatitude, 50.0);
scene.camera.lookAt(center, new HeadingPitchRange(0.0, 1.57, 1.0));
var root = tileset.root;
var externalRoot = root.children[0];
externalRoot.refine = Cesium3DTileRefine.REPLACE;
scene.renderForSpecs();

expect(isSelected(tileset, root)).toBe(false);
expect(isSelected(tileset, externalRoot)).toBe(false);
expect(root._visible).toBe(false);
expect(externalRoot._visible).toBe(false);
expect(tileset.statistics.numberOfTilesCulledWithChildrenUnion).toBe(1);
});
});

it('does not select visible tiles not meeting SSE with visible children', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacementWithViewerRequestVolumeUrl).then(function(tileset) {
var root = tileset.root;
Expand Down