Skip to content
Closed
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
24 changes: 24 additions & 0 deletions src/core/renderer/tiles/TilesRendererBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,18 @@ export class TilesRendererBase {
// remove any tiles that are loading but no longer used
this.removeUnusedPendingTiles();

const plugins = this.plugins;
for ( let i = 0, l = plugins.length; i < l; i ++ ) {

const plugin = plugins[ i ];
if ( plugin.pruneUnusedSubtrees ) {

plugin.pruneUnusedSubtrees();

}

}

// TODO: This will only sort for one tileset. We may want to store this queue on the
// LRUCache so multiple tilesets can use it at once
// start the downloads of the tiles as needed
Expand Down Expand Up @@ -1347,6 +1359,18 @@ export class TilesRendererBase {

ensureChildrenArePreprocessed( tile, forceImmediate = this.stats.tilesProcessed < this.maxTilesProcessed ) {

const plugins = this.plugins;
for ( let i = 0, l = plugins.length; i < l; i ++ ) {

const plugin = plugins[ i ];
if ( plugin.ensureChildrenAreExpanded ) {

plugin.ensureChildrenAreExpanded( tile );

}

}

const children = tile.children;
if ( children.length === 0 || children[ children.length - 1 ].traversal ) {

Expand Down
4 changes: 2 additions & 2 deletions src/core/renderer/tiles/optimizedTraverseFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ function canUnconditionallyRefine( tile ) {
// Resets the frame information for the given tile
function resetFrameState( tile, renderer ) {

renderer.ensureChildrenArePreprocessed( tile );

if ( tile.traversal.lastFrameVisited !== renderer.frameCount ) {

tile.traversal.lastFrameVisited = renderer.frameCount;
Expand Down Expand Up @@ -164,6 +162,8 @@ function canTraverse( tile, renderer ) {

}

renderer.ensureChildrenArePreprocessed( tile );

// Early out if the children haven't been processed, yet
if ( ! areChildrenProcessed( tile ) ) {

Expand Down
19 changes: 10 additions & 9 deletions src/core/renderer/tiles/traverseFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ function resetFrameState( tile, renderer ) {
// Recursively mark tiles used down to the next layer, skipping external tilesets
function recursivelyMarkUsed( tile, renderer, cacheOnly = false ) {

renderer.ensureChildrenArePreprocessed( tile );

resetFrameState( tile, renderer );
markUsed( tile, renderer, cacheOnly );

// don't traverse if the children have not been processed, yet but tileset content
// should be considered to be "replaced" by the loaded children so await that here.
if ( canUnconditionallyRefine( tile ) && areChildrenProcessed( tile ) ) {
if ( canUnconditionallyRefine( tile ) ) {

renderer.ensureChildrenArePreprocessed( tile );
if ( ! areChildrenProcessed( tile ) ) {

return;

}

const children = tile.children;
for ( let i = 0, l = children.length; i < l; i ++ ) {
Expand All @@ -95,8 +100,6 @@ function recursivelyMarkUsed( tile, renderer, cacheOnly = false ) {
// Recursively traverses to the next tiles with unloaded renderable content to load them
function recursivelyLoadNextRenderableTiles( tile, renderer ) {

renderer.ensureChildrenArePreprocessed( tile );

// exit the recursion if the tile hasn't been used this frame
if ( isUsedThisFrame( tile, renderer.frameCount ) ) {

Expand Down Expand Up @@ -167,6 +170,8 @@ function canTraverse( tile, renderer ) {

}

renderer.ensureChildrenArePreprocessed( tile );

// Early out if the children haven't been processed, yet
if ( ! areChildrenProcessed( tile ) ) {

Expand All @@ -181,10 +186,6 @@ function canTraverse( tile, renderer ) {
// Determine which tiles are used by the renderer given the current camera configuration
function markUsedTiles( tile, renderer ) {

// determine frustum set is run first so we can ensure the preprocessing of all the necessary
// child tiles has happened here.
renderer.ensureChildrenArePreprocessed( tile );

resetFrameState( tile, renderer );

if ( ! tile.traversal.inFrustum ) {
Expand Down
Loading
Loading