"Wrong" progress?

Hi,I believe that I am not the first user to encounter such problems. I will share my own solutions and hope to get your suggestions or your better methods.

Brief introduction

I have a lot of .glb models that need to be loaded before the entire program runs. I want to provide users with a loading bar.

asfhuihujca

As shown in the figure, the same loader was used for the embedded texture, which caused an error. I think that for the embedded texture, I don’t care about its progress, so I use another loader to load it without monitoring the progress.

The result looks like this:

Can anyone give me some good suggestions?

The LoadingManager progress is shown only per model and as statet in the docs, it actually does only show progress of how many models are loaded, not how much of a model is loaded:

LoadingManager

.onProgress : Function

This function will be called when an item is complete. The arguments are:
url — The url of the item just loaded.
itemsLoaded — the number of items already loaded so far.
itemsTotal — the total amount of items to be loaded.

By default this is undefined, unless passed in the constructor.

GLTFLoader

onProgress — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .total and .loaded bytes.

Here you get the XHR. You can calculate the progress by the total and loaded bytes

  console.log((xhr.loaded * 100) / xhr.total)

Thank you for your reply, maybe you did not understand what I meant.

As shown in the figure, the same loader was used for the embedded texture, which caused an error. I think that for the embedded texture, I don’t care about its progress, so I use another loader to load it without monitoring the progress.

As you can see from the picture, the error caused by the dynamically increasing total.Although we all know that it is because of blob.My approach is to ignore this part.

In addition, I just don’t have *100. :joy: