Hi, when using threejs LoadingManager and loading different assets, say for example a cube texture and a gltf model, I noticed that the onprogress function gives initially a wrong count of the assets (it initially counts only the textures for the cube texture, and then add the count only for the gltf model).
For example:
const manager = new T.LoadingManager()
manager.onLoad = function ( ) {
console.log( "Loading complete!")
}
manager.onProgress = function ( url, itemsLoaded, itemsTotal ) {
console.log(`Items loaded: ${itemsLoaded}/${itemsTotal}`)
}
manager.onError = function ( url ) {
console.log( 'There was an error loading ' + url )
}
const cubeTextureLoader = new T.CubeTextureLoader(manager)
const gltfLoader = new T.GLTFLoader(manager)
gltfLoader.load("model.gltf")
cubeTextureLoader.load([
"Left.png",
"Right.png",
"Up.png",
"Down.png",
"Front.png",
"Back.png",
])
I can observe the following output in the console:
Items loaded: 1/8
Items loaded: 2/8
Items loaded: 3/8
Items loaded: 4/8
Items loaded: 5/8
Items loaded: 6/8
Items loaded: 7/8
Items loaded: 8/21
Items loaded: 9/21
Items loaded: 10/21
Items loaded: 11/21
Items loaded: 12/21
Items loaded: 13/21
Items loaded: 14/21
Items loaded: 15/21
Items loaded: 16/21
Items loaded: 17/21
Items loaded: 18/21
Items loaded: 19/21
Items loaded: 21/21
Items loaded: 21/21
Loading complete!
As you can see the initial count of the manager is related only to the cube texture (8 textures), then it has been updated as soon as the GLTFLoader has parsed the model file and updated the count in the manager.
I would ask if there is a way to get the full count of assets before starting to load them. The objective would be to have a realistic progress bar (or something similar) that shows the loading status.