123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /**
- * @author alteredq / http://alteredqualia.com/
- */
- THREE.DotScreenPass = function( center, angle, scale ) {
- var shader = THREE.ShaderExtras[ "dotscreen" ];
- this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
- if ( center !== undefined )
- this.uniforms[ "center" ].value.copy( center );
- if ( angle !== undefined ) this.uniforms[ "angle"].value = angle;
- if ( scale !== undefined ) this.uniforms[ "scale"].value = scale;
- this.material = new THREE.MeshShaderMaterial( {
- uniforms: this.uniforms,
- vertexShader: shader.vertexShader,
- fragmentShader: shader.fragmentShader
- } );
- this.renderToScreen = false;
- this.needsSwap = true;
- };
- THREE.DotScreenPass.prototype = {
- render: function ( renderer, writeBuffer, readBuffer, delta ) {
- this.uniforms[ "tDiffuse" ].texture = readBuffer;
- this.uniforms[ "tSize" ].value.set( readBuffer.width, readBuffer.height );
- THREE.EffectComposer.quad.materials[ 0 ] = this.material;
- if ( this.renderToScreen ) {
- renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera );
- } else {
- renderer.render( THREE.EffectComposer.scene, THREE.EffectComposer.camera, writeBuffer, false );
- }
- }
- };
|