diff --git a/src/three/plugins/images/ImageFormatPlugin.js b/src/three/plugins/images/ImageFormatPlugin.js index 2f24669be..0b6308f88 100644 --- a/src/three/plugins/images/ImageFormatPlugin.js +++ b/src/three/plugins/images/ImageFormatPlugin.js @@ -142,22 +142,16 @@ export class ImageFormatPlugin { } - return mesh; - - } - - preprocessNode( tile ) { - - // generate children - const { tiling } = this; - const maxLevel = tiling.maxLevel; - const level = tile[ TILE_LEVEL ]; - if ( level < maxLevel && tile.parent !== null ) { + // Only expose descendants while the tile content is resident so unload can clear the + // branch and a later reload will recreate it symmetrically. + if ( level < tiling.maxLevel && tile.children.length === 0 ) { this.expandChildren( tile ); } + return mesh; + } disposeTile( tile ) { @@ -173,6 +167,14 @@ export class ImageFormatPlugin { } + + tile.children.forEach( child => { + + this.tiles.processNodeQueue.remove( child ); + + } ); + tile.children.length = 0; + } // Local functions