Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ParticleSystemManager.cpp

Go to the documentation of this file.
00001 
00006 #include "ParticleSystemManager.h"
00007 
00008 using namespace ParticleSystems;
00009 
00010 ParticleSystemManager::ParticleSystemManager(){
00011          numParticleSystems = 0;
00012 }
00013 
00014 
00015 void ParticleSystemManager::addSystem(ParticleSystem *particleSystem) {
00016         //add the system to the psList vector
00017         pSystems.insert(pSystems.begin(), particleSystem);
00018         //increase the number of systems in controlled by the manager
00019         numParticleSystems++;
00020 }
00021 
00022 void ParticleSystemManager::removeSystem(ParticleSystem *particleSystem) {
00023         //find the given Force.
00024         std::vector<ParticleSystem *>::iterator findPS = std::find(pSystems.begin(),pSystems.end(),particleSystem);
00025         //If it matches the last element we know that
00026         //it didnt find the given force.
00027         if(findPS != pSystems.end()) {
00028                 pSystems.erase(findPS);
00029         }
00030 }
00031 
00032 void ParticleSystemManager::reset() {
00033         psListItt itt = pSystems.begin();
00034         psListItt end = pSystems.end();
00035         while(itt != end) {
00036                 (*itt)->die();
00037                 itt++;
00038         }
00039 }
00040 
00041 void ParticleSystemManager::pause() {
00042         psListItt itt = pSystems.begin();
00043         psListItt end = pSystems.end();
00044         while(itt != end) {
00045                 (*itt)->pause();
00046                 itt++;
00047         }
00048 }
00049 
00050 void ParticleSystemManager::restart() {
00051         psListItt itt = pSystems.begin();
00052         psListItt end = pSystems.end();
00053         while(itt != end) {
00054                 (*itt)->restart();
00055                 itt++;
00056         }
00057 }
00058 
00059 void ParticleSystemManager::update() {
00060         //add new particles
00061         psListItt itt = pSystems.begin();
00062         psListItt end = pSystems.end();
00063         
00064     #ifdef __PERFORMANCE__
00065     std::cout << "ParticleSystemManager: Before while->evolve"  << std::endl;
00066     #endif
00067         
00068         while(itt != end) {
00069                 (*itt)->evolve();
00070                 itt++;
00071         }
00072         
00073     #ifdef __PERFORMANCE__
00074     std::cout << "ParticleSystemManager: After while-> evolve"  << std::endl;
00075     #endif
00076         
00077         #ifdef  __PARTICLE_GENERATION__
00078         std::cout << "ParticleSystemManager: "<< dataStrc->size()  << std::endl;
00079         #endif
00080 }
00081 
00082 void ParticleSystemManager::render() {
00083     psListItt itt = pSystems.begin();
00084         psListItt end = pSystems.end();
00085     while(itt != end) {
00086                 //draw each Particle System
00087                 (*itt)->draw();
00088                 itt++;
00089         }
00090 }
00091 
00092 int ParticleSystemManager::getNextID() {
00093         return (numParticleSystems+1);
00094 }
00095 
00096 bool ParticleSystemManager::doesExist(ParticleSystem *particleSystem) {
00097         return true;
00098 }
00099 

Generated on Thu Mar 24 11:05:02 2005 for ParticleSystem by  doxygen 1.4.1