瀏覽代碼

Merge pull request #10471 from takahirox/FixMMDEnvMapMapping

Set mapping property of envMap at proper timing in MMDLoader
Mr.doob 8 年之前
父節點
當前提交
95b2dc67f8
共有 1 個文件被更改,包括 6 次插入13 次删除
  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;