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
13 13
14const float DEFAULT_PARTICLE_BOUNCE = 1.0f;14const float DEFAULT_PARTICLE_BOUNCE = 1.0f;
15const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;15const float DEFAULT_PARTICLE_AIR_FRICTION = 2.0f;
16const float DEFAULT_PARTICLE_GRAVITY = 0.05f;
17 16
18ParticleSystem::ParticleSystem() {17ParticleSystem::ParticleSystem() {
19 18
@@ -30,7 +29,7 @@ ParticleSystem::ParticleSystem() { · 10 unmodified lines
30 _emitter[e].front = IDENTITY_FRONT;29 _emitter[e].front = IDENTITY_FRONT;
31 _emitter[e].bounce = DEFAULT_PARTICLE_BOUNCE;30 _emitter[e].bounce = DEFAULT_PARTICLE_BOUNCE;
32 _emitter[e].airFriction = DEFAULT_PARTICLE_AIR_FRICTION;31 _emitter[e].airFriction = DEFAULT_PARTICLE_AIR_FRICTION;
33 _emitter[e].gravity = DEFAULT_PARTICLE_GRAVITY;32 _emitter[e].gravity = 0.0f;
34 _emitter[e].jitter = 0.0f;33 _emitter[e].jitter = 0.0f;
35 _emitter[e].emitterAttraction = 0.0f;34 _emitter[e].emitterAttraction = 0.0f;
36 _emitter[e].tornadoForce = 0.0f;35 _emitter[e].tornadoForce = 0.0f;
@@ -56,11 +55,20 @@ ParticleSystem::ParticleSystem() { · 19 unmodified lines
56 55
57 56
58int ParticleSystem::addEmitter() {57int ParticleSystem::addEmitter() {
58
59 printf( "\n" );
60 printf( "ParticleSystem::addEmitter\n" );
61
59 _numEmitters ++;62 _numEmitters ++;
60 63
61 if (_numEmitters > MAX_EMITTERS) {64 if (_numEmitters > MAX_EMITTERS) {
65
66 printf( "Oops! _numEmitters > MAX_EMITTERS... returning -1\n" );
67
62 return -1;68 return -1;
63 }69 }
70
71 printf( "ok, _numEmitters is %d,and the index of this newly added emitter is %d.\n", _numEmitters, _numEmitters-1 );
64 72
65 return _numEmitters - 1;73 return _numEmitters - 1;
66}74}
@@ -153,13 +161,13 @@ void ParticleSystem::runSpecialEffectsTest(int e, float deltaTime) { · 86 unmodified lines
153 161
154 _timer += deltaTime;162 _timer += deltaTime;
155 163
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 );
157 _emitter[e].airFriction = (DEFAULT_PARTICLE_AIR_FRICTION + 0.5f) + 2.0f * sinf( _timer * 0.32f );165 _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 );166 _emitter[e].jitter = 0.05f + 0.05f * sinf( _timer * 0.42f );
159 _emitter[e].emitterAttraction = 0.015f + 0.015f * cosf( _timer * 0.6f );167 _emitter[e].emitterAttraction = 0.015f + 0.015f * cosf( _timer * 0.6f );
160 _emitter[e].tornadoForce = 0.0f + 0.03f * sinf( _timer * 0.7f );168 _emitter[e].tornadoForce = 0.0f + 0.03f * sinf( _timer * 0.7f );
161 _emitter[e].neighborAttraction = 0.1f + 0.1f * cosf( _timer * 0.8f );169 _emitter[e].neighborAttraction = 0.1f + 0.1f * cosf( _timer * 0.8f );
162 _emitter[e].neighborRepulsion = 0.2f + 0.2f * sinf( _timer * 0.4f );170 _emitter[e].neighborRepulsion = 0.2f + 0.2f * sinf( _timer * 0.4f );
163 171
164 if (_emitter[e].gravity < 0.0f) {172 if (_emitter[e].gravity < 0.0f) {
165 _emitter[e].gravity = 0.0f;173 _emitter[e].gravity = 0.0f;