diff --git a/src/plugins/three/UnloadTilesPlugin.js b/src/plugins/three/UnloadTilesPlugin.js index 3060a5a34..7aedff7e4 100644 --- a/src/plugins/three/UnloadTilesPlugin.js +++ b/src/plugins/three/UnloadTilesPlugin.js @@ -98,6 +98,7 @@ export class UnloadTilesPlugin { lruCache.add( tile, unloadCallback ); lruCache.markUsed( tile ); + tiles.usedSet.add( tile ); deferCallbacks.cancel( tile ); } else { diff --git a/src/plugins/three/fade/TilesFadePlugin.js b/src/plugins/three/fade/TilesFadePlugin.js index 05863bef7..4c6458e9d 100644 --- a/src/plugins/three/fade/TilesFadePlugin.js +++ b/src/plugins/three/fade/TilesFadePlugin.js @@ -127,6 +127,7 @@ function onUpdateAfter() { const scene = tile.cached.scene; const isFadingOut = fadeManager.isFadingOut( tile ); lruCache.markUsed( tile ); + tiles.usedSet.add( tile ); if ( scene ) { fadeMaterialManager.setFade( scene, fadeIn, fadeOut ); diff --git a/src/utilities/LRUCache.js b/src/utilities/LRUCache.js index 8a77de0ae..6a60ddd5b 100644 --- a/src/utilities/LRUCache.js +++ b/src/utilities/LRUCache.js @@ -49,7 +49,6 @@ class LRUCache { this.itemList = []; this.usedSet = new Set(); this.callbacks = new Map(); - this.markUnusedQueued = false; this.unloadingHandle = - 1; this.cachedBytes = 0; this.bytesMap = new Map(); @@ -78,12 +77,6 @@ class LRUCache { add( item, removeCb ) { - if ( this.markUnusedQueued ) { - - this.markAllUnused(); - - } - const itemSet = this.itemSet; if ( itemSet.has( item ) ) { @@ -194,12 +187,6 @@ class LRUCache { markUsed( item ) { - if ( this.markUnusedQueued ) { - - this.markAllUnused(); - - } - const itemSet = this.itemSet; const usedSet = this.usedSet; if ( itemSet.has( item ) && ! usedSet.has( item ) ) { @@ -220,7 +207,6 @@ class LRUCache { markAllUnused() { this.usedSet.clear(); - this.markUnusedQueued = false; if ( this.unloadingHandle !== - 1 ) { cancelAnimationFrame( this.unloadingHandle ); @@ -386,12 +372,6 @@ class LRUCache { this.scheduled = false; this.unloadUnusedContent(); - if ( this.autoMarkUnused ) { - - this.markUnusedQueued = true; - - } - } ); }