Browse Source

Small fixes on texture loading.

Special thanks to @spinchristopher
Denys Zariaiev 10 years ago
parent
commit
854688f16b
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/loaders/ObjectLoader.js

+ 6 - 3
src/loaders/ObjectLoader.js

@@ -50,12 +50,15 @@ THREE.ObjectLoader.prototype = {
 		var geometries, materials, images, textures;
 		var geometries, materials, images, textures;
 		var self = this;
 		var self = this;
 
 
+		self.manager.itemStart(json.object.uuid);
 		var manager = new THREE.LoadingManager( function() {
 		var manager = new THREE.LoadingManager( function() {
 
 
 			textures  = self.parseTextures( json.textures, images );
 			textures  = self.parseTextures( json.textures, images );
 			materials = self.parseMaterials( json.materials, textures );
 			materials = self.parseMaterials( json.materials, textures );
 
 
 			onLoad( self.parseObject( json.object, geometries, materials ) );
 			onLoad( self.parseObject( json.object, geometries, materials ) );
+			// report back to parent manager
+			self.manager.itemEnd(json.object.uuid);
 
 
 		} );
 		} );
 
 
@@ -263,13 +266,13 @@ THREE.ObjectLoader.prototype = {
 				var url  = self.texturePath + data.url;
 				var url  = self.texturePath + data.url;
 
 
 				self.manager.itemStart( url );
 				self.manager.itemStart( url );
-				loader.load( url, function ( image ) {
+				loader.load( url, function ( uuid, url, image ) {
 
 
 					self.manager.itemEnd( url );
 					self.manager.itemEnd( url );
 
 
-					images[ data.uuid ] = image;
+					images[ uuid ] = image;
 
 
-				} );
+				}.bind( null, data.uuid, url ) );
 
 
 			}
 			}