-
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
External tileset traversal fix #7035
Changes from 2 commits
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 |
---|---|---|
|
@@ -215,7 +215,7 @@ define([ | |
return tile._distanceToCamera; | ||
} | ||
var parent = tile.parent; | ||
var useParentScreenSpaceError = defined(parent) && (!skipLevelOfDetail(tileset) || (tile._screenSpaceError === 0.0)); | ||
var useParentScreenSpaceError = defined(parent) && (!skipLevelOfDetail(tileset) || (tile._screenSpaceError === 0.0) || parent.hasTilesetContent); | ||
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) | ||
|
@@ -307,7 +307,7 @@ define([ | |
|
||
// Use parent's geometric error with child's box to see if the tile already meet the SSE | ||
var parent = tile.parent; | ||
if (defined(parent) && (parent.refine === Cesium3DTileRefine.ADD) && getScreenSpaceError(tileset, parent.geometricError, tile, frameState) <= tileset._maximumScreenSpaceError) { | ||
if (defined(parent) && !parent.hasTilesetContent && (parent.refine === Cesium3DTileRefine.ADD) && getScreenSpaceError(tileset, parent.geometricError, tile, frameState) <= tileset._maximumScreenSpaceError) { | ||
tile._visible = false; | ||
return; | ||
} | ||
|
@@ -438,6 +438,18 @@ define([ | |
return tile._screenSpaceError > baseScreenSpaceError; | ||
} | ||
|
||
function canTraverse(tileset, tile) { | ||
if (tile.children.length === 0) { | ||
return false; | ||
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. So the consensus from #7007 is not to throw a warning, correct? It seems like it would be fairly trivial to include here with a one-time warning. 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. Yeah I think we should wait and see if it comes up again. But agreed it should be easy to add if we decide to. |
||
} | ||
if (tile.hasTilesetContent) { | ||
// Traverse external tileset to visit its root tile | ||
// Don't traverse if the subtree is expired because it will be destroyed | ||
return !tile.contentExpired; | ||
} | ||
return tile._screenSpaceError > tileset._maximumScreenSpaceError; | ||
} | ||
|
||
function executeTraversal(tileset, root, baseScreenSpaceError, maximumScreenSpaceError, frameState) { | ||
// Depth-first traversal that traverses all visible tiles and marks tiles for selection. | ||
// If skipLevelOfDetail is off then a tile does not refine until all children are loaded. | ||
|
@@ -455,19 +467,11 @@ define([ | |
var baseTraversal = inBaseTraversal(tileset, tile, baseScreenSpaceError); | ||
var add = tile.refine === Cesium3DTileRefine.ADD; | ||
var replace = tile.refine === Cesium3DTileRefine.REPLACE; | ||
var children = tile.children; | ||
var childrenLength = children.length; | ||
var parent = tile.parent; | ||
var parentRefines = !defined(parent) || parent._refines; | ||
var traverse = (childrenLength > 0) && (tile._screenSpaceError > maximumScreenSpaceError); | ||
var refines = false; | ||
|
||
if (tile.hasTilesetContent && tile.contentExpired) { | ||
// Don't traverse expired subtree because it will be destroyed | ||
traverse = false; | ||
} | ||
|
||
if (traverse) { | ||
if (canTraverse(tileset, tile)) { | ||
refines = updateAndPushChildren(tileset, tile, stack, frameState) && parentRefines; | ||
} | ||
|
||
|
@@ -514,7 +518,6 @@ define([ | |
function executeEmptyTraversal(tileset, root, frameState) { | ||
// Depth-first traversal that checks if all nearest descendants with content are loaded. Ignores visibility. | ||
var allDescendantsLoaded = true; | ||
var maximumScreenSpaceError = tileset._maximumScreenSpaceError; | ||
var stack = emptyTraversal.stack; | ||
stack.push(root); | ||
|
||
|
@@ -526,7 +529,7 @@ define([ | |
var childrenLength = children.length; | ||
|
||
// Only traverse if the tile is empty - traversal stop at descendants with content | ||
var traverse = hasEmptyContent(tile) && (childrenLength > 0) && (tile._screenSpaceError > maximumScreenSpaceError); | ||
var traverse = hasEmptyContent(tile) && canTraverse(tileset, tile); | ||
|
||
// Traversal stops but the tile does not have content yet. | ||
// There will be holes if the parent tries to refine to its children, so don't refine. | ||
|
@@ -573,7 +576,6 @@ define([ | |
* selected tiles must be no deeper than 15. This is still very unlikely. | ||
*/ | ||
function traverseAndSelect(tileset, root, frameState) { | ||
var maximumScreenSpaceError = tileset._maximumScreenSpaceError; | ||
var stack = selectionTraversal.stack; | ||
var ancestorStack = selectionTraversal.ancestorStack; | ||
var lastAncestor; | ||
|
@@ -606,7 +608,7 @@ define([ | |
var shouldSelect = tile._shouldSelect; | ||
var children = tile.children; | ||
var childrenLength = children.length; | ||
var traverse = (childrenLength > 0) && (tile._screenSpaceError > maximumScreenSpaceError); | ||
var traverse = canTraverse(tileset, tile); | ||
|
||
if (shouldSelect) { | ||
if (add) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
20 | ||
] | ||
}, | ||
"geometricError": 70, | ||
"geometricError": 0, | ||
"content": { | ||
"uri": "tileset3/tileset3.json" | ||
} | ||
|
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.
This line is getting a bit unwieldy. Can we account for this in
updateVisibility
? Or if not just pull outgetScreenSpaceError(tileset, parent.geometricError, tile, frameState)
or
getScreenSpaceError(tileset, parent.geometricError, tile, frameState) <= tileset._maximumScreenSpaceError
into its own var?
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.
Moved to its own function.
Unfortunately it can't be handled in
updateVisibility
because it shouldn't get run when checking children visibility for the cull-with-children-bounds optimization.