Jelajahi Sumber

Fixed RenderPass discarding the scene overrideMaterial if no overrideMaterial is passed

Benjamin MICHEL 5 tahun lalu
induk
melakukan
ccd6da5773
1 mengubah file dengan 8 tambahan dan 2 penghapusan
  1. 8 2
      examples/js/postprocessing/RenderPass.js

+ 8 - 2
examples/js/postprocessing/RenderPass.js

@@ -29,7 +29,13 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 		var oldAutoClear = renderer.autoClear;
 		renderer.autoClear = false;
 
-		this.scene.overrideMaterial = this.overrideMaterial;
+		var oldOverrideMaterial = this.scene.overrideMaterial;
+
+		if ( this.overrideMaterial !== undefined ) {
+
+			this.scene.overrideMaterial = this.overrideMaterial;
+
+		}
 
 		var oldClearColor, oldClearAlpha;
 
@@ -60,7 +66,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 		}
 
-		this.scene.overrideMaterial = null;
+		this.scene.overrideMaterial = oldOverrideMaterial;
 		renderer.autoClear = oldAutoClear;
 
 	}