Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6612 in orxonox.OLD for trunk/src/lib/particles/particle_system.cc


Ignore:
Timestamp:
Jan 19, 2006, 1:50:39 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: particle_system is now loaded differently

ParticleEngine is NOT needed anymore, this is faster and better

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/particles/particle_system.cc

    r6512 r6612  
    3131
    3232#include "parser/tinyxml/tinyxml.h"
     33#include <algorithm>
     34
    3335
    3436CREATE_FACTORY(ParticleSystem, CL_PARTICLE_SYSTEM);
     
    107109  this->setType(PARTICLE_DEFAULT_TYPE, 1);
    108110  ParticleEngine::getInstance()->addSystem(this);
     111
     112  this->toList(OM_ENVIRON);
    109113}
    110114
     
    132136
    133137  LoadParam(root, "texture", this, ParticleSystem, setMaterialTexture);
     138  LoadParamXML(root, "emitter", this, ParticleSystem, addEmitterXML);
    134139
    135140  LOAD_PARAM_START_CYCLE(root, element);
     
    147152  }
    148153  LOAD_PARAM_END_CYCLE(element);
    149 
    150154}
    151155
     
    288292  this->colorAnim[2].changeEntry(lifeCycleTime, blue);
    289293  this->colorAnim[3].changeEntry(lifeCycleTime, alpha);
     294}
     295
     296
     297void ParticleSystem::addEmitter(ParticleEmitter* emitter)
     298{
     299  this->emitters.push_back(emitter);
     300}
     301
     302void ParticleSystem::addEmitterXML(const TiXmlElement* emitterRoot)
     303{
     304  ParticleEmitter* emitter = new ParticleEmitter(emitterRoot);
     305  this->addEmitter(emitter);
     306}
     307
     308
     309void ParticleSystem::removeEmitter(ParticleEmitter* emitter)
     310{
     311  std::list<ParticleEmitter*>::iterator it = std::find(this->emitters.begin(), this->emitters.end(), emitter);
     312  if (it != this->emitters.end())
     313    this->emitters.erase(it);
    290314}
    291315
     
    357381        }
    358382    }
     383
     384    std::list<ParticleEmitter*>::iterator emitter;
     385    for (emitter = this->emitters.begin(); emitter != this->emitters.end(); emitter++)
     386      (*emitter)->tick(dt, this);
    359387}
    360388
Note: See TracChangeset for help on using the changeset viewer.