From 0ef23749b8439c098a0a69485190891e7bb31013 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 25 Aug 2010 19:46:22 +0000 Subject: [PATCH] - allow non visible particles to fade out when its time to do so --- source/shared_lib/include/graphics/particle.h | 11 ++++++----- source/shared_lib/sources/graphics/particle.cpp | 7 ++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/source/shared_lib/include/graphics/particle.h b/source/shared_lib/include/graphics/particle.h index 0e2ee474..1a8929f5 100644 --- a/source/shared_lib/include/graphics/particle.h +++ b/source/shared_lib/include/graphics/particle.h @@ -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: diff --git a/source/shared_lib/sources/graphics/particle.cpp b/source/shared_lib/sources/graphics/particle.cpp index 518c51b0..434c57ad 100644 --- a/source/shared_lib/sources/graphics/particle.cpp +++ b/source/shared_lib/sources/graphics/particle.cpp @@ -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::iterator it; for (it=particleSystems.begin(); it!=particleSystems.end(); it++) { particleCount += (*it)->getAliveParticleCount(); - //if(renderFps < 0 || renderFps >= MIN_FPS_NORMAL_RENDERING || - // dynamic_cast((*it)) == NULL) { + bool showParticle = true; if( dynamic_cast((*it)) != NULL || dynamic_cast((*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);