diff --git a/chp04_systems/NOC_4_08_ParticleSystemSmoke/Particle.pde b/chp04_systems/NOC_4_08_ParticleSystemSmoke/Particle.pde index 91f8c220..46a9ca1b 100644 --- a/chp04_systems/NOC_4_08_ParticleSystemSmoke/Particle.pde +++ b/chp04_systems/NOC_4_08_ParticleSystemSmoke/Particle.pde @@ -14,7 +14,7 @@ class Particle { float vx = randomGaussian()*0.3; float vy = randomGaussian()*0.3 - 1.0; vel = new PVector(vx,vy); - loc = l.get(); + pos = l.get(); lifespan = 100.0; img = img_; } @@ -57,5 +57,4 @@ class Particle { return false; } } -} - +} \ No newline at end of file diff --git a/chp04_systems/NOC_4_08_ParticleSystemSmoke_b/Particle.pde b/chp04_systems/NOC_4_08_ParticleSystemSmoke_b/Particle.pde index 65788e93..d7a21bd2 100644 --- a/chp04_systems/NOC_4_08_ParticleSystemSmoke_b/Particle.pde +++ b/chp04_systems/NOC_4_08_ParticleSystemSmoke_b/Particle.pde @@ -17,7 +17,7 @@ class Particle { float vx = (float) generator.nextGaussian()*0.3; float vy = (float) generator.nextGaussian()*0.3 - 1.0; vel = new PVector(vx,vy); - loc = l.get(); + pos = l.get(); lifespan = 100.0; img = img_; } @@ -60,5 +60,4 @@ class Particle { return false; } } -} - +} \ No newline at end of file diff --git a/chp04_systems/flight404/flight404_particles_1_simple/NOC_gl.pde b/chp04_systems/flight404/flight404_particles_1_simple/NOC_gl.pde old mode 100755 new mode 100644 index 3529f4e6..08048f30 --- a/chp04_systems/flight404/flight404_particles_1_simple/NOC_gl.pde +++ b/chp04_systems/flight404/flight404_particles_1_simple/NOC_gl.pde @@ -2,12 +2,11 @@ // Daniel Shiffman // http://natureofcode.com -void renderImage(PImage img, Vec3D _loc, float _diam, color _col, float _alpha ) { +void renderImage(PImage img, Vec3D _pos, float _diam, color _col, float _alpha ) { pushMatrix(); translate( _pos.x, _pos.y, _pos.z ); tint(red(_col), green(_col), blue(_col), _alpha); imageMode(CENTER); image(img,0,0,_diam,_diam); popMatrix(); -} - +} \ No newline at end of file diff --git a/chp04_systems/flight404/flight404_particles_1_simple/emitter.pde b/chp04_systems/flight404/flight404_particles_1_simple/emitter.pde old mode 100755 new mode 100644 index ed33a2dd..ddae41b5 --- a/chp04_systems/flight404/flight404_particles_1_simple/emitter.pde +++ b/chp04_systems/flight404/flight404_particles_1_simple/emitter.pde @@ -8,7 +8,7 @@ multiple emitters. */ class Emitter{ - Vec3D loc; + Vec3D pos; Vec3D vel; Vec3D velToMouse; @@ -17,7 +17,7 @@ class Emitter{ ArrayList particles; Emitter( ){ - loc = new Vec3D(); + pos = new Vec3D(); vel = new Vec3D(); velToMouse = new Vec3D(); @@ -71,7 +71,7 @@ class Emitter{ void render(){ - renderImage( emitterImg, loc, 150, myColor, 1.0 ); + renderImage( emitterImg, pos, 150, myColor, 1.0 ); } void iterateListRenderTrails(){ @@ -83,7 +83,7 @@ class Emitter{ void addParticles( int _amt ){ for( int i=0; i<_amt; i++ ){ - particles.add( new Particle( loc, vel ) ); + particles.add( new Particle( pos, vel ) ); } } -} +} \ No newline at end of file diff --git a/chp04_systems/flight404/flight404_particles_1_simple/particle.pde b/chp04_systems/flight404/flight404_particles_1_simple/particle.pde old mode 100755 new mode 100644 index 08e92147..50c45d35 --- a/chp04_systems/flight404/flight404_particles_1_simple/particle.pde +++ b/chp04_systems/flight404/flight404_particles_1_simple/particle.pde @@ -17,8 +17,8 @@ General Structure notes. class Particle { int len; // number of elements in position array - Vec3D[] loc; // array of position vectors - Vec3D startLoc; // just used to make sure every loc[] is initialized to the same position + Vec3D[] pos; // array of position vectors + Vec3D startpos; // just used to make sure every pos[] is initialized to the same position Vec3D vel; // velocity vector Vec3D perlin; // perlin noise vector float radius; // particle's size @@ -30,10 +30,10 @@ class Particle { boolean ISBOUNCING; // if particle hits the floor... - Particle( Vec3D _loc, Vec3D _vel ) { + Particle( Vec3D _pos, Vec3D _vel ) { radius = random( 10, 40 ); len = (int)( radius ); - loc = new Vec3D[ len ]; + pos = new Vec3D[ len ]; // This confusing-looking line does three things at once. // First, you make a random vector. @@ -45,10 +45,10 @@ class Particle { // This is just a way to make sure all the particles made this frame // don't all start on the exact same pixel. This staggering will be useful // when we incorporate magnetic repulsion in a later tutorial. - startLoc = new Vec3D( _pos.add( new Vec3D().randomVector().scaleSelf( random( 5.0 ) ) ) ); + startpos = new Vec3D( _pos.add( new Vec3D().randomVector().scaleSelf( random( 5.0 ) ) ) ); for( int i=0; i floorLevel ) { + if( pos[0].y + vel.y > floorLevel ) { ISBOUNCING = true; } else { @@ -119,18 +119,18 @@ class Particle { // Every frame, the current position will be passed on to // the next element in the position array. Think 'cursor trail effect'. for( int i=len-1; i>0; i-- ) { - loc[i].set( loc[i-1] ); + pos[i].set( pos[i-1] ); } // Set the initial position. - // loc[0] represents the current position of the particle. - loc[0].addSelf( vel ); + // pos[0] represents the current position of the particle. + pos[0].addSelf( vel ); } void render() { // As the particle ages, it will gain blue but will lose red and green. color c = color( agePer, agePer*.75, 1.0 - agePer ); - renderImage(particleImg, loc[0], radius * agePer, c, 1.0 ); + renderImage(particleImg, pos[0], radius * agePer, c, 1.0 ); } void renderTrails() { @@ -139,9 +139,9 @@ class Particle { beginShape(QUAD_STRIP); for ( int i=0; i