Showing the changes to interface/src/ParticleSystem.cpp (1 of 2 files). Show all
Unified · Split
| @@ -80,9 +80,7 @@ void ParticleSystem::simulate(float deltaTime) { · 79 unmodified lines | |||
| 80 | assert(_emitter[e].rate >= 0); | 80 | assert(_emitter[e].rate >= 0); |
| 81 | 81 | ||
| 82 | _emitter[e].emitReserve += _emitter[e].rate * deltaTime; | 82 | _emitter[e].emitReserve += _emitter[e].rate * deltaTime; |
| 83 | |||
| 84 | _emitter[e].numParticlesEmittedThisTime = (int)_emitter[e].emitReserve; | 83 | _emitter[e].numParticlesEmittedThisTime = (int)_emitter[e].emitReserve; |
| 85 | |||
| 86 | _emitter[e].emitReserve -= _emitter[e].numParticlesEmittedThisTime; | 84 | _emitter[e].emitReserve -= _emitter[e].numParticlesEmittedThisTime; |
| 87 | 85 | ||
| 88 | for (int p = 0; p < _emitter[e].numParticlesEmittedThisTime; p++) { | 86 | for (int p = 0; p < _emitter[e].numParticlesEmittedThisTime; p++) { |
| @@ -114,8 +112,8 @@ void ParticleSystem::createParticle(int e, float timeFraction) { · 25 unmodified lines | |||
| 114 | _particle[p].age = 0.0f; | 112 | _particle[p].age = 0.0f; |
| 115 | _particle[p].velocity = _emitter[e].direction * _emitter[e].thrust; | 113 | _particle[p].velocity = _emitter[e].direction * _emitter[e].thrust; |
| 116 | _particle[p].position = _emitter[e].previousPosition + timeFraction * (_emitter[e].position - _emitter[e].previousPosition); | 114 | _particle[p].position = _emitter[e].previousPosition + timeFraction * (_emitter[e].position - _emitter[e].previousPosition); |
| 117 | _particle[p].radius = _emitter[e].particleAttributes[0].radius; | 115 | _particle[p].radius = _emitter[e].particleAttributes[PARTICLE_LIFESTAGE_0].radius; |
| 118 | _particle[p].color = _emitter[e].particleAttributes[0].color; | 116 | _particle[p].color = _emitter[e].particleAttributes[PARTICLE_LIFESTAGE_0].color; |
| 119 | _particle[p].previousParticle = NULL_PARTICLE; | 117 | _particle[p].previousParticle = NULL_PARTICLE; |
| 120 | 118 | ||
| 121 | if (_particle[_emitter[e].currentParticle].alive) { | 119 | if (_particle[_emitter[e].currentParticle].alive) { |
| @@ -142,6 +140,8 @@ void ParticleSystem::killParticle(int p) { · 20 unmodified lines | |||
| 142 | _particle[p].velocity = glm::vec3(0.0f, 0.0f, 0.0f); | 140 | _particle[p].velocity = glm::vec3(0.0f, 0.0f, 0.0f); |
| 143 | _particle[p].age = 0.0f; | 141 | _particle[p].age = 0.0f; |
| 144 | _particle[p].emitterIndex = NULL_PARTICLE; | 142 | _particle[p].emitterIndex = NULL_PARTICLE; |
| 143 | _particle[p].color = glm::vec4(0.0f, 0.0f, 0.0f, 0.0f); | ||
| 144 | _particle[p].radius = 0.0f; | ||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | 147 | ||