OSDN Git Service

three.jsをThirdPartyに追加
[webglgame/webgl_framework.git] / webglFramework / Thirdparty / three.js-master / examples / js / postprocessing / ClearPass.js
1 /**
2  * @author mrdoob / http://mrdoob.com/
3  */
4
5 THREE.ClearPass = function ( clearColor, clearAlpha ) {
6
7         THREE.Pass.call( this );
8
9         this.needsSwap = false;
10
11         this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
12         this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
13
14 };
15
16 THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
17
18         constructor: THREE.ClearPass,
19
20         render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
21
22                 var oldClearColor, oldClearAlpha;
23
24                 if ( this.clearColor ) {
25
26                         oldClearColor = renderer.getClearColor().getHex();
27                         oldClearAlpha = renderer.getClearAlpha();
28
29                         renderer.setClearColor( this.clearColor, this.clearAlpha );
30
31                 }
32
33                 renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
34                 renderer.clear();
35
36                 if ( this.clearColor ) {
37
38                         renderer.setClearColor( oldClearColor, oldClearAlpha );
39
40                 }
41
42         }
43
44 } );