Browse Source

WebGLRenderer: Moved MeshFaceMaterial out of renderBufferDirect.

Mr.doob 10 năm trước cách đây
mục cha
commit
7182b80927
1 tập tin đã thay đổi với 16 bổ sung18 xóa
  1. 16 18
      src/renderers/WebGLRenderer.js

+ 16 - 18
src/renderers/WebGLRenderer.js

@@ -775,24 +775,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.renderBufferDirect = function ( camera, lights, fog, geometry, material, object ) {
 
-		if ( material instanceof THREE.MeshFaceMaterial ) {
-
-			var materials = material.materials;
-
-			for ( var i = 0, il = materials.length; i < il; i ++ ) {
-
-				material = materials[ i ];
-
-				if ( material === null || material.visible === false ) continue;
-
-				_this.renderBufferDirect( camera, lights, fog, geometry, material, object );
-
-			}
-
-			return;
-
-		}
-
 		setMaterial( material );
 
 		var program = setProgram( camera, lights, fog, material, object );
@@ -1737,6 +1719,22 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( overrideMaterial === undefined ) material = object.material;
 
+			if ( material instanceof THREE.MeshFaceMaterial ) {
+
+				var materials = material.materials;
+
+				for ( var j = 0, jl = materials.length; j < jl; j ++ ) {
+
+					material = materials[ j ];
+
+					if ( material === null || material.visible === false ) continue;
+
+					_this.renderBufferDirect( camera, lights, fog, geometry, material, object );
+
+				}
+
+			}
+
 			_this.renderBufferDirect( camera, lights, fog, geometry, material, object );
 
 		}