Skip to content

Commit

Permalink
Merge pull request CesiumGS#5869 from AnalyticalGraphicsInc/traversal…
Browse files Browse the repository at this point in the history
…-fix

Fixed 3D Tiles refinement bug when skipLevelOfDetail is false
  • Loading branch information
bagnell authored Oct 2, 2017
2 parents 7cfbf34 + 28981f7 commit 9b05ee6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Change Log
* Fixed a 3D Tiles point cloud bug causing a stray point to appear at the center of the screen on certain hardware. [#5599](https://github.com/AnalyticalGraphicsInc/cesium/issues/5599)
* Fixed removing multiple event listeners within event callbacks. [#5827](https://github.com/AnalyticalGraphicsInc/cesium/issues/5827)
* Running `buildApps` now creates a built version of Sandcastle which uses the built version of Cesium for better performance.
* Fixed a tileset traversal bug when the `skipLevelOfDetail` optimization is off. [#5869](https://github.com/AnalyticalGraphicsInc/cesium/issues/5869)

### 1.37 - 2017-09-01

Expand Down
11 changes: 9 additions & 2 deletions Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ define([
if (!tile.hasTilesetContent) {
if (tile.refine === Cesium3DTileRefine.ADD) {
// Always load additive tiles
loadTile(tileset, tile, this.frameState);
loadTile(tileset, tile, this.frameState, true);
if (hasAdditiveContent(tile)) {
tileset._desiredTiles.push(tile);
}
Expand Down Expand Up @@ -635,9 +635,16 @@ define([
}
}

function checkAdditiveVisibility(tileset, tile, frameState) {
if (defined(tile.parent) && (tile.parent.refine === Cesium3DTileRefine.ADD)) {
return isVisibleAndMeetsSSE(tileset, tile, frameState);
}
return true;
}

function loadTile(tileset, tile, frameState, checkVisibility) {
if ((tile.contentUnloaded || tile.contentExpired) && tile._requestedFrame !== frameState.frameNumber) {
if (!checkVisibility || isVisibleAndMeetsSSE(tileset, tile, frameState)) {
if (!checkVisibility || checkAdditiveVisibility(tileset, tile, frameState)) {
tile._requestedFrame = frameState.frameNumber;
tileset._requestedTiles.push(tile);
}
Expand Down
8 changes: 8 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,14 @@ defineSuite([
});
});

it('does not load additive tiles that are out of view', function() {
viewBottomLeft();
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
var statistics = tileset._statistics;
expect(statistics.numberOfTilesWithContentReady).toEqual(2);
});
});

it('culls with content box', function() {
// Root tile has a content box that is half the extents of its box
// Expect to cull root tile and three child tiles
Expand Down

0 comments on commit 9b05ee6

Please sign in to comment.