Sfoglia il codice sorgente

WebGLRenderer: Traverse only visible lights in compile()

This way the set of lights matches with the ones used during rendering, making sure that the compiled programs have the right parameters for rendering.
Olli Etuaho 5 anni fa
parent
commit
ae115fe061
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      src/renderers/WebGLRenderer.js

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -873,9 +873,9 @@ function WebGLRenderer( parameters ) {
 		currentRenderState = renderStates.get( scene, camera );
 		currentRenderState = renderStates.get( scene, camera );
 		currentRenderState.init();
 		currentRenderState.init();
 
 
-		scene.traverse( function ( object ) {
+		scene.traverseVisible( function ( object ) {
 
 
-			if ( object.isLight ) {
+			if ( object.isLight && object.layers.test( camera.layers ) ) {
 
 
 				currentRenderState.pushLight( object );
 				currentRenderState.pushLight( object );
 
 

粤ICP备19079148号