소스 검색

Avoid multiple textureLoaders in for-loops

Mugen87 9 년 전
부모
커밋
8ab4529129
3개의 변경된 파일10개의 추가작업 그리고 10개의 파일을 삭제
  1. 3 3
      examples/js/MD2Character.js
  2. 4 4
      examples/js/MD2CharacterComplex.js
  3. 3 3
      examples/js/UCSCharacter.js

+ 3 - 3
examples/js/MD2Character.js

@@ -223,13 +223,13 @@ THREE.MD2Character = function () {
 
 	function loadTextures( baseUrl, textureUrls ) {
 
-		var mapping = THREE.UVMapping;
+		var textureLoader = new THREE.TextureLoader();
 		var textures = [];
 
 		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 ];
 
 		}

+ 4 - 4
examples/js/MD2CharacterComplex.js

@@ -506,13 +506,13 @@ THREE.MD2CharacterComplex = function () {
 
 	function loadTextures( baseUrl, textureUrls ) {
 
-		var mapping = THREE.UVMapping;
+		var textureLoader = new THREE.TextureLoader();
 		var textures = [];
 
 		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 ];
 
 		}

+ 3 - 3
examples/js/UCSCharacter.js

@@ -91,13 +91,13 @@ THREE.UCSCharacter = function() {
 
 	function loadTextures( baseUrl, textureUrls ) {
 
-		var mapping = THREE.UVMapping;
+		var textureLoader = new THREE.TextureLoader();
 		var textures = [];
 
 		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 ];
 
 		}