3DTilesRendererJS icon indicating copy to clipboard operation
3DTilesRendererJS copied to clipboard

Add callback for when all loading starts and ends

Open gkjohnson opened this issue 1 year ago • 4 comments

Related to #378

Such as tiles.onLoadStart and tiles.onLoadComplete.

This can already be implicitly done by checking the download and parse queue on every frame or in the onLoadModel callback (only can detect on end).

gkjohnson avatar Jul 04 '23 08:07 gkjohnson

Hi Garret, thanks for this great library! Could you give a brief example on how this would be accomplished via onLoadModel? How do I know the total amount of models that are going to be loaded so I can compare it with the current count? Sorry in case this is actually obvious. I just hit my quota rate limit on the google tiles API but wanted to give it a go tomorrow.

arthurschiller avatar Jul 17 '23 22:07 arthurschiller

You can check the amount of models currently in the queue to be parsed or downloaded using downloadQueue.items.size and parseQueue.items.size. onLoadModel is called every time a model has been downloaded and parsed so when those fields are both set to 0 you know it's complete.

What's your use case exactly? If you have a compelling one and would like to open a PR to make this more convenient I can point you in the right direction.

gkjohnson avatar Jul 18 '23 12:07 gkjohnson

Thank you, that works! :) My use case is similar to here: https://github.com/NASA-AMMOS/3DTilesRendererJS/issues/378 I'm building a location based 3D editor and so I'm fetching tiles at a specified location via an Orthographic Camera.

I could certainly try, but I come from iOS development and am not too familiar with typescript.

arthurschiller avatar Jul 18 '23 20:07 arthurschiller

I could certainly try, but I come from iOS development and am not too familiar with typescript.

The project is in Javascript if that changes anything. Either way up to you - also nice to have help. Happy to give feedback if you'd like to try.

gkjohnson avatar Jul 19 '23 00:07 gkjohnson