Skip to content

Commit

Permalink
GPUParticleSystem: Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jan 20, 2018
1 parent f81506e commit a0a58c5
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions examples/js/GPUParticleSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

THREE.GPUParticleSystem = function( options ) {
THREE.GPUParticleSystem = function ( options ) {

THREE.Object3D.apply( this, arguments );

Expand Down Expand Up @@ -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 ];

Expand Down Expand Up @@ -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 ++ ) {

Expand All @@ -217,7 +217,7 @@ THREE.GPUParticleSystem = function( options ) {

};

this.spawnParticle = function( options ) {
this.spawnParticle = function ( options ) {

this.PARTICLE_CURSOR ++;

Expand All @@ -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 ++ ) {

Expand All @@ -243,7 +243,7 @@ THREE.GPUParticleSystem = function( options ) {

};

this.dispose = function() {
this.dispose = function () {

this.particleShaderMat.dispose();
this.particleNoiseTex.dispose();
Expand All @@ -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 );

Expand Down Expand Up @@ -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' );
Expand Down Expand Up @@ -402,15 +402,15 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {

};

this.init = function() {
this.init = function () {

this.particleSystem = new THREE.Points( this.particleShaderGeo, this.particleShaderMat );
this.particleSystem.frustumCulled = false;
this.add( this.particleSystem );

};

this.update = function( time ) {
this.update = function ( time ) {

this.time = time;
this.particleShaderMat.uniforms.uTime.value = time;
Expand All @@ -419,7 +419,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {

};

this.geometryUpdate = function() {
this.geometryUpdate = function () {

if ( this.particleUpdate === true ) {

Expand Down Expand Up @@ -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;

}

Expand All @@ -487,7 +487,7 @@ THREE.GPUParticleContainer = function( maxParticles, particleSystem ) {

};

this.dispose = function() {
this.dispose = function () {

this.particleShaderGeo.dispose();

Expand Down

0 comments on commit a0a58c5

Please sign in to comment.