Browse Source

Revert "WebGLRenderer: Moved layer test to renderObject. See #11083."

This reverts commit 8c72ccc75a23752d9a89704038ed8fe1d91244c0.
Mr.doob 8 years ago
parent
commit
fb14834c5b
1 changed files with 41 additions and 37 deletions
  1. 41 37
      src/renderers/WebGLRenderer.js

+ 41 - 37
src/renderers/WebGLRenderer.js

@@ -1304,73 +1304,79 @@ function WebGLRenderer( parameters ) {
 
 		if ( ! object.visible ) return;
 
-		if ( object.isLight ) {
+		var visible = object.layers.test( camera.layers );
 
-			lights.push( object );
+		if ( visible ) {
 
-		} else if ( object.isSprite ) {
+			if ( object.isLight ) {
 
-			if ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {
+				lights.push( object );
 
-				sprites.push( object );
+			} else if ( object.isSprite ) {
 
-			}
+				if ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {
 
-		} else if ( object.isLensFlare ) {
+					sprites.push( object );
 
-			lensFlares.push( object );
+				}
 
-		} else if ( object.isImmediateRenderObject ) {
+			} else if ( object.isLensFlare ) {
 
-			if ( sortObjects ) {
+				lensFlares.push( object );
 
-				_vector3.setFromMatrixPosition( object.matrixWorld )
-					.applyMatrix4( _projScreenMatrix );
+			} else if ( object.isImmediateRenderObject ) {
 
-			}
+				if ( sortObjects ) {
 
-			currentRenderList.push( object, null, object.material, _vector3.z, null );
+					_vector3.setFromMatrixPosition( object.matrixWorld )
+						.applyMatrix4( _projScreenMatrix );
 
-		} else if ( object.isMesh || object.isLine || object.isPoints ) {
+				}
 
-			if ( object.isSkinnedMesh ) {
+				currentRenderList.push( object, null, object.material, _vector3.z, null );
 
-				object.skeleton.update();
+			} else if ( object.isMesh || object.isLine || object.isPoints ) {
 
-			}
+				if ( object.isSkinnedMesh ) {
 
-			if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {
+					object.skeleton.update();
 
-				if ( sortObjects ) {
+				}
 
-					_vector3.setFromMatrixPosition( object.matrixWorld )
-						.applyMatrix4( _projScreenMatrix );
+				if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {
 
-				}
+					if ( sortObjects ) {
+
+						_vector3.setFromMatrixPosition( object.matrixWorld )
+							.applyMatrix4( _projScreenMatrix );
+
+					}
 
-				var geometry = objects.update( object );
-				var material = object.material;
+					var geometry = objects.update( object );
+					var material = object.material;
 
-				if ( Array.isArray( material ) ) {
+					if ( Array.isArray( material ) ) {
 
-					var groups = geometry.groups;
+						var groups = geometry.groups;
 
-					for ( var i = 0, l = groups.length; i < l; i ++ ) {
+						for ( var i = 0, l = groups.length; i < l; i ++ ) {
 
-						var group = groups[ i ];
-						var groupMaterial = material[ group.materialIndex ];
+							var group = groups[ i ];
+							var groupMaterial = material[ group.materialIndex ];
 
-						if ( groupMaterial && groupMaterial.visible ) {
+							if ( groupMaterial && groupMaterial.visible ) {
 
-							currentRenderList.push( object, geometry, groupMaterial, _vector3.z, group );
+								currentRenderList.push( object, geometry, groupMaterial, _vector3.z, group );
+
+							}
 
 						}
 
-					}
+					} else if ( material.visible ) {
 
-				} else if ( material.visible ) {
+						currentRenderList.push( object, geometry, material, _vector3.z, null );
 
-					currentRenderList.push( object, geometry, material, _vector3.z, null );
+					}
 
 				}
 
@@ -1438,8 +1444,6 @@ function WebGLRenderer( parameters ) {
 
 	function renderObject( object, scene, camera, geometry, material, group ) {
 
-		if ( object.layers.test( camera.layers ) === false ) return;
-
 		object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
 		object.normalMatrix.getNormalMatrix( object.modelViewMatrix );