Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3943 in orxonox.OLD for orxonox/branches/particleEngine/src


Ignore:
Timestamp:
Apr 23, 2005, 2:05:17 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: now the ParticleSystem/Emitter should get deleted nicely

Location:
orxonox/branches/particleEngine/src/lib/graphics/particles
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc

    r3938 r3943  
    110110bool ParticleEngine::removeSystem(ParticleSystem* system)
    111111{
     112  // remove any connections, that have this system within
     113  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
     114  ParticleConnection* tmpConnection = tmpConIt->nextElement();
     115  while(tmpConnection)
     116    {
     117      if (tmpConnection->system == system)
     118        this->breakConnection(tmpConnection);
     119      tmpConnection = tmpConIt->nextElement();
     120    }
     121  delete tmpConIt;
     122
     123  // remove the System from the systemList.
    112124  this->systemList->remove(system);
    113125}
     
    115127bool ParticleEngine::removeEmitter(ParticleEmitter* emitter)
    116128{
     129  // remove any connections, that have this emitter within
     130  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
     131  ParticleConnection* tmpConnection = tmpConIt->nextElement();
     132  while(tmpConnection)
     133    {
     134      if (tmpConnection->emitter == emitter)
     135        this->breakConnection(tmpConnection);
     136      tmpConnection = tmpConIt->nextElement();
     137    }
     138  delete tmpConIt;
     139
     140  // remove the emitter from the emitterList
    117141  this->emitterList->remove(emitter);
     142}
     143
     144
     145bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
     146{
     147  // look, if we have already added this connection
     148  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
     149  ParticleConnection* tmpConnection = tmpConIt->nextElement();
     150  while(tmpConnection)
     151    {
     152      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
     153        this->breakConnection(tmpConnection);
     154      tmpConnection = tmpConIt->nextElement();
     155    }
     156  delete tmpConIt; 
     157}
     158
     159bool ParticleEngine::breakConnection(ParticleConnection* connection)
     160{
     161  this->connectionList->remove(connection);
    118162}
    119163
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.h

    r3932 r3943  
    3636  bool removeSystem(ParticleSystem* system);
    3737  bool removeEmitter(ParticleEmitter* emitter);
    38   bool breakConection(ParticleEmitter* emitter, ParticleSystem* system);
     38  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
     39  bool breakConnection(ParticleConnection* connection);
    3940
    4041 private:
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3942 r3943  
    8989  glEnd();
    9090  glEndList();
    91 
    92  
    93 
    9491}
    9592
Note: See TracChangeset for help on using the changeset viewer.