ソースを参照

Avoid multiple textureLoaders in for-loops

Mugen87 9 年 前
コミット
8ab4529129

+ 3 - 3
examples/js/MD2Character.js

@@ -223,13 +223,13 @@ THREE.MD2Character = function () {
 
 
 	function loadTextures( baseUrl, textureUrls ) {
 	function loadTextures( baseUrl, textureUrls ) {
 
 
-		var mapping = THREE.UVMapping;
+		var textureLoader = new THREE.TextureLoader();
 		var textures = [];
 		var textures = [];
 
 
 		for ( var i = 0; i < textureUrls.length; i ++ ) {
 		for ( var i = 0; i < textureUrls.length; i ++ ) {
 
 
-			textures[ i ] = new THREE.TextureLoader().load( baseUrl + textureUrls[ i ], checkLoadingComplete );
-			textures[ i ].mapping = mapping;
+			textures[ i ] = textureLoader.load( baseUrl + textureUrls[ i ], checkLoadingComplete );
+			textures[ i ].mapping = THREE.UVMapping;
 			textures[ i ].name = textureUrls[ i ];
 			textures[ i ].name = textureUrls[ i ];
 
 
 		}
 		}

+ 4 - 4
examples/js/MD2CharacterComplex.js

@@ -506,13 +506,13 @@ THREE.MD2CharacterComplex = function () {
 
 
 	function loadTextures( baseUrl, textureUrls ) {
 	function loadTextures( baseUrl, textureUrls ) {
 
 
-		var mapping = THREE.UVMapping;
+		var textureLoader = new THREE.TextureLoader();
 		var textures = [];
 		var textures = [];
 
 
 		for ( var i = 0; i < textureUrls.length; i ++ ) {
 		for ( var i = 0; i < textureUrls.length; i ++ ) {
-			
-			textures[ i ] = new THREE.TextureLoader().load( baseUrl + textureUrls[ i ], checkLoadingComplete );
-			textures[ i ].mapping = mapping;
+
+			textures[ i ] = textureLoader.load( baseUrl + textureUrls[ i ], checkLoadingComplete );
+			textures[ i ].mapping = THREE.UVMapping;
 			textures[ i ].name = textureUrls[ i ];
 			textures[ i ].name = textureUrls[ i ];
 
 
 		}
 		}

+ 3 - 3
examples/js/UCSCharacter.js

@@ -91,13 +91,13 @@ THREE.UCSCharacter = function() {
 
 
 	function loadTextures( baseUrl, textureUrls ) {
 	function loadTextures( baseUrl, textureUrls ) {
 
 
-		var mapping = THREE.UVMapping;
+		var textureLoader = new THREE.TextureLoader();
 		var textures = [];
 		var textures = [];
 
 
 		for ( var i = 0; i < textureUrls.length; i ++ ) {
 		for ( var i = 0; i < textureUrls.length; i ++ ) {
 
 
-			textures[ i ] = new THREE.TextureLoader().load( baseUrl + textureUrls[ i ], scope.checkLoadingComplete );
-			textures[ i ].mapping = mapping;
+			textures[ i ] = textureLoader.load( baseUrl + textureUrls[ i ], scope.checkLoadingComplete );
+			textures[ i ].mapping = THREE.UVMapping;
 			textures[ i ].name = textureUrls[ i ];
 			textures[ i ].name = textureUrls[ i ];
 
 
 		}
 		}