فهرست منبع

WebGLShadowMap: Avoid changing state when shadowMap is enabled but there are not light with shadows in the scene.

Mr.doob 10 سال پیش
والد
کامیت
102d03856c
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      src/renderers/webgl/WebGLShadowMap.js

+ 3 - 2
src/renderers/webgl/WebGLShadowMap.js

@@ -93,6 +93,9 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 	this.render = function ( scene, camera ) {
 
 		var faceCount, isPointLight;
+		var shadows = _lights.shadows;
+
+		if ( shadows.length === 0 ) return;
 
 		if ( scope.enabled === false ) return;
 		if ( scope.autoUpdate === false && scope.needsUpdate === false ) return;
@@ -108,8 +111,6 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 		// render depth map
 
-		var shadows = _lights.shadows;
-
 		for ( var i = 0, il = shadows.length; i < il; i ++ ) {
 
 			var light = shadows[ i ];

粤ICP备19079148号