History

added array of finger emitters for particle system

Jeffrey Ventrella committed 13 years ago

Commit 56d0c7d1 parent 408edc75 files · +56 −50Browse files

Showing the changes to interface/src/ParticleSystem.cpp (1 of 5 files). Show all

Unified · Split

interface/src/ParticleSystem.cpp+16−8
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313
1414 const float DEFAULT_PARTICLE_BOUNCE = 1.0f;
1515 const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;
16−const float DEFAULT_PARTICLE_GRAVITY = 0.05f;
1716
1817 ParticleSystem::ParticleSystem() {
1918
@@ -30,7 +29,7 @@ ParticleSystem::ParticleSystem() { · 10 unmodified lines
3029 _emitter[e].front = IDENTITY_FRONT;
3130 _emitter[e].bounce = DEFAULT_PARTICLE_BOUNCE;
3231 _emitter[e].airFriction = DEFAULT_PARTICLE_AIR_FRICTION;
33− _emitter[e].gravity = DEFAULT_PARTICLE_GRAVITY;
32+ _emitter[e].gravity = 0.0f;
3433 _emitter[e].jitter = 0.0f;
3534 _emitter[e].emitterAttraction = 0.0f;
3635 _emitter[e].tornadoForce = 0.0f;
@@ -56,11 +55,20 @@ ParticleSystem::ParticleSystem() { · 19 unmodified lines
5655
5756
5857 int ParticleSystem::addEmitter() {
58+
59+ printf( "\n" );
60+ printf( "ParticleSystem::addEmitter\n" );
61+
5962 _numEmitters ++;
6063
6164 if (_numEmitters > MAX_EMITTERS) {
65+
66+ printf( "Oops! _numEmitters > MAX_EMITTERS... returning -1\n" );
67+
6268 return -1;
6369 }
70+
71+ printf( "ok, _numEmitters is %d,and the index of this newly added emitter is %d.\n", _numEmitters, _numEmitters-1 );
6472
6573 return _numEmitters - 1;
6674 }
@@ -153,13 +161,13 @@ void ParticleSystem::runSpecialEffectsTest(int e, float deltaTime) { · 86 unmodified lines
153161
154162 _timer += deltaTime;
155163
156− _emitter[e].gravity = 0.0f + DEFAULT_PARTICLE_GRAVITY * sinf( _timer * 0.52f );
164+ _emitter[e].gravity = 0.0f + 0.05f * sinf( _timer * 0.52f );
157165 _emitter[e].airFriction = (DEFAULT_PARTICLE_AIR_FRICTION + 0.5f) + 2.0f * sinf( _timer * 0.32f );
158− _emitter[e].jitter = 0.05f + 0.05f * sinf( _timer * 0.42f );
159− _emitter[e].emitterAttraction = 0.015f + 0.015f * cosf( _timer * 0.6f );
160− _emitter[e].tornadoForce = 0.0f + 0.03f * sinf( _timer * 0.7f );
161− _emitter[e].neighborAttraction = 0.1f + 0.1f * cosf( _timer * 0.8f );
162− _emitter[e].neighborRepulsion = 0.2f + 0.2f * sinf( _timer * 0.4f );
166+ _emitter[e].jitter = 0.05f + 0.05f * sinf( _timer * 0.42f );
167+ _emitter[e].emitterAttraction = 0.015f + 0.015f * cosf( _timer * 0.6f );
168+ _emitter[e].tornadoForce = 0.0f + 0.03f * sinf( _timer * 0.7f );
169+ _emitter[e].neighborAttraction = 0.1f + 0.1f * cosf( _timer * 0.8f );
170+ _emitter[e].neighborRepulsion = 0.2f + 0.2f * sinf( _timer * 0.4f );
163171
164172 if (_emitter[e].gravity < 0.0f) {
165173 _emitter[e].gravity = 0.0f;