Quellcode durchsuchen

WebGLShadowMap: Clean up. (#25863)

* WebGLShadowMap: Clean up.

* WebGLShadowMap: More clean up.
Michael Herzog vor 2 Jahren
Ursprung
Commit
fb70570380
1 geänderte Dateien mit 8 neuen und 6 gelöschten Zeilen
  1. 8 6
      src/renderers/webgl/WebGLShadowMap.js

+ 8 - 6
src/renderers/webgl/WebGLShadowMap.js

@@ -88,6 +88,11 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 		_state.buffers.depth.setTest( true );
 		_state.setScissorTest( false );
 
+		// check for shadow map type changes
+
+		const toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );
+		const fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );
+
 		// render depth map
 
 		for ( let i = 0, il = lights.length; i < il; i ++ ) {
@@ -132,10 +137,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 
 			}
 
-			const switchedToVSM = _previousType !== VSMShadowMap && this.type === VSMShadowMap;
-			const switchedFromVSM = _previousType === VSMShadowMap && this.type !== VSMShadowMap;
-
-			if ( shadow.map === null || switchedToVSM || switchedFromVSM ) {
+			if ( shadow.map === null || toVSM === true || fromVSM === true ) {
 
 				const pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};
 
@@ -152,8 +154,6 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 
 			}
 
-			_previousType = this.type;
-
 			_renderer.setRenderTarget( shadow.map );
 			_renderer.clear();
 
@@ -192,6 +192,8 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 
 		}
 
+		_previousType = this.type;
+
 		scope.needsUpdate = false;
 
 		_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );