Explorar o código

Set mapping property of envMap at proper timing in MMDLoader

Takahiro %!s(int64=8) %!d(string=hai) anos
pai
achega
939bffd5ce
Modificáronse 1 ficheiros con 6 adicións e 13 borrados
  1. 6 13
      examples/js/loaders/MMDLoader.js

+ 6 - 13
examples/js/loaders/MMDLoader.js

@@ -947,12 +947,6 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 				t.wrapS = THREE.RepeatWrapping;
 				t.wrapT = THREE.RepeatWrapping;
 
-				if ( params.sphericalReflectionMapping === true ) {
-
-					t.mapping = THREE.SphericalReflectionMapping;
-
-				}
-
 				for ( var i = 0; i < texture.readyCallbacks.length; i++ ) {
 
 					texture.readyCallbacks[ i ]( texture );
@@ -963,6 +957,12 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 
 			}, onProgress, onError );
 
+			if ( params.sphericalReflectionMapping === true ) {
+
+				texture.mapping = THREE.SphericalReflectionMapping;
+
+			}
+
 			texture.readyCallbacks = [];
 
 			textures[ fullPath ] = texture;
@@ -1258,13 +1258,6 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 				m.envMap = getTexture( p.envMap, textures );
 				m.combine = p.envMapType;
 
-				// TODO: WebGLRenderer should automatically update?
-				m.envMap.readyCallbacks.push( function ( t ) {
-
-					m.needsUpdate = true;
-
-				} );
-
 			}
 
 			m.opacity = p.opacity;