Refactored postprocessing out of examples into own set of classes.

Not sure yet about names and location of files.
This commit is contained in:
alteredq
2011-08-29 23:35:36 +02:00
parent 495de75ff2
commit ff09a492bb
10 changed files with 453 additions and 652 deletions
+34
View File
@@ -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 );
}
};