I am using the AssetManager to load texture files I apply manually, but I am also using it to load my main scene file which is a gltf that loads a bin file. Those files then have their own textures baked in and I would like to use the AssetManager to load them or at least “wait” for all the assets to load. Because if I don’t the scene pops in when its done loading the GLTF but the textures aren’t downloaded yet so things come in piecemeal.
Is there a best practice to use the Asset Manager or some other bit of code that will allow me to “wait” until the scene and all embedded textures are done loading?
Why not just export as GLB and textures are contained directly within the binary - AssetsManager won’t finish until meshes and their initial textures have fully loaded?
Thought of that, but that brings in some downsides. That means I can’t just update a single texture, but instead have to republish the entire GLB, some of those textures are shared across scenes (multiple GLB files), having the textures outside we can take advantage web friendly JPEG compression / rendering pipelines, and also if they are in the GLB we can’t take advantage that a browser will download multiple files simultaneously in parallel from our CDN. Some I am hoping there is some way to keep those advantages but know when those textures are done loading.
My understanding is that Babylon caches texture URLs, so assuming this is the same for textures referenced within GLTF files (I haven’t tried it myself), maybe you could try loading all textures first then load meshes afterwards, say with a separate, daisy chained AssetsManager instance. If the textures are already cached then there shouldn’t (in theory) be any delay between mesh loading and texture application.