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

Improve visibility check in tileset traversal #7289

Merged
merged 2 commits into from
Dec 17, 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
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