From fb14834c5bad806db056010d76106d3103394777 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 19 Apr 2017 14:40:00 -0700 Subject: [PATCH] Revert "WebGLRenderer: Moved layer test to renderObject. See #11083." This reverts commit 8c72ccc75a23752d9a89704038ed8fe1d91244c0. --- src/renderers/WebGLRenderer.js | 78 ++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index cccfe53b5c..ff87cc98ae 100644 --- a/src/renderers/WebGLRenderer.js +++ b/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 ); -- GitLab