Skip to content

Commit

Permalink
Added onLoadStart and onLoadComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
pizza3 committed Jan 6, 2024
1 parent 60e0b99 commit 72e62bb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/three/TilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class TilesRenderer extends TilesRendererBase {
this.visibleTiles = new Set();
this._autoDisableRendererCulling = true;
this.optimizeRaycast = true;
this.loading = false;

this.onLoadTileSet = null;
this.onLoadModel = null;
Expand Down Expand Up @@ -675,6 +676,29 @@ export class TilesRenderer extends TilesRendererBase {
cached.scene = scene;
cached.metadata = metadata;

if ( ! this.loading ) {

if ( this.onLoadStart ) {

this.onLoadStart( );

}
this.loading = true;

}

if ( this.parseQueue.items.length === 0 && this.downloadQueue.items.length === this.parseQueue.items.length ) {

if ( this.onLoadComplete ) {

this.onLoadComplete( );
this.loading = false;

}

}


if ( this.onLoadModel ) {

this.onLoadModel( scene, tile );
Expand Down

0 comments on commit 72e62bb

Please sign in to comment.