diff --git a/examples/js/postprocessing/ManualMSAARenderPass.js b/examples/js/postprocessing/ManualMSAARenderPass.js index 81408dd534448d..a9f1fb9e936bde 100644 --- a/examples/js/postprocessing/ManualMSAARenderPass.js +++ b/examples/js/postprocessing/ManualMSAARenderPass.js @@ -22,7 +22,7 @@ THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) // as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black. this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000; - this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1; + this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; if ( THREE.CopyShader === undefined ) console.error( "THREE.ManualMSAARenderPass relies on THREE.CopyShader" ); @@ -82,7 +82,8 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass. var autoClear = renderer.autoClear; renderer.autoClear = false; - var oldClearColorHex = renderer.getClearColor().getHex(), oldClearAlpha = renderer.getClearAlpha(); + var oldClearColor = renderer.getClearColor().getHex(); + var oldClearAlpha = renderer.getClearAlpha(); var baseSampleWeight = 1.0 / jitterOffsets.length; var roundingRange = 1 / 32; @@ -122,7 +123,8 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass. if ( this.camera.clearViewOffset ) this.camera.clearViewOffset(); renderer.autoClear = autoClear; - renderer.setClearColor( oldClearColorHex, oldClearAlpha ); + renderer.setClearColor( oldClearColor, oldClearAlpha ); + } } ); diff --git a/examples/js/postprocessing/RenderPass.js b/examples/js/postprocessing/RenderPass.js index d704ec21a09954..4e4edc0d41fbda 100644 --- a/examples/js/postprocessing/RenderPass.js +++ b/examples/js/postprocessing/RenderPass.js @@ -12,7 +12,7 @@ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clear this.overrideMaterial = overrideMaterial; this.clearColor = clearColor; - this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1; + this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; this.clear = true; this.needsSwap = false; @@ -27,10 +27,12 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype this.scene.overrideMaterial = this.overrideMaterial; + var oldClearColor, oldClearAlpha; + if ( this.clearColor ) { - var oldClearColorHex = renderer.getClearColor(); - var oldClearAlpha = renderer.getClearAlpha(); + oldClearColor = renderer.getClearColor().getHex(); + oldClearAlpha = renderer.getClearAlpha(); renderer.setClearColor( this.clearColor, this.clearAlpha ); @@ -40,7 +42,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype if ( this.clearColor ) { - renderer.setClearColor( oldClearColorHex, oldClearAlpha ); + renderer.setClearColor( oldClearColor, oldClearAlpha ); } diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js index d0bc92f314319e..c5f9348b3df082 100644 --- a/src/renderers/webgl/WebGLProgram.js +++ b/src/renderers/webgl/WebGLProgram.js @@ -284,7 +284,7 @@ THREE.WebGLProgram = ( function () { prefixVertex = [ - '#define SHADER_NAME ' + material.__webglShader.name, + '#define SHADER_NAME RawShaderMaterial', customDefines @@ -292,7 +292,7 @@ THREE.WebGLProgram = ( function () { prefixFragment = [ - '#define SHADER_NAME ' + material.__webglShader.name, + '#define SHADER_NAME RawShaderMaterial', customDefines