Browse Source

WebGLRenderer: setupLights shadow clean up.

Mr.doob 9 years ago
parent
commit
9db9dae5d7
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/renderers/WebGLRenderer.js

+ 8 - 5
src/renderers/WebGLRenderer.js

@@ -2642,9 +2642,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 		directionalLength = 0,
 		pointLength = 0,
 		spotLength = 0,
-		hemiLength = 0;
+		hemiLength = 0,
+
+		shadowsLength = 0;
 
-		_lights.shadows.length = 0;
 		_lights.shadowsPointLight = 0;
 
 		for ( l = 0, ll = lights.length; l < ll; l ++ ) {
@@ -2680,7 +2681,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( light.castShadow ) {
 
-					_lights.shadows.push( [ light, directionalLength ] );
+					_lights.shadows[ shadowsLength ++ ] = [ light, directionalLength ];
 
 				}
 
@@ -2708,7 +2709,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( light.castShadow ) {
 
-					_lights.shadows.push( [ light, pointLength ] );
+					_lights.shadows[ shadowsLength ++ ] = [ light, pointLength ];
 					_lights.shadowsPointLight ++;
 
 				}
@@ -2747,7 +2748,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				if ( light.castShadow ) {
 
-					_lights.shadows.push( [ light, spotLength ] );
+					_lights.shadows[ shadowsLength ++ ] = [ light, pointLength ];
 
 				}
 
@@ -2787,6 +2788,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_lights.spot.length = spotLength;
 		_lights.hemi.length = hemiLength;
 
+		_lights.shadows.length = shadowsLength;
+
 		_lights.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + hemiLength;
 
 	}