2
0

ClearPass.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. console.warn( "THREE.ClearPass: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation." );
  2. THREE.ClearPass = function ( clearColor, clearAlpha ) {
  3. THREE.Pass.call( this );
  4. this.needsSwap = false;
  5. this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
  6. this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
  7. };
  8. THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
  9. constructor: THREE.ClearPass,
  10. render: function ( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
  11. var oldClearColor, oldClearAlpha;
  12. if ( this.clearColor ) {
  13. oldClearColor = renderer.getClearColor().getHex();
  14. oldClearAlpha = renderer.getClearAlpha();
  15. renderer.setClearColor( this.clearColor, this.clearAlpha );
  16. }
  17. renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
  18. renderer.clear();
  19. if ( this.clearColor ) {
  20. renderer.setClearColor( oldClearColor, oldClearAlpha );
  21. }
  22. }
  23. } );