Browse Source

Fix wrong texture’s object reference in image loader callback

s9k 10 years ago
parent
commit
2eae8eb0f8
1 changed files with 14 additions and 6 deletions
  1. 14 6
      examples/js/loaders/ColladaLoader.js

+ 14 - 6
examples/js/loaders/ColladaLoader.js

@@ -3676,13 +3676,8 @@ THREE.ColladaLoader = function () {
 									} else {
 									} else {
 
 
 										texture = new THREE.Texture();
 										texture = new THREE.Texture();
-										loader = new THREE.ImageLoader();
-										loader.load( url, function ( image ) {
 
 
-											texture.image = image;
-											texture.needsUpdate = true;
-
-										} );
+										loadTextureImage( texture, url );
 
 
 									}
 									}
 
 
@@ -5154,6 +5149,19 @@ THREE.ColladaLoader = function () {
 
 
 	};
 	};
 
 
+	function loadTextureImage ( texture, url ) {
+
+		loader = new THREE.ImageLoader();
+
+		loader.load( url, function ( image ) {
+
+			texture.image = image;
+			texture.needsUpdate = true;
+
+		} );
+
+	};
+
 	function extractDoubleSided( obj, element ) {
 	function extractDoubleSided( obj, element ) {
 
 
 		obj.doubleSided = false;
 		obj.doubleSided = false;