For example, in ColladaLoader
, it will set textures on the loaded tree:
But there is no way to detect when the attached textures are loaded. As you see there, no onLoad callback is passed into the texture loaders.
For example, in ColladaLoader
, it will set textures on the loaded tree:
But there is no way to detect when the attached textures are loaded. As you see there, no onLoad callback is passed into the texture loaders.
ColladaLoader
as well as all its internal loaders share the same loading manager. So if you want to wait until all resources are loaded, use the LoadingManager.onLoad() callback.
@Mugen87 Ah, thanks!
I’m guessing I should pass in a custom LoadingManager
to ColladaLoader
, otherwise LoadingManager.onLoad
will fire for all ColladaLoader
s that may have started loading at the same time (with a default LoadingManager
), right?
Yes, that’s correct. Do it like in this example: three.js webgl - collada
Awesome. What if we want to use one LoadingManager
per loader (f.e. ColladaLoader
s and GLTFLoader
s) so that we can run logic after all parts of each model are loaded, but we also want to know progress of all loaders and run logic once all models are loaded?
In other words, relying on the DefaultLoadingManager
is nice because then we know when everything is loaded, as well as the progress for everything. But we also want to do certain things based on loading of each model.
It seems the only way to do this would be to use the separate LoadingManager
per model loader as you suggested, then create a new system on top that will add together all the totalItems
from each LoadingManager
‘s onProgress
handlers, and basically wait for all the loading managers’ onLoad
to be called to finally know when all are loaded.
That sounds correct, yes!