Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4308 in orxonox.OLD for orxonox/branches/physics/src/lib


Ignore:
Timestamp:
May 26, 2005, 8:44:11 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: particleEngine can now return the stored systems and emitter by name and number

Location:
orxonox/branches/physics/src/lib/graphics/particles
Files:
2 edited

Legend:

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

    r4178 r4308  
    267267
    268268/**
     269   \param systemName the name of the system to search for
     270   \returns the system called by systemName or NULL if not found
     271*/
     272ParticleSystem* ParticleEngine::getSystemByName(const char* systemName) const
     273{
     274  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
     275  ParticleSystem* tmpSys = tmpIt->nextElement();
     276  while(tmpSys)
     277    {
     278      if (!strcmp(systemName, tmpSys->getName()))
     279        {
     280          delete tmpIt;
     281          return tmpSys;
     282        }
     283      tmpSys = tmpIt->nextElement();
     284    }
     285  delete tmpIt;
     286  return NULL;
     287}
     288
     289/**
     290   \param number the n-th system to return
     291   \returns the system called by number or NULL if not found
     292*/
     293ParticleSystem* ParticleEngine::getSystemByNumber(unsigned int number) const
     294{
     295  int count = 0;
     296  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
     297  ParticleSystem* tmpSys = tmpIt->nextElement();
     298  while(tmpSys)
     299    {
     300      count++;
     301      if ( count == number)
     302        {
     303          delete tmpIt;
     304          return tmpSys;
     305        }
     306      tmpSys = tmpIt->nextElement();
     307    }
     308  delete tmpIt;
     309  return NULL;
     310}
     311
     312/**
     313   \param emitterName the name of the emitter to search for
     314   \returns the emitter called by emitterName or NULL if not found
     315*/
     316ParticleEmitter* ParticleEngine::getEmitterByName(const char* emitterName) const
     317{
     318  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
     319  ParticleEmitter* tmpEmit = tmpIt->nextElement();
     320  while(tmpEmit)
     321    {
     322      if (!strcmp(emitterName, tmpEmit->getName()))
     323        {
     324          delete tmpIt;
     325          return tmpEmit;
     326        }
     327      tmpEmit = tmpIt->nextElement();
     328    }
     329  delete tmpIt;
     330  return NULL;
     331}
     332
     333
     334/**
     335   \param number the n-th emitter to return
     336   \returns the emitter called by number or NULL if not found
     337*/
     338ParticleEmitter* ParticleEngine::getEmitterByNumber(unsigned int number) const
     339{
     340  int count = 0;
     341  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
     342  ParticleEmitter* tmpEmit = tmpIt->nextElement();
     343  while(tmpEmit)
     344    {
     345      count++;
     346      if ( count == number)
     347        {
     348          delete tmpIt;
     349          return tmpEmit;
     350        }
     351      tmpEmit = tmpIt->nextElement();
     352    }
     353  delete tmpIt;
     354  return NULL;
     355}
     356
     357/**
    269358   \brief outputs some nice debug information
    270359*/
  • orxonox/branches/physics/src/lib/graphics/particles/particle_engine.h

    r4178 r4308  
    1313// FORWARD DEFINITION
    1414template<class T> class tList;
    15 class ParticleSystem;
    16 class ParticleEmitter;
    1715
    1816struct ParticleConnection
     
    4139  bool breakConnection(ParticleConnection* connection);
    4240
     41  ParticleSystem* getSystemByName(const char* systemName) const;
     42  ParticleSystem* getSystemByNumber(unsigned int number) const;
     43  ParticleEmitter* getEmitterByName(const char* emitterName) const;
     44  ParticleEmitter* getEmitterByNumber(unsigned int number) const;
     45
    4346  void debug();
    4447
Note: See TracChangeset for help on using the changeset viewer.