- 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 // class Particle
// ===================================================== // =====================================================
enum State{
sPause, // No updates
sPlay,
sFade // No new particles
};
class Particle { class Particle {
public: public:
//attributes //attributes
@ -90,11 +96,6 @@ public:
}; };
protected: protected:
enum State{
sPause, // No updates
sPlay,
sFade // No new particles
};
protected: protected:

View File

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