-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added onLoadStart & onLoadComplete callbacks #440
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -675,6 +676,29 @@ export class TilesRenderer extends TilesRendererBase { | |
cached.scene = scene; | ||
cached.metadata = metadata; | ||
|
||
if ( ! this.loading && this.parseQueue.items.length > 0 ) { | ||
|
||
if ( this.onLoadStart ) { | ||
|
||
this.onLoadStart( ); | ||
|
||
} | ||
this.loading = true; | ||
|
||
} | ||
Comment on lines
+679
to
+688
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It occurs to me that this will not trigger if we're in a case where only one tile has downloaded - because this condition will be checked only once a file has been fully parsed. Perhaps this "onStart" condition should go at the end of the update function, instead? |
||
|
||
if ( this.loading && this.parseQueue.items.length === 0 && this.downloadQueue.items.length === this.parseQueue.items.length ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not check if |
||
|
||
if ( this.onLoadComplete ) { | ||
|
||
this.onLoadComplete( ); | ||
this.loading = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
} | ||
|
||
} | ||
|
||
|
||
if ( this.onLoadModel ) { | ||
|
||
this.onLoadModel( scene, tile ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should check
this.parseQueue.items.length > 0 || this.downloadQueue.items.length > 0