Explorar o código

Use the same coding style as the other lines

Benjamin MICHEL %!s(int64=5) %!d(string=hai) anos
pai
achega
df1c4369eb

+ 9 - 4
examples/js/postprocessing/RenderPass.js

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

+ 15 - 3
examples/jsm/postprocessing/RenderPass.js

@@ -32,9 +32,16 @@ RenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 		var oldAutoClear = renderer.autoClear;
 		renderer.autoClear = false;
 
-		this.scene.overrideMaterial = this.overrideMaterial;
 
-		var oldClearColor, oldClearAlpha;
+		var oldClearColor, oldClearAlpha, oldOverrideMaterial;
+
+		if ( this.overrideMaterial !== undefined ) {
+
+			oldOverrideMaterial = this.scene.overrideMaterial;
+
+			this.scene.overrideMaterial = this.overrideMaterial;
+
+		}
 
 		if ( this.clearColor ) {
 
@@ -63,7 +70,12 @@ RenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 
 		}
 
-		this.scene.overrideMaterial = null;
+		if ( this.overrideMaterial !== undefined ) {
+
+			this.scene.overrideMaterial = oldOverrideMaterial;
+
+		}
+
 		renderer.autoClear = oldAutoClear;
 
 	}