Skip to content

Commit

Permalink
Fix #910
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Jan 10, 2025
1 parent 0a17844 commit 81d75b4
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/three/TilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,6 @@ export class TilesRenderer extends TilesRendererBase {

} );

// exit early if a new request has already started
if ( abortSignal.aborted ) {

return;

}

// ensure the matrix is up to date in case the scene has a transform applied
scene.updateMatrix();
scene.matrix.premultiply( cachedTransform );
Expand All @@ -725,6 +718,7 @@ export class TilesRenderer extends TilesRendererBase {
} );
updateFrustumCulled( scene, ! this.autoDisableRendererCulling );

// collect all original geometries, materials, etc to be disposed of later
const materials = [];
const geometry = [];
const textures = [];
Expand Down Expand Up @@ -756,6 +750,30 @@ export class TilesRenderer extends TilesRendererBase {

} );

// exit early if a new request has already started
if ( abortSignal.aborted ) {

// dispose of any image bitmaps that have been opened.
// TODO: share this code with the "disposeTile" code below, possibly allow for the tiles
// renderer base to trigger a disposal of unneeded data
for ( let i = 0, l = textures.length; i < l; i ++ ) {

const texture = textures[ i ];

if ( texture.image instanceof ImageBitmap ) {

texture.image.close();

}

texture.dispose();

}

return;

}

cached.materials = materials;
cached.geometry = geometry;
cached.textures = textures;
Expand Down

0 comments on commit 81d75b4

Please sign in to comment.