RenderPass.js 844 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @author alteredq / http://alteredqualia.com/
  3. */
  4. THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor ) {
  5. this.scene = scene;
  6. this.camera = camera;
  7. this.overrideMaterial = overrideMaterial;
  8. this.clearColor = clearColor;
  9. this.clear = true;
  10. this.needsSwap = false;
  11. this.oldClearColor = new THREE.Color();
  12. };
  13. THREE.RenderPass.prototype = {
  14. render: function ( renderer, writeBuffer, readBuffer, delta ) {
  15. this.scene.overrideMaterial = this.overrideMaterial;
  16. if ( this.clearColor ) {
  17. this.oldClearColor.copy( renderer.getClearColor() );
  18. renderer.setClearColor( this.clearColor, 1 );
  19. }
  20. renderer.render( this.scene, this.camera, readBuffer, this.clear );
  21. if ( this.clearColor ) {
  22. renderer.setClearColor( this.oldClearColor, 1 );
  23. }
  24. this.scene.overrideMaterial = null;
  25. }
  26. };