فهرست منبع

WebGLRenderer: store shadows/shadowsPointLight in _lights. See #7440.

Mr.doob 9 سال پیش
والد
کامیت
04ffa8bf46
1فایلهای تغییر یافته به همراه17 افزوده شده و 1 حذف شده
  1. 17 1
      src/renderers/WebGLRenderer.js

+ 17 - 1
src/renderers/WebGLRenderer.js

@@ -114,7 +114,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 		directional: [],
 		point: [],
 		spot: [],
-		hemi: []
+		hemi: [],
+
+		shadows: 0,
+		shadowsPointLight: 0
 
 	},
 
@@ -2587,6 +2590,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 		spotLength = 0,
 		hemiLength = 0;
 
+		_lights.shadows = 0;
+		_lights.shadowsPointLight = 0;
+
 		for ( l = 0, ll = lights.length; l < ll; l ++ ) {
 
 			light = lights[ l ];
@@ -2620,6 +2626,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				_lights.directional[ directionalLength ++ ] = uniforms;
 
+				if ( light.castShadow ) _lights.shadows ++;
 
 			} else if ( light instanceof THREE.PointLight ) {
 
@@ -2643,6 +2650,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				_lights.point[ pointLength ++ ] = uniforms;
 
+				if ( light.castShadow ) {
+
+					_lights.shadows ++;
+					_lights.shadowsPointLight ++;
+
+				}
+
 			} else if ( light instanceof THREE.SpotLight ) {
 
 				if( ! light.__webglUniforms ) {
@@ -2675,6 +2689,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				_lights.spot[ spotLength ++ ] = uniforms;
 
+				if ( light.castShadow ) _lights.shadows ++;
+
 			} else if ( light instanceof THREE.HemisphereLight ) {
 
 				if( ! light.__webglUniforms ) {