2 * @author mrdoob / http://mrdoob.com/
5 THREE.ClearPass = function ( clearColor, clearAlpha ) {
7 THREE.Pass.call( this );
9 this.needsSwap = false;
11 this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
12 this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
16 THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
18 constructor: THREE.ClearPass,
20 render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
22 var oldClearColor, oldClearAlpha;
24 if ( this.clearColor ) {
26 oldClearColor = renderer.getClearColor().getHex();
27 oldClearAlpha = renderer.getClearAlpha();
29 renderer.setClearColor( this.clearColor, this.clearAlpha );
33 renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
36 if ( this.clearColor ) {
38 renderer.setClearColor( oldClearColor, oldClearAlpha );