Showing the changes to interface/src/ParticleSystem.cpp (1 of 6 files). Show all
Unified · Split
| @@ -25,19 +25,19 @@ ParticleSystem::ParticleSystem() { · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | for (unsigned int emitterIndex = 0; emitterIndex < MAX_EMITTERS; emitterIndex++) { |
| 27 | 27 | |
| 28 | − Emitter e = _emitter[emitterIndex]; | |
| 28 | + Emitter * e = &_emitter[emitterIndex]; | |
| 29 | 29 | |
| 30 | − e.position = glm::vec3(0.0f, 0.0f, 0.0f); | |
| 31 | − e.direction = glm::vec3(0.0f, 1.0f, 0.0f); | |
| 32 | − e.visible = false; | |
| 33 | − e.particleResolution = DEFAULT_PARTICLE_SPHERE_RESOLUTION; | |
| 34 | − e.particleLifespan = DEFAULT_PARTICLE_LIFESPAN; | |
| 35 | − e.showingBaseParticle = false; | |
| 36 | − e.emitReserve = 0.0; | |
| 37 | − e.thrust = 0.0f; | |
| 38 | − e.rate = 0.0f; | |
| 39 | − e.currentParticle = 0; | |
| 40 | − e.particleRenderStyle = PARTICLE_RENDER_STYLE_SPHERE; | |
| 30 | + e->position = glm::vec3(0.0f, 0.0f, 0.0f); | |
| 31 | + e->direction = glm::vec3(0.0f, 1.0f, 0.0f); | |
| 32 | + e->visible = false; | |
| 33 | + e->particleResolution = DEFAULT_PARTICLE_SPHERE_RESOLUTION; | |
| 34 | + e->particleLifespan = DEFAULT_PARTICLE_LIFESPAN; | |
| 35 | + e->showingBaseParticle = false; | |
| 36 | + e->emitReserve = 0.0; | |
| 37 | + e->thrust = 0.0f; | |
| 38 | + e->rate = 0.0f; | |
| 39 | + e->currentParticle = 0; | |
| 40 | + e->particleRenderStyle = PARTICLE_RENDER_STYLE_SPHERE; | |
| 41 | 41 | |
| 42 | 42 | for (int lifeStage = 0; lifeStage<NUM_PARTICLE_LIFE_STAGES; lifeStage++) { |
| 43 | 43 | |
| @@ -102,8 +102,9 @@ void ParticleSystem::simulate(float deltaTime) { · 58 unmodified lines | ||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // update particles |
| 105 | + | |
| 105 | 106 | for (unsigned int p = 0; p < _numParticles; p++) { |
| 106 | − if (_particle[p].alive) { | |
| 107 | + if (_particle[p].alive) { | |
| 107 | 108 | if (_particle[p].age > _emitter[_particle[p].emitterIndex].particleLifespan) { |
| 108 | 109 | killParticle(p); |
| 109 | 110 | } else { |
| @@ -319,12 +320,12 @@ void ParticleSystem::render() { · 209 unmodified lines | ||
| 319 | 320 | } |
| 320 | 321 | }; |
| 321 | 322 | |
| 322 | − // render the particles | |
| 323 | + // render the particles | |
| 323 | 324 | for (unsigned int p = 0; p < _numParticles; p++) { |
| 324 | 325 | if (_particle[p].alive) { |
| 325 | 326 | if (_emitter[_particle[p].emitterIndex].particleLifespan > 0.0) { |
| 326 | 327 | renderParticle(p); |
| 327 | − } | |
| 328 | + } | |
| 328 | 329 | } |
| 329 | 330 | } |
| 330 | 331 | } |
| @@ -363,8 +364,8 @@ void ParticleSystem::renderParticle(int p) { · 32 unmodified lines | ||
| 363 | 364 | } else if (_emitter[_particle[p].emitterIndex].particleRenderStyle == PARTICLE_RENDER_STYLE_SPHERE) { |
| 364 | 365 | |
| 365 | 366 | glPushMatrix(); |
| 366 | − glTranslatef(_particle[p].position.x, _particle[p].position.y, _particle[p].position.z); | |
| 367 | − glutSolidSphere(_particle[p].radius, _emitter[_particle[p].emitterIndex].particleResolution, _emitter[_particle[p].emitterIndex].particleResolution); | |
| 367 | + glTranslatef(_particle[p].position.x, _particle[p].position.y, _particle[p].position.z); | |
| 368 | + glutSolidSphere(_particle[p].radius, _emitter[_particle[p].emitterIndex].particleResolution, _emitter[_particle[p].emitterIndex].particleResolution); | |
| 368 | 369 | glPopMatrix(); |
| 369 | 370 | |
| 370 | 371 | } else if (_emitter[_particle[p].emitterIndex].particleRenderStyle == PARTICLE_RENDER_STYLE_RIBBON) { |