How to wait for textures to finish loading from JSON model in Three.js?

前端 未结 3 1532
说谎
说谎 2021-01-19 01:45

I have a JSON model being loaded successfully based on AlteredQualia\'s skinning example. However, I would like to not reveal the model until it is finished loading. As you

3条回答
  •  情深已故
    2021-01-19 02:03

    This is a bit of a hack, but at line 10362 (revision 61) of three.js you will see image.onload = function() (it's in the main THREE.Loader prototype). I managed to track that down to be the callback function for loaded textures from JSON models.

    If you add your own callback inside that function you can track when textures are loaded.

    As I said before though, this is a hack (which helped me out a lot for a particular application) and not a solution, be very careful modifying the library code. You might break stuff you don't know you're breaking.

提交回复
热议问题