NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.57k stars 281 forks source link

Can you implement a callback function when all tiles are loaded into the scene? #522

Closed jingyangking closed 5 months ago

jingyangking commented 5 months ago

I want to operate on the entire tiles model, such as adding all tiles models to an array. If only. onloadmodel() is used, Threejs will not wait for all models to be added before operating, so the resulting array is still empty. Therefore, can we implement a callback method that loads all tiles into the scene, so as to directly obtain an array that obtains all tiles models? Thank you very much!

gkjohnson commented 5 months ago

Issue #389 describes the types of callback you're asking for. If you'd like to make a PR for this feature I'm happy to give feedback. PR #440 also added this but it has not been merged.

jingyangking commented 5 months ago

Issue #389 describes the types of callback you're asking for. If you'd like to make a PR for this feature I'm happy to give feedback. PR #440 also added this but it has not been merged.

I made modifications to the source file according to the # 389 code you provided, but the result showed an error

image
gkjohnson commented 5 months ago

I made modifications to the source file according to the # 389 code you provided, but the result showed an error

This looks like a typescript typing issue. You may have to update the type definition files.

jingyangking commented 5 months ago

I made modifications to the source file according to the # 389 code you provided, but the result showed an error

This looks like a typescript typing issue. You may have to update the type definition files.

sorry,i don't know what's your mean.This is my revised content image

gkjohnson commented 5 months ago

You're not providing any context for you're issue. But as I mentioned - it sounds like you're using typescript. In that case you need to modify the typescript definition files (TileRenderer.d.ts) to match the fields, as well, otherwise your build process will complain.

jingyangking commented 5 months ago

You're not providing any context for you're issue. But as I mentioned - it sounds like you're using typescript. In that case you need to modify the typescript definition files () to match the fields, as well, otherwise your build process will complain.TileRenderer.d.ts

Thank you for your reply.Do you mean you need to define a corresponding. js file externally to match the corresponding onloadcomplex() method?

gkjohnson commented 5 months ago

You need to define the new function in the d.ts (typescript declaration) file if your typescript system is complaining. I recommend reading up a bit more on Typescript Declaration files if you're not familiar with them.

jingyangking commented 5 months ago

You need to define the new function in the d.ts (typescript declaration) file if your typescript system is complaining. I recommend reading up a bit more on Typescript Declaration files if you're not familiar with them.

Thank you for your reply. I think I know what to do now