mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-26 05:15:58 +10:00
Refactored postprocessing out of examples into own set of classes.
Not sure yet about names and location of files.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
THREE.ScreenPass = function( opacity ) {
|
||||
|
||||
var shader = THREE.ShaderUtils.lib[ "screen" ];
|
||||
|
||||
this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
|
||||
this.uniforms[ "opacity" ].value = ( opacity !== undefined ) ? opacity : 1.0;
|
||||
|
||||
this.material = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: this.uniforms,
|
||||
vertexShader: shader.vertexShader,
|
||||
fragmentShader: shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
};
|
||||
|
||||
THREE.ScreenPass.prototype = {
|
||||
|
||||
render: function ( renderer, renderTarget, delta ) {
|
||||
|
||||
this.uniforms[ "tDiffuse" ].texture = renderTarget;
|
||||
|
||||
THREE.EffectComposer.quad.materials[ 0 ] = this.material;
|
||||
|
||||
renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user