How to calculate the resource size of all files and how many resources have been loaded when loading network resource files

When I need to import multiple network assets and calculate the current loading level based on the total resource size and the loaded resource size for the custom loading screen implementation (DefaultLoadingScreen), I don’t know how to do it (but I will load a single asset file, I will. For example, use the onProgress event of AppendAsync), but multiple resource loading I don’t know how to get the total resource size and the size of the loaded resource…

It looks something like this

I don’t know how this works

I am not sure what the best strategy would be but counting. @bghgary do I remember correctly that you worked on something similar for gltf progress ?

Here is what we do in the glTF loader when multiple files are being loaded for loose glTF files with external resources. The web requests are stored in an array with its own stats stored on the requests themselves, then they are aggregated.

Does this help?

I need to load glb, fbx files, GLTFFileLoader seems to be just loading glft, and this is a private method, how do I use it…

We do not support fbx files in Babylon at the moment. You would need some support for it in the loader you are using.

I’m not saying you should use this method directly. Just do something similar to what we are doing in the loader. It’s not a lot of code.

1 Like