From a0a58c562cfc1ba48c78bcffbf840020ff266162 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 20 Jan 2018 20:39:18 +0100 Subject: [PATCH] GPUParticleSystem: Clean up --- examples/js/GPUParticleSystem.js | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/js/GPUParticleSystem.js b/examples/js/GPUParticleSystem.js index 535f0852c8a022..7c59aa536634f8 100644 --- a/examples/js/GPUParticleSystem.js +++ b/examples/js/GPUParticleSystem.js @@ -15,7 +15,7 @@ * */ -THREE.GPUParticleSystem = function( options ) { +THREE.GPUParticleSystem = function ( options ) { THREE.Object3D.apply( this, arguments ); @@ -158,13 +158,13 @@ THREE.GPUParticleSystem = function( options ) { var i; - for ( i = 1e5; i > 0; i-- ) { + for ( i = 1e5; i > 0; i -- ) { this.rand.push( Math.random() - 0.5 ); } - this.random = function() { + this.random = function () { return ++ i >= this.rand.length ? this.rand[ i = 1 ] : this.rand[ i ]; @@ -205,7 +205,7 @@ THREE.GPUParticleSystem = function( options ) { this.particleShaderMat.defaultAttributeValues.particlePositionsStartTime = [ 0, 0, 0, 0 ]; this.particleShaderMat.defaultAttributeValues.particleVelColSizeLife = [ 0, 0, 0, 0 ]; - this.init = function() { + this.init = function () { for ( var i = 0; i < this.PARTICLE_CONTAINERS; i ++ ) { @@ -217,7 +217,7 @@ THREE.GPUParticleSystem = function( options ) { }; - this.spawnParticle = function( options ) { + this.spawnParticle = function ( options ) { this.PARTICLE_CURSOR ++; @@ -233,7 +233,7 @@ THREE.GPUParticleSystem = function( options ) { }; - this.update = function( time ) { + this.update = function ( time ) { for ( var i = 0; i < this.PARTICLE_CONTAINERS; i ++ ) { @@ -243,7 +243,7 @@ THREE.GPUParticleSystem = function( options ) { }; - this.dispose = function() { + this.dispose = function () { this.particleShaderMat.dispose(); this.particleNoiseTex.dispose(); @@ -267,7 +267,7 @@ THREE.GPUParticleSystem.prototype.constructor = THREE.GPUParticleSystem; // Subclass for particle containers, allows for very large arrays to be spread out -THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { +THREE.GPUParticleContainer = function ( maxParticles, particleSystem ) { THREE.Object3D.apply( this, arguments ); @@ -301,7 +301,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { var velocity = new THREE.Vector3(); var color = new THREE.Color(); - this.spawnParticle = function( options ) { + this.spawnParticle = function ( options ) { var positionStartAttribute = this.particleShaderGeo.getAttribute( 'positionStart' ); var startTimeAttribute = this.particleShaderGeo.getAttribute( 'startTime' ); @@ -402,7 +402,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { }; - this.init = function() { + this.init = function () { this.particleSystem = new THREE.Points( this.particleShaderGeo, this.particleShaderMat ); this.particleSystem.frustumCulled = false; @@ -410,7 +410,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { }; - this.update = function( time ) { + this.update = function ( time ) { this.time = time; this.particleShaderMat.uniforms.uTime.value = time; @@ -419,7 +419,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { }; - this.geometryUpdate = function() { + this.geometryUpdate = function () { if ( this.particleUpdate === true ) { @@ -462,13 +462,13 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { lifeTimeAttribute.updateRange.offset = 0; // Use -1 to update the entire buffer, see #11476 - positionStartAttribute.updateRange.count = -1; - startTimeAttribute.updateRange.count = -1; - velocityAttribute.updateRange.count = -1; - turbulenceAttribute.updateRange.count = -1; - colorAttribute.updateRange.count = -1; - sizeAttribute.updateRange.count = -1; - lifeTimeAttribute.updateRange.count = -1; + positionStartAttribute.updateRange.count = - 1; + startTimeAttribute.updateRange.count = - 1; + velocityAttribute.updateRange.count = - 1; + turbulenceAttribute.updateRange.count = - 1; + colorAttribute.updateRange.count = - 1; + sizeAttribute.updateRange.count = - 1; + lifeTimeAttribute.updateRange.count = - 1; } @@ -487,7 +487,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) { }; - this.dispose = function() { + this.dispose = function () { this.particleShaderGeo.dispose();