Skip to content

Commit

Permalink
Merge pull request #7289 from AnalyticalGraphicsInc/fix-visibility-check
Browse files Browse the repository at this point in the history
Improve visibility check in tileset traversal
  • Loading branch information
ggetz authored Dec 17, 2018
2 parents 7f142a9 + 6520c14 commit 2de1fe2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

### 1.53 - 2019-01-02

##### Fixes :wrench:
* Fixed 3D Tiles visibility checking when running multiple passes within the same frame. [#7289](https://github.com/AnalyticalGraphicsInc/cesium/pull/7289)

### 1.52 - 2018-12-03

##### Breaking Changes :mega:
Expand Down
3 changes: 3 additions & 0 deletions Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ define([
this._selectedTilesToStyle = [];
this._loadTimestamp = undefined;
this._timeSinceLoad = 0.0;
this._updatedVisibilityFrame = 0;
this._extras = undefined;

this._cullWithChildrenBounds = defaultValue(options.cullWithChildrenBounds, true);
Expand Down Expand Up @@ -1944,6 +1945,8 @@ define([
tileset._cache.reset();
}

++tileset._updatedVisibilityFrame;

var ready;

if (isAsync) {
Expand Down
5 changes: 2 additions & 3 deletions Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ define([
}

function updateVisibility(tileset, tile, frameState) {
if (tile._updatedVisibilityFrame === frameState.frameNumber) {
if (tile._updatedVisibilityFrame === tileset._updatedVisibilityFrame) {
// Return early if visibility has already been checked during the traversal.
// The visibility may have already been checked if the cullWithChildrenBounds optimization is used.
return;
}

tile.updateVisibility(frameState);
tile._updatedVisibilityFrame = frameState.frameNumber;
tile._updatedVisibilityFrame = tileset._updatedVisibilityFrame;
}

function anyChildrenVisible(tileset, tile, frameState) {
Expand Down Expand Up @@ -470,7 +470,6 @@ define([
visitTile(tileset, tile, frameState);
touchTile(tileset, tile, frameState);
tile._refines = refines;
tile._updatedVisibilityFrame = 0; // Reset so visibility is checked during the next pass which may use a different camera
}
}

Expand Down

0 comments on commit 2de1fe2

Please sign in to comment.