I have a large amount of textures and models to load into my project. I am trying to show a progress bars while everything is loading. I think the LoadingManager
Docs: http://threejs.org/docs/#Reference/Loaders/TextureLoader
Example: http://threejs.org/examples/#webgl_loader_obj
Code:
var sphereMaterial = new THREE.MeshBasicMaterial();
var onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
var loader = new THREE.TextureLoader();
var texture = loader.load("___4MB_IMAGE.JPG___", undefined, onProgress);
sphereMaterial.map = texture;
It solves a similar problem I had - 4MB texture that takes some time to load over the wire...