forked from sent/waves
64 lines
1.2 KiB
JavaScript
64 lines
1.2 KiB
JavaScript
/**
|
|
* @author alteredq / http://alteredqualia.com/
|
|
*/
|
|
|
|
THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {
|
|
|
|
this.scene = scene;
|
|
this.camera = camera;
|
|
|
|
this.overrideMaterial = overrideMaterial;
|
|
|
|
this.clearColor = clearColor;
|
|
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;
|
|
|
|
this.oldClearColor = new THREE.Color();
|
|
this.oldClearAlpha = 1;
|
|
|
|
this.enabled = true;
|
|
this.clear = true;
|
|
this.needsSwap = false;
|
|
|
|
this.prePass = null;
|
|
this.postPass = null;
|
|
};
|
|
|
|
THREE.RenderPass.prototype = {
|
|
|
|
render: function ( renderer, writeBuffer, readBuffer, delta ) {
|
|
|
|
if( this.prePass )
|
|
{
|
|
this.prePass.call(this, renderer);
|
|
}
|
|
|
|
this.scene.overrideMaterial = this.overrideMaterial;
|
|
|
|
if ( this.clearColor ) {
|
|
|
|
this.oldClearColor.copy( renderer.getClearColor() );
|
|
this.oldClearAlpha = renderer.getClearAlpha();
|
|
|
|
renderer.setClearColor( this.clearColor, this.clearAlpha );
|
|
|
|
}
|
|
|
|
renderer.render( this.scene, this.camera, readBuffer, this.clear );
|
|
|
|
if ( this.clearColor ) {
|
|
|
|
renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
|
|
|
|
}
|
|
|
|
this.scene.overrideMaterial = null;
|
|
|
|
if( this.postPass )
|
|
{
|
|
this.postPass.call(this, renderer);
|
|
}
|
|
|
|
}
|
|
|
|
};
|