|
@@ -42,15 +42,13 @@ THREE.GlitchPass = function ( dt_size ) {
|
|
|
|
|
|
THREE.GlitchPass.prototype = {
|
|
|
|
|
|
- render: function ( renderer, writeBuffer, readBuffer, delta )
|
|
|
- {
|
|
|
+ render: function ( renderer, writeBuffer, readBuffer, delta ) {
|
|
|
|
|
|
this.uniforms[ "tDiffuse" ].value = readBuffer;
|
|
|
this.uniforms[ 'seed' ].value = Math.random();//default seeding
|
|
|
this.uniforms[ 'byp' ].value = 0;
|
|
|
|
|
|
- if ( this.curF % this.randX == 0 || this.goWild == true )
|
|
|
- {
|
|
|
+ if ( this.curF % this.randX == 0 || this.goWild == true ) {
|
|
|
|
|
|
this.uniforms[ 'amount' ].value = Math.random() / 30;
|
|
|
this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
|
|
@@ -62,8 +60,7 @@ THREE.GlitchPass.prototype = {
|
|
|
this.generateTrigger();
|
|
|
|
|
|
}
|
|
|
- else if ( this.curF % this.randX < this.randX / 5 )
|
|
|
- {
|
|
|
+ else if ( this.curF % this.randX < this.randX / 5 ) {
|
|
|
|
|
|
this.uniforms[ 'amount' ].value = Math.random() / 90;
|
|
|
this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
|
|
@@ -73,8 +70,7 @@ THREE.GlitchPass.prototype = {
|
|
|
this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
|
|
|
|
|
|
}
|
|
|
- else if ( this.goWild == false )
|
|
|
- {
|
|
|
+ else if ( this.goWild == false ) {
|
|
|
|
|
|
this.uniforms[ 'byp' ].value = 1;
|
|
|
|
|
@@ -82,35 +78,30 @@ THREE.GlitchPass.prototype = {
|
|
|
this.curF ++;
|
|
|
|
|
|
this.quad.material = this.material;
|
|
|
- if ( this.renderToScreen )
|
|
|
- {
|
|
|
+ if ( this.renderToScreen ) {
|
|
|
|
|
|
renderer.render( this.scene, this.camera );
|
|
|
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
+ else {
|
|
|
|
|
|
renderer.render( this.scene, this.camera, writeBuffer, false );
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- generateTrigger: function()
|
|
|
- {
|
|
|
+ generateTrigger: function() {
|
|
|
|
|
|
this.randX = THREE.Math.randInt( 120, 240 );
|
|
|
|
|
|
},
|
|
|
- generateHeightmap: function( dt_size )
|
|
|
- {
|
|
|
+ generateHeightmap: function( dt_size ) {
|
|
|
|
|
|
var data_arr = new Float32Array( dt_size * dt_size * 3 );
|
|
|
console.log( dt_size );
|
|
|
var length = dt_size * dt_size;
|
|
|
|
|
|
- for ( var i = 0; i < length; i ++ )
|
|
|
- {
|
|
|
+ for ( var i = 0; i < length; i ++ ) {
|
|
|
|
|
|
var val = THREE.Math.randFloat( 0, 1 );
|
|
|
data_arr[ i * 3 + 0 ] = val;
|