three#MathUtils JavaScript Examples
The following examples show how to use
three#MathUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlitchPass.js From Computer-Graphics with MIT License | 7 votes |
generateHeightmap( dt_size ) {
const data_arr = new Float32Array( dt_size * dt_size );
const length = dt_size * dt_size;
for ( let i = 0; i < length; i ++ ) {
const val = MathUtils.randFloat( 0, 1 );
data_arr[ i ] = val;
}
const texture = new DataTexture( data_arr, dt_size, dt_size, RedFormat, FloatType );
texture.needsUpdate = true;
return texture;
}
Example #2
Source File: BlueMapApp.js From BlueMapVue with MIT License | 6 votes |
setFlatView(transition = 0, minDistance = 5) {
if (!this.mapViewer.map) return;
if (this.viewAnimation) this.viewAnimation.cancel();
let cm = this.mapViewer.controlsManager;
cm.controls = null;
let startDistance = cm.distance;
let targetDistance = Math.max(5, minDistance, startDistance);
let startRotation = cm.rotation;
let startAngle = cm.angle;
let startOrtho = cm.ortho;
let startTilt = cm.tilt;
this.viewAnimation = animate(p => {
let ep = EasingFunctions.easeInOutQuad(p);
cm.distance = MathUtils.lerp(startDistance, targetDistance, ep);
cm.rotation = MathUtils.lerp(startRotation, 0, ep);
cm.angle = MathUtils.lerp(startAngle, 0, ep);
cm.ortho = MathUtils.lerp(startOrtho, 1, p);
cm.tilt = MathUtils.lerp(startTilt, 0, ep);
}, transition, finished => {
this.mapControls.reset();
if (finished){
cm.controls = this.mapControls;
this.updatePageAddress();
}
});
this.appState.controls.state = "flat";
}
Example #3
Source File: SSAOPass.js From Computer-Graphics with MIT License | 6 votes |
generateSampleKernel() {
const kernelSize = this.kernelSize;
const kernel = this.kernel;
for ( let i = 0; i < kernelSize; i ++ ) {
const sample = new Vector3();
sample.x = ( Math.random() * 2 ) - 1;
sample.y = ( Math.random() * 2 ) - 1;
sample.z = Math.random();
sample.normalize();
let scale = i / kernelSize;
scale = MathUtils.lerp( 0.1, 1, scale * scale );
sample.multiplyScalar( scale );
kernel.push( sample );
}
}
Example #4
Source File: EventHandler.js From webmc with MIT License | 6 votes |
updatePosition (e) {
if (this.gameState === 'gameLock') {
this.game.camera.rotation.x -= MathUtils.degToRad(e.movementY / 10)
this.game.camera.rotation.y -= MathUtils.degToRad(e.movementX / 10)
if (MathUtils.radToDeg(this.game.camera.rotation.x) < -90) {
this.game.camera.rotation.x = MathUtils.degToRad(-90)
}
if (MathUtils.radToDeg(this.game.camera.rotation.x) > 90) {
this.game.camera.rotation.x = MathUtils.degToRad(90)
}
this.game.socket.emit('rotate', [
this.game.camera.rotation.y,
this.game.camera.rotation.x
])
}
}
Example #5
Source File: Utils.js From BlueMapWeb with MIT License | 6 votes |
animate = function (animationFrame, durationMs = 1000, postAnimation = null) {
let animation = {
animationStart: -1,
lastFrame: -1,
cancelled: false,
frame: function (time) {
if (this.cancelled) return;
if (this.animationStart === -1) {
this.animationStart = time;
this.lastFrame = time;
}
let progress = durationMs === 0 ? 1 : MathUtils.clamp((time - this.animationStart) / durationMs, 0, 1);
let deltaTime = time - this.lastFrame;
animationFrame(progress, deltaTime);
if (progress < 1) window.requestAnimationFrame(time => this.frame(time));
else if (postAnimation) postAnimation(true);
this.lastFrame = time;
},
cancel: function () {
this.cancelled = true;
if (postAnimation) postAnimation(false);
}
};
window.requestAnimationFrame(time => animation.frame(time));
return animation;
}
Example #6
Source File: Marker.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param position {Vector3}
* @param camera {THREE.Camera}
* @param fadeDistanceMax {number}
* @param fadeDistanceMin {number}
* @returns {number} - opacity between 0 and 1
*/
static calculateDistanceOpacity(position, camera, fadeDistanceMin, fadeDistanceMax) {
let distance = Marker.calculateDistanceToCameraPlane(position, camera);
let minDelta = (distance - fadeDistanceMin) / fadeDistanceMin;
let maxDelta = (distance - fadeDistanceMax) / (fadeDistanceMax * 0.5);
return Math.min(
MathUtils.clamp(minDelta, 0, 1),
1 - MathUtils.clamp(maxDelta + 1, 0, 1)
);
}
Example #7
Source File: TouchRotateControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaRotation === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.rotation += this.deltaRotation * smoothing * this.speed;
this.deltaRotation *= 1 - smoothing;
if (Math.abs(this.deltaRotation) < 0.0001) {
this.deltaRotation = 0;
}
}
Example #8
Source File: TouchMoveControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaPosition.x === 0 && this.deltaPosition.y === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
let directionDelta = TouchMoveControls.tempVec2_1.copy(this.deltaPosition);
directionDelta.rotateAround(VEC2_ZERO, this.manager.rotation);
this.manager.position.x += directionDelta.x * smoothing * this.manager.distance * this.speed * this.pixelToSpeedMultiplierX;
this.manager.position.z += directionDelta.y * smoothing * this.manager.distance * this.speed * this.pixelToSpeedMultiplierY;
this.deltaPosition.multiplyScalar(1 - smoothing);
if (this.deltaPosition.lengthSq() < 0.0001) {
this.deltaPosition.set(0, 0);
}
}
Example #9
Source File: TouchAngleControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaAngle === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.angle += this.deltaAngle * smoothing * this.speed * this.pixelToSpeedMultiplierY;
this.deltaAngle *= 1 - smoothing;
if (Math.abs(this.deltaAngle) < 0.0001) {
this.deltaAngle = 0;
}
}
Example #10
Source File: MouseZoomControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaZoom === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.distance *= Math.pow(1.5, this.deltaZoom * smoothing * this.speed);
this.deltaZoom *= 1 - smoothing;
if (Math.abs(this.deltaZoom) < 0.0001) {
this.deltaZoom = 0;
}
}
Example #11
Source File: MouseRotateControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaRotation === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.rotation += this.deltaRotation * smoothing * this.speed * this.pixelToSpeedMultiplierX;
this.deltaRotation *= 1 - smoothing;
if (Math.abs(this.deltaRotation) < 0.0001) {
this.deltaRotation = 0;
}
}
Example #12
Source File: MouseMoveControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaPosition.x === 0 && this.deltaPosition.y === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
let directionDelta = MouseMoveControls.tempVec2_1.copy(this.deltaPosition);
directionDelta.rotateAround(VEC2_ZERO, this.manager.rotation);
this.manager.position.x += directionDelta.x * smoothing * this.manager.distance * this.speed * this.pixelToSpeedMultiplierX;
this.manager.position.z += directionDelta.y * smoothing * this.manager.distance * this.speed * this.pixelToSpeedMultiplierY;
this.deltaPosition.multiplyScalar(1 - smoothing);
if (this.deltaPosition.lengthSq() < 0.0001) {
this.deltaPosition.set(0, 0);
}
}
Example #13
Source File: MouseAngleControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaAngle === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.angle += this.deltaAngle * smoothing * this.speed * this.pixelToSpeedMultiplierY;
this.deltaAngle *= 1 - smoothing;
if (Math.abs(this.deltaAngle) < 0.0001) {
this.deltaAngle = 0;
}
}
Example #14
Source File: KeyZoomControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.in) this.deltaZoom -= 1;
if (this.out) this.deltaZoom += 1;
if (this.deltaZoom === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.distance *= Math.pow(1.5, this.deltaZoom * smoothing * this.speed * delta * 0.06);
this.deltaZoom *= 1 - smoothing;
if (Math.abs(this.deltaZoom) < 0.0001) {
this.deltaZoom = 0;
}
}
Example #15
Source File: KeyMoveControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.up) this.deltaPosition.y -= 1;
if (this.down) this.deltaPosition.y += 1;
if (this.left) this.deltaPosition.x -= 1;
if (this.right) this.deltaPosition.x += 1;
if (this.deltaPosition.x === 0 && this.deltaPosition.y === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
let rotatedDelta = KeyMoveControls.temp_v2.copy(this.deltaPosition);
rotatedDelta.rotateAround(VEC2_ZERO, this.manager.rotation);
this.manager.position.x += rotatedDelta.x * smoothing * this.manager.distance * this.speed * delta * 0.06;
this.manager.position.z += rotatedDelta.y * smoothing * this.manager.distance * this.speed * delta * 0.06;
this.deltaPosition.multiplyScalar(1 - smoothing);
if (this.deltaPosition.lengthSq() < 0.0001) {
this.deltaPosition.set(0, 0);
}
}
Example #16
Source File: KeyAngleControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.up) this.deltaAngle -= 1;
if (this.down) this.deltaAngle += 1;
if (this.deltaAngle === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.angle += this.deltaAngle * smoothing * this.speed * delta * 0.06;
this.deltaAngle *= 1 - smoothing;
if (Math.abs(this.deltaAngle) < 0.0001) {
this.deltaAngle = 0;
}
}
Example #17
Source File: MapHeightControls.js From BlueMapWeb with MIT License | 6 votes |
updateHeights(delta, map) {
//target height
let targetSmoothing = this.targetHeightStiffness / (16.666 / delta);
targetSmoothing = MathUtils.clamp(targetSmoothing, 0, 1);
let targetTerrainHeight = map.terrainHeightAt(this.manager.position.x, this.manager.position.z) + 3 || 0;
let targetDelta = targetTerrainHeight - this.targetHeight;
this.targetHeight += targetDelta * targetSmoothing;
if (Math.abs(targetDelta) < 0.001) this.targetHeight = targetTerrainHeight;
// camera height
this.minCameraHeight = 0;
if (this.maxAngle >= 0.1) {
let cameraSmoothing = this.cameraHeightStiffness / (16.666 / delta);
cameraSmoothing = MathUtils.clamp(cameraSmoothing, 0, 1);
let cameraTerrainHeight = map.terrainHeightAt(this.manager.camera.position.x, this.manager.camera.position.z) || 0;
let cameraDelta = cameraTerrainHeight - this.cameraHeight;
this.cameraHeight += cameraDelta * cameraSmoothing;
if (Math.abs(cameraDelta) < 0.001) this.cameraHeight = cameraTerrainHeight;
let maxAngleHeight = Math.cos(this.maxAngle) * this.manager.distance;
this.minCameraHeight = this.cameraHeight - maxAngleHeight + 1;
}
// adjust targetHeight by distance
this.distanceTagretHeight = Math.max(MathUtils.lerp(this.targetHeight, 0, this.manager.distance / 500), 0);
}
Example #18
Source File: BlueMapApp.js From BlueMapVue with MIT License | 6 votes |
setPerspectiveView(transition = 0, minDistance = 5) {
if (!this.mapViewer.map) return;
if (this.viewAnimation) this.viewAnimation.cancel();
let cm = this.mapViewer.controlsManager;
cm.controls = null;
let startDistance = cm.distance;
let targetDistance = Math.max(5, minDistance, startDistance);
let startY = cm.position.y;
let targetY = MathUtils.lerp(this.mapViewer.map.terrainHeightAt(cm.position.x, cm.position.z) + 3, 0, targetDistance / 500);
let startAngle = cm.angle;
let targetAngle = Math.min(Math.PI / 2, startAngle, this.mapControls.getMaxPerspectiveAngleForDistance(targetDistance));
let startOrtho = cm.ortho;
let startTilt = cm.tilt;
this.viewAnimation = animate(p => {
let ep = EasingFunctions.easeInOutQuad(p);
cm.position.y = MathUtils.lerp(startY, targetY, ep);
cm.distance = MathUtils.lerp(startDistance, targetDistance, ep);
cm.angle = MathUtils.lerp(startAngle, targetAngle, ep);
cm.ortho = MathUtils.lerp(startOrtho, 0, p);
cm.tilt = MathUtils.lerp(startTilt, 0, ep);
}, transition, finished => {
this.mapControls.reset();
if (finished){
cm.controls = this.mapControls;
this.updatePageAddress();
}
});
this.appState.controls.state = "perspective";
}
Example #19
Source File: TouchPanControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaPosition.x === 0 && this.deltaPosition.y === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.rotation += this.deltaPosition.x * this.speed * this.pixelToSpeedMultiplierX * this.stiffness;
this.manager.angle -= this.deltaPosition.y * this.speed * this.pixelToSpeedMultiplierY * this.stiffness;
this.deltaPosition.multiplyScalar(1 - smoothing);
if (this.deltaPosition.lengthSq() < 0.0001) {
this.deltaPosition.set(0, 0);
}
}
Example #20
Source File: MouseRotateControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaRotation === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.rotation += this.deltaRotation * smoothing;
this.deltaRotation *= 1 - smoothing;
if (Math.abs(this.deltaRotation) < 0.0001) {
this.deltaRotation = 0;
}
}
Example #21
Source File: MouseAngleControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.deltaAngle === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.angle += this.deltaAngle * smoothing;
this.deltaAngle *= 1 - smoothing;
if (Math.abs(this.deltaAngle) < 0.0001) {
this.deltaAngle = 0;
}
}
Example #22
Source File: KeyMoveControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.up) this.deltaPosition.y -= 1;
if (this.down) this.deltaPosition.y += 1;
if (this.left) this.deltaPosition.x -= 1;
if (this.right) this.deltaPosition.x += 1;
if (this.deltaPosition.x === 0 && this.deltaPosition.y === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
let rotatedDelta = KeyMoveControls.temp_v2.copy(this.deltaPosition);
rotatedDelta.rotateAround(VEC2_ZERO, this.manager.rotation);
this.manager.position.x += rotatedDelta.x * smoothing * this.speed * delta * 0.06;
this.manager.position.z += rotatedDelta.y * smoothing * this.speed * delta * 0.06;
this.deltaPosition.multiplyScalar(1 - smoothing);
if (this.deltaPosition.lengthSq() < 0.0001) {
this.deltaPosition.set(0, 0);
}
}
Example #23
Source File: KeyHeightControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.up) this.deltaY += 1;
if (this.down) this.deltaY -= 1;
if (this.deltaY === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.position.y += this.deltaY * smoothing * this.speed * delta * 0.06;
this.deltaY *= 1 - smoothing;
if (Math.abs(this.deltaY) < 0.0001) {
this.deltaY = 0;
}
}
Example #24
Source File: BlueMapApp.js From BlueMapVue with MIT License | 6 votes |
setFreeFlight(transition = 0, targetY = undefined) {
if (!this.mapViewer.map) return;
if (!this.settings.freeFlightEnabled) return this.setPerspectiveView(transition);
if (this.viewAnimation) this.viewAnimation.cancel();
let cm = this.mapViewer.controlsManager;
cm.controls = null;
let startDistance = cm.distance;
let startY = cm.position.y;
if (!targetY) targetY = this.mapViewer.map.terrainHeightAt(cm.position.x, cm.position.z) + 3 || startY;
let startAngle = cm.angle;
let targetAngle = Math.PI / 2;
let startOrtho = cm.ortho;
let startTilt = cm.tilt;
this.viewAnimation = animate(p => {
let ep = EasingFunctions.easeInOutQuad(p);
cm.position.y = MathUtils.lerp(startY, targetY, ep);
cm.distance = MathUtils.lerp(startDistance, 0, ep);
cm.angle = MathUtils.lerp(startAngle, targetAngle, ep);
cm.ortho = MathUtils.lerp(startOrtho, 0, Math.min(p * 2, 1));
cm.tilt = MathUtils.lerp(startTilt, 0, ep);
}, transition, finished => {
if (finished){
cm.controls = this.freeFlightControls;
this.updatePageAddress();
}
});
this.appState.controls.state = "free";
}
Example #25
Source File: FreeFlightControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
this.keyMove.update(delta, map);
this.keyHeight.update(delta, map);
this.mouseRotate.update(delta, map);
this.mouseAngle.update(delta, map);
this.touchPan.update(delta, map);
this.manager.angle = MathUtils.clamp(this.manager.angle, 0, Math.PI);
this.manager.distance = 0;
this.manager.ortho = 0;
}
Example #26
Source File: KeyRotateControls.js From BlueMapWeb with MIT License | 6 votes |
/**
* @param delta {number}
* @param map {Map}
*/
update(delta, map) {
if (this.left) this.deltaRotation += 1;
if (this.right) this.deltaRotation -= 1;
if (this.deltaRotation === 0) return;
let smoothing = this.stiffness / (16.666 / delta);
smoothing = MathUtils.clamp(smoothing, 0, 1);
this.manager.rotation += this.deltaRotation * smoothing * this.speed * delta * 0.06;
this.deltaRotation *= 1 - smoothing;
if (Math.abs(this.deltaRotation) < 0.0001) {
this.deltaRotation = 0;
}
}
Example #27
Source File: PositionalAudioHelper.js From canvas with Apache License 2.0 | 5 votes |
PositionalAudioHelper.prototype.update = function () {
var audio = this.audio;
var range = this.range;
var divisionsInnerAngle = this.divisionsInnerAngle;
var divisionsOuterAngle = this.divisionsOuterAngle;
var coneInnerAngle = MathUtils.degToRad( audio.panner.coneInnerAngle );
var coneOuterAngle = MathUtils.degToRad( audio.panner.coneOuterAngle );
var halfConeInnerAngle = coneInnerAngle / 2;
var halfConeOuterAngle = coneOuterAngle / 2;
var start = 0;
var count = 0;
var i, stride;
var geometry = this.geometry;
var positionAttribute = geometry.attributes.position;
geometry.clearGroups();
//
function generateSegment( from, to, divisions, materialIndex ) {
var step = ( to - from ) / divisions;
positionAttribute.setXYZ( start, 0, 0, 0 );
count ++;
for ( i = from; i < to; i += step ) {
stride = start + count;
positionAttribute.setXYZ( stride, Math.sin( i ) * range, 0, Math.cos( i ) * range );
positionAttribute.setXYZ( stride + 1, Math.sin( Math.min( i + step, to ) ) * range, 0, Math.cos( Math.min( i + step, to ) ) * range );
positionAttribute.setXYZ( stride + 2, 0, 0, 0 );
count += 3;
}
geometry.addGroup( start, count, materialIndex );
start += count;
count = 0;
}
//
generateSegment( - halfConeOuterAngle, - halfConeInnerAngle, divisionsOuterAngle, 0 );
generateSegment( - halfConeInnerAngle, halfConeInnerAngle, divisionsInnerAngle, 1 );
generateSegment( halfConeInnerAngle, halfConeOuterAngle, divisionsOuterAngle, 0 );
//
positionAttribute.needsUpdate = true;
if ( coneInnerAngle === coneOuterAngle ) this.material[ 0 ].visible = false;
};
Example #28
Source File: GlitchPass.js From Computer-Graphics with MIT License | 5 votes |
generateTrigger() {
this.randX = MathUtils.randInt( 120, 240 );
}
Example #29
Source File: GlitchPass.js From Computer-Graphics with MIT License | 5 votes |
render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
if ( renderer.capabilities.isWebGL2 === false ) this.uniforms[ 'tDisp' ].value.format = LuminanceFormat;
this.uniforms[ 'tDiffuse' ].value = readBuffer.texture;
this.uniforms[ 'seed' ].value = Math.random();//default seeding
this.uniforms[ 'byp' ].value = 0;
if ( this.curF % this.randX == 0 || this.goWild == true ) {
this.uniforms[ 'amount' ].value = Math.random() / 30;
this.uniforms[ 'angle' ].value = MathUtils.randFloat( - Math.PI, Math.PI );
this.uniforms[ 'seed_x' ].value = MathUtils.randFloat( - 1, 1 );
this.uniforms[ 'seed_y' ].value = MathUtils.randFloat( - 1, 1 );
this.uniforms[ 'distortion_x' ].value = MathUtils.randFloat( 0, 1 );
this.uniforms[ 'distortion_y' ].value = MathUtils.randFloat( 0, 1 );
this.curF = 0;
this.generateTrigger();
} else if ( this.curF % this.randX < this.randX / 5 ) {
this.uniforms[ 'amount' ].value = Math.random() / 90;
this.uniforms[ 'angle' ].value = MathUtils.randFloat( - Math.PI, Math.PI );
this.uniforms[ 'distortion_x' ].value = MathUtils.randFloat( 0, 1 );
this.uniforms[ 'distortion_y' ].value = MathUtils.randFloat( 0, 1 );
this.uniforms[ 'seed_x' ].value = MathUtils.randFloat( - 0.3, 0.3 );
this.uniforms[ 'seed_y' ].value = MathUtils.randFloat( - 0.3, 0.3 );
} else if ( this.goWild == false ) {
this.uniforms[ 'byp' ].value = 1;
}
this.curF ++;
if ( this.renderToScreen ) {
renderer.setRenderTarget( null );
this.fsQuad.render( renderer );
} else {
renderer.setRenderTarget( writeBuffer );
if ( this.clear ) renderer.clear();
this.fsQuad.render( renderer );
}
}