Closed telramund closed 5 years ago
The idea is to use THREE.LoadingManager
for this use case like in the following example:
https://threejs.org/examples/webgl_loader_collada
Or, ideally, the ColladaLoader onLoad callback was called when all assets are loaded and the model is ready to use.
The current situation in the library is not consistent since other loaders like GLTFLoader
or ObjectLoader
behave exactly like that. I know this issue was discussed before but no change was made since the usage of THREE.LoadingManager
is an easy workaround.
Thanks, I'll try that and post an update soon.
Using a dedicated instance of THREE.LoadingManager works fine, thanks.
Description of the problem
Currently there is no official way to specify an onLoad callback for assets associated with a Collada model. Many models cannot be rendered properly until assets (like textures) are loaded. It is not a problem for applications that do continuous rendering on a timer. But in my use case (a CAD application) it is, as I only render the scene when it changes.
I ended up with a hack temporarily globally overriding THREE.TextureLoader.prototype.load(). But it would make things a lot easier if TextureLoader (or ImageLoader) instances used internally by ColladaLoader were exposed as properties rather that being sealed inside lambdas, so callbacks could have been set up normally on them.
Or, ideally, the ColladaLoader onLoad callback was called when all assets are loaded and the model is ready to use. Here's my workaround to illustrate the issue: