- allow non visible particles to fade out when its time to do so

This commit is contained in:
Mark Vejvoda 2010-08-25 19:46:22 +00:00
parent 3ee7fc902c
commit 0ef23749b8
2 changed files with 8 additions and 10 deletions

View File

@ -40,6 +40,12 @@ class Model;
// class Particle
// =====================================================
enum State{
sPause, // No updates
sPlay,
sFade // No new particles
};
class Particle {
public:
//attributes
@ -90,11 +96,6 @@ public:
};
protected:
enum State{
sPause, // No updates
sPlay,
sFade // No new particles
};
protected:

View File

@ -918,18 +918,16 @@ void ParticleManager::update(int renderFps) {
Chrono chrono;
chrono.start();
//const int MIN_FPS_NORMAL_RENDERING = 10;
int particleSystemCount = particleSystems.size();
int particleCount = 0;
list<ParticleSystem*>::iterator it;
for (it=particleSystems.begin(); it!=particleSystems.end(); it++) {
particleCount += (*it)->getAliveParticleCount();
//if(renderFps < 0 || renderFps >= MIN_FPS_NORMAL_RENDERING ||
// dynamic_cast<UnitParticleSystem *>((*it)) == NULL) {
bool showParticle = true;
if( dynamic_cast<UnitParticleSystem *>((*it)) != NULL ||
dynamic_cast<FireParticleSystem *>((*it)) != NULL ) {
showParticle = (*it)->getVisible();
showParticle = (*it)->getVisible() || ((*it)->getState() == sFade);
}
if(showParticle == true) {
(*it)->update();
@ -938,7 +936,6 @@ void ParticleManager::update(int renderFps) {
*it= NULL;
}
}
//}
}
particleSystems.remove(NULL);