Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Jul 28, 2018
1 parent e95a9a2 commit 8d85e60
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
27 changes: 21 additions & 6 deletions Source/Scene/Cesium3DTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ define([
this.hasTilesetContent = false;

/**
* The corresponding node in the cache.
* The node in the tileset's LRU cache, used to determine when to unload a tile's content.
*
* See {@link Cesium3DTilesetCache}
*
Expand Down Expand Up @@ -465,7 +465,7 @@ define([
*/
contentAvailable : {
get : function() {
return (this.contentReady && this.hasRenderableContent) || (defined(this._expiredContent) && this._contentState !== Cesium3DTileContentState.FAILED);
return (this.contentReady && this.hasRenderableContent) || (defined(this._expiredContent) && !this.contentFailed);
}
},

Expand Down Expand Up @@ -520,6 +520,23 @@ define([
}
},

/**
* Determines if the tile's content failed to load. <code>true</code> if the tile's
* content failed to load; otherwise, <code>false</code>.
*
* @memberof Cesium3DTile.prototype
*
* @type {Boolean}
* @readonly
*
* @private
*/
contentFailed : {
get : function() {
return this._contentState === Cesium3DTileContentState.FAILED;
}
},

/**
* Gets the promise that will be resolved when the tile's content is ready to process.
* This happens after the content is downloaded but before the content is ready
Expand Down Expand Up @@ -1035,12 +1052,10 @@ define([
var color;
if (!tile._finalResolution) {
color = Color.YELLOW;
} else if (hasContentBoundingVolume) {
color = Color.WHITE;
} else if (empty) {
color = Color.GREEN;
color = Color.DARKGRAY;
} else {
color = Color.RED;
color = Color.WHITE;
}
if (!defined(tile._debugBoundingVolume)) {
tile._debugBoundingVolume = tile._boundingVolume.createDebugVolume(color);
Expand Down
20 changes: 9 additions & 11 deletions Source/Scene/Cesium3DTilesetTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ define([
return;
}

// The SSE of not rendering the tree is small enough that the tree does not need to be rendered
// The tileset doesn't meet the SSE requirement, therefore the tree does not need to be rendered
if (getScreenSpaceError(tileset, tileset._geometricError, root, frameState) <= tileset._maximumScreenSpaceError) {
return;
}
Expand Down Expand Up @@ -213,17 +213,14 @@ define([
// Replacement tiles are prioritized by screen space error.
// A tileset that has both additive and replacement tiles may not prioritize tiles as effectively since SSE and distance
// are different types of values. Maybe all priorities need to be normalized to 0-1 range.
var parent = tile.parent;
var replace = tile.refine === Cesium3DTileRefine.REPLACE;
var add = tile.refine === Cesium3DTileRefine.ADD;
if (add) {
if (tile.refine === Cesium3DTileRefine.ADD) {
return tile._distanceToCamera;
} else if (replace) {
var useParentScreenSpaceError = defined(parent) && (!skipLevelOfDetail(tileset) || (tile._screenSpaceError === 0.0));
var screenSpaceError = useParentScreenSpaceError ? parent._screenSpaceError : tile._screenSpaceError;
var rootScreenSpaceError = tileset._root._screenSpaceError;
return rootScreenSpaceError - screenSpaceError; // Map higher SSE to lower values (e.g. root tile is highest priority)
}
var parent = tile.parent;
var useParentScreenSpaceError = defined(parent) && (!skipLevelOfDetail(tileset) || (tile._screenSpaceError === 0.0));
var screenSpaceError = useParentScreenSpaceError ? parent._screenSpaceError : tile._screenSpaceError;
var rootScreenSpaceError = tileset._root._screenSpaceError;
return rootScreenSpaceError - screenSpaceError; // Map higher SSE to lower values (e.g. root tile is highest priority)
}

function loadTile(tileset, tile, frameState) {
Expand Down Expand Up @@ -478,6 +475,7 @@ define([

if (hasEmptyContent(tile)) {
// Add empty tile just to show its debug bounding volume
// If the tile has tileset content load the external tileset
addEmptyTile(tileset, tile, frameState);
loadTile(tileset, tile, frameState);
} else if (add) {
Expand Down Expand Up @@ -554,7 +552,7 @@ define([

/**
* Traverse the tree and check if their selected frame is the current frame. If so, add it to a selection queue.
* Furthermore, this is a preorder traversal so children tiles are selected before ancestor tiles.
* This is a preorder traversal so children tiles are selected before ancestor tiles.
*
* The reason for the preorder traversal is so that tiles can easily be marked with their
* selection depth. A tile's _selectionDepth is its depth in the tree where all non-selected tiles are removed.
Expand Down

0 comments on commit 8d85e60

Please sign in to comment.