-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
3D Tiles Traversal cleanup #6390
Changes from 58 commits
d683e4d
366a1d2
3f09e0c
15700e4
7500d7d
b285439
b44933d
b975f1e
5a36e0b
66f977d
e0a2a86
dbdd7ef
2894551
b9219db
5e7e764
63ad7c3
c804dd3
a6aad57
4bbacf8
248c443
db216c1
1f51e9b
978f9f6
582a51f
49c005b
4509017
7d21281
ca07240
fae93f7
72ec719
e558f2f
0cb8dcd
6d29c37
5c97c9b
15921c2
bc9c55a
ee36a46
059d2b0
7254492
9046570
593826f
8e58835
57627f4
ac0cf76
3f6714b
fc65396
5e57ca2
5856714
6bda10e
79e77c7
716c6a4
a0d5c5c
6a8fcfa
2705996
c8c981e
1dd5e68
8df3ddb
6e84390
e95a9a2
8d85e60
4fc6f7e
6991103
30c0459
b527503
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ define([ | |
'../Core/BoundingSphere', | ||
'../Core/Cartesian3', | ||
'../Core/Color', | ||
'../Core/ColorGeometryInstanceAttribute', | ||
'../Core/CullingVolume', | ||
'../Core/defaultValue', | ||
'../Core/defined', | ||
|
@@ -21,7 +22,6 @@ define([ | |
'../Core/Resource', | ||
'../Core/RuntimeError', | ||
'../ThirdParty/when', | ||
'./Cesium3DTileChildrenVisibility', | ||
'./Cesium3DTileContentFactory', | ||
'./Cesium3DTileContentState', | ||
'./Cesium3DTileOptimizationHint', | ||
|
@@ -35,6 +35,7 @@ define([ | |
BoundingSphere, | ||
Cartesian3, | ||
Color, | ||
ColorGeometryInstanceAttribute, | ||
CullingVolume, | ||
defaultValue, | ||
defined, | ||
|
@@ -54,7 +55,6 @@ define([ | |
Resource, | ||
RuntimeError, | ||
when, | ||
Cesium3DTileChildrenVisibility, | ||
Cesium3DTileContentFactory, | ||
Cesium3DTileContentState, | ||
Cesium3DTileOptimizationHint, | ||
|
@@ -253,14 +253,16 @@ define([ | |
this.hasTilesetContent = false; | ||
|
||
/** | ||
* The corresponding node in the cache replacement list. | ||
* The corresponding node in the cache. | ||
* | ||
* See {@link Cesium3DTilesetCache} | ||
* | ||
* @type {DoublyLinkedListNode} | ||
* @readonly | ||
* | ||
* @private | ||
*/ | ||
this.replacementNode = undefined; | ||
this.cacheNode = undefined; | ||
|
||
var expire = header.expire; | ||
var expireDuration; | ||
|
@@ -286,15 +288,6 @@ define([ | |
*/ | ||
this.expireDate = expireDate; | ||
|
||
/** | ||
* Marks if the tile is selected this frame. | ||
* | ||
* @type {Boolean} | ||
* | ||
* @private | ||
*/ | ||
this.selected = false; | ||
|
||
/** | ||
* The time when a style was last applied to this tile. | ||
* | ||
|
@@ -325,22 +318,27 @@ define([ | |
|
||
// Members that are updated every frame for tree traversal and rendering optimizations: | ||
this._distanceToCamera = 0; | ||
this._visibilityPlaneMask = 0; | ||
this._childrenVisibility = Cesium3DTileChildrenVisibility.VISIBLE; | ||
this._lastSelectedFrameNumber = -1; | ||
this._centerZDepth = 0; | ||
this._screenSpaceError = 0; | ||
this._screenSpaceErrorComputedFrame = -1; | ||
this._visibilityPlaneMask = 0; | ||
this._visible = false; | ||
this._inRequestVolume = false; | ||
|
||
this._finalResolution = true; | ||
this._depth = 0; | ||
this._centerZDepth = 0; | ||
this._stackLength = 0; | ||
this._selectedFrame = -1; | ||
this._selectionDepth = 0; | ||
this._lastSelectionDepth = undefined; | ||
this._requestedFrame = undefined; | ||
this._lastVisitedFrame = undefined; | ||
|
||
this._updatedVisibilityFrame = 0; | ||
this._touchedFrame = 0; | ||
this._visitedFrame = 0; | ||
this._selectedFrame = 0; | ||
this._requestedFrame = 0; | ||
this._ancestorWithContent = undefined; | ||
this._ancestorWithLoadedContent = undefined; | ||
this._ancestorWithContentAvailable = undefined; | ||
this._refines = false; | ||
this._shouldSelect = false; | ||
this._priority = 0.0; | ||
this._isClipped = true; | ||
this._clippingPlanesState = 0; // encapsulates (_isClipped, clippingPlanes.enabled) and number/function | ||
|
||
|
@@ -458,13 +456,13 @@ define([ | |
*/ | ||
contentAvailable : { | ||
get : function() { | ||
return this.contentReady || (defined(this._expiredContent) && this._contentState !== Cesium3DTileContentState.FAILED); | ||
return (this.contentReady && this.hasRenderableContent) || (defined(this._expiredContent) && this._contentState !== Cesium3DTileContentState.FAILED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, it seems like there is a mix of setting variables like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this was confusing, I removed |
||
} | ||
}, | ||
|
||
/** | ||
* Determines if the tile is ready to render. <code>true</code> if the tile | ||
* is ready to render; otherwise, <code>false</code>. | ||
* Determines if the tile's content is ready. This is automatically <code>true</code> for | ||
* tile's with empty content. | ||
* | ||
* @memberof Cesium3DTile.prototype | ||
* | ||
|
@@ -609,7 +607,7 @@ define([ | |
|
||
function createPriorityFunction(tile) { | ||
return function() { | ||
return tile._distanceToCamera; | ||
return tile._priority; | ||
}; | ||
} | ||
|
||
|
@@ -701,7 +699,7 @@ define([ | |
updateExpireDate(that); | ||
|
||
// Refresh style for expired content | ||
that.lastStyleTime = 0; | ||
that._selectedFrame = 0; | ||
|
||
that._contentState = Cesium3DTileContentState.READY; | ||
that._contentReadyPromise.resolve(content); | ||
|
@@ -735,8 +733,6 @@ define([ | |
this._contentReadyToProcessPromise = undefined; | ||
this._contentReadyPromise = undefined; | ||
|
||
this.replacementNode = undefined; | ||
|
||
this.lastStyleTime = 0; | ||
this.clippingPlanesDirty = (this._clippingPlanesState === 0); | ||
this._clippingPlanesState = 0; | ||
|
@@ -850,7 +846,7 @@ define([ | |
* Computes the distance from the center of the tile's bounding volume to the camera. | ||
* | ||
* @param {FrameState} frameState The frame state. | ||
* @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume. | ||
* @returns {Number} The distance, in meters. | ||
* | ||
* @private | ||
*/ | ||
|
@@ -994,14 +990,26 @@ define([ | |
|
||
function applyDebugSettings(tile, tileset, frameState) { | ||
var hasContentBoundingVolume = defined(tile._header.content) && defined(tile._header.content.boundingVolume); | ||
var empty = tile.hasEmptyContent || tile.hasTilesetContent; | ||
|
||
var showVolume = tileset.debugShowBoundingVolume || (tileset.debugShowContentBoundingVolume && !hasContentBoundingVolume); | ||
if (showVolume) { | ||
var color; | ||
if (!tile._finalResolution) { | ||
color = Color.YELLOW; | ||
} else if (hasContentBoundingVolume) { | ||
color = Color.WHITE; | ||
} else if (empty) { | ||
color = Color.GREEN; | ||
} else { | ||
color = Color.RED; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little picky, but since red usually means "bad" and green usually mean "good" or "go", I would mark the colors something like so:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ended up going with:
I like |
||
if (!defined(tile._debugBoundingVolume)) { | ||
var color = tile._finalResolution ? (hasContentBoundingVolume ? Color.WHITE : Color.RED) : Color.YELLOW; | ||
tile._debugBoundingVolume = tile._boundingVolume.createDebugVolume(color); | ||
} | ||
tile._debugBoundingVolume.update(frameState); | ||
var attributes = tile._debugBoundingVolume.getGeometryInstanceAttributes('outline'); | ||
attributes.color = ColorGeometryInstanceAttribute.toValue(color, attributes.color); | ||
} else if (!showVolume && defined(tile._debugBoundingVolume)) { | ||
tile._debugBoundingVolume = tile._debugBoundingVolume.destroy(); | ||
} | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would briefly mention what the cache is used for here.