Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5445 in orxonox.OLD for trunk/src/lib/particles


Ignore:
Timestamp:
Oct 29, 2005, 11:08:08 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Connection-Removing in the Particle-Class

Location:
trunk/src/lib/particles
Files:
4 edited

Legend:

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

    r5357 r5445  
    5454  this->init();
    5555
    56    if (root)
     56   if (root != NULL)
    5757     this->loadParams(root);
    5858
  • trunk/src/lib/particles/particle_engine.cc

    r5439 r5445  
    5151ParticleEngine::~ParticleEngine ()
    5252{
    53   // we must not do this, because PNoe does it for us
    54   // or we do this with help from ClassList, which essentially makes much more sense
     53  /// @todo we must not do this, because PNoe does it for us
     54  /// or we do this with help from ClassList, which essentially makes much more sense
     55
    5556  // delete all remaining systems
    5657//   tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
     
    6465   delete this->systemList;
    6566//
    66 //   // delete all remaining emitters
    67 //   tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
    68 //   ParticleEmitter* tmpEmit = emitIt->firstElement();
    69 //   while(tmpEmit)
    70 //     {
    71 //       delete tmpEmit;
    72 //       tmpEmit = emitIt->nextElement();
    73 //     }
    74 //   delete emitIt;
     67   // delete all remaining emitters
     68   tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
     69   ParticleEmitter* tmpEmit = emitIt->firstElement();
     70   while(tmpEmit)
     71     {
     72       delete tmpEmit;
     73       tmpEmit = emitIt->nextElement();
     74     }
     75   delete emitIt;
    7576   delete this->emitterList;
    7677
     
    119120}
    120121
     122#include "class_list.h"
    121123/**
    122124* @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
     
    126128void ParticleEngine::addConnection(const char* emitter, const char* system)
    127129{
    128   ParticleEmitter* tmpEmit = this->getEmitterByName(emitter);
    129   ParticleSystem* tmpSys = this->getSystemByName(system);
     130  ParticleEmitter* tmpEmit = dynamic_cast<ParticleEmitter*>(ClassList::getObject(emitter, CL_PARTICLE_EMITTER));//this->getEmitterByName(emitter);
     131  ParticleSystem* tmpSys = dynamic_cast<ParticleSystem*>(ClassList::getObject(system, CL_PARTICLE_SYSTEM));//this->getSystemByName(system);
    130132
    131133  if (tmpEmit != NULL && tmpSys != NULL)
     
    154156      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
    155157        {
    156           PRINTF(2)("Connection between Emitter and System already added\n");
     158          PRINTF(2)("Connection between Emitter and System already exists.\n");
    157159          delete tmpConIt;
    158160          return;
     
    181183  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    182184  ParticleConnection* tmpConnection = tmpConIt->firstElement();
    183   while(tmpConnection)
     185  while(tmpConnection != NULL)
    184186    {
    185187      if (tmpConnection->system == system)
     
    202204  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    203205  ParticleConnection* tmpConnection = tmpConIt->firstElement();
    204   while(tmpConnection)
     206  while(tmpConnection != NULL)
    205207    {
    206208      if (tmpConnection->emitter == emitter)
     
    298300
    299301/**
    300  * @param systemName the name of the system to search for
    301  * @returns the system called by systemName or NULL if not found
    302 */
    303 ParticleSystem* ParticleEngine::getSystemByName(const char* systemName) const
    304 {
    305   tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
    306   ParticleSystem* tmpSys = tmpIt->firstElement();
    307   while(tmpSys)
    308     {
    309       if (!strcmp(systemName, tmpSys->getName()))
    310         {
    311           delete tmpIt;
    312           return tmpSys;
    313         }
    314       tmpSys = tmpIt->nextElement();
    315     }
    316   delete tmpIt;
    317   return NULL;
    318 }
    319 
    320 /**
    321302 * @param number the n-th system to return
    322303 * @returns the system called by number or NULL if not found
     
    342323
    343324/**
    344  * @param emitterName the name of the emitter to search for
    345  * @returns the emitter called by emitterName or NULL if not found
    346 */
    347 ParticleEmitter* ParticleEngine::getEmitterByName(const char* emitterName) const
    348 {
    349   tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
    350   ParticleEmitter* tmpEmit = tmpIt->firstElement();
    351   while(tmpEmit)
    352     {
    353       if (!strcmp(emitterName, tmpEmit->getName()))
    354         {
    355           delete tmpIt;
    356           return tmpEmit;
    357         }
    358       tmpEmit = tmpIt->nextElement();
    359     }
    360   delete tmpIt;
    361   return NULL;
    362 }
    363 
    364 
    365 /**
    366325 * @param number the n-th emitter to return
    367326 * @returns the emitter called by number or NULL if not found
  • trunk/src/lib/particles/particle_engine.h

    r5405 r5445  
    5353  bool breakConnection(ParticleConnection* connection);
    5454
    55   ParticleSystem* getSystemByName(const char* systemName) const;
    56   ParticleSystem* getSystemByNumber(unsigned int number) const;
    57   ParticleEmitter* getEmitterByName(const char* emitterName) const;
    58   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
     55   ParticleSystem* getSystemByNumber(unsigned int number) const;
     56   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
    5957
    6058  void debug();
  • trunk/src/lib/particles/particle_system.cc

    r5357 r5445  
    4949
    5050/**
    51   \brief creates a Particle System out of a XML-element
    52 * @param root: the XML-element to load from
     51 * @brief creates a Particle System out of a XML-element
     52 * @param root: the XML-element to load from
    5353 */
    5454ParticleSystem::ParticleSystem(const TiXmlElement* root)
     
    198198      case PARTICLE_SPRITE:
    199199        this->material = new Material("transperencyMap");
    200         this->material->setDiffuseMap("pictures/radialTransparency.png");
     200        this->material->setDiffuseMap("maps/radialTransparency.png");
    201201      //  material->setTransparency(.5);
    202202        break;
Note: See TracChangeset for help on using the changeset viewer.