Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 29, 2005, 1:14:24 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Explosions on Collision (—HACK—)
also made the FastFactory faster, not turning through the GarbageCollector, as it is not necessary. FastFactory also implements a Static Memeber subscriptor-Macro now
last but not least: new Functions in The ParticleEngine, and some revisited

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

Legend:

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

    r5445 r5447  
    1818#include "particle_engine.h"
    1919
    20 #include "particle_system.h"
    21 #include "particle_emitter.h"
     20#include "class_list.h"
    2221
    2322#include "list.h"
     
    120119}
    121120
    122 #include "class_list.h"
    123121/**
    124122* @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
     
    216214}
    217215
     216
     217/**
     218 *  removes a Connection between an Emitter and a System
     219 * @param connection the connection to remove
     220 *
     221 * \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
     222 */
     223bool ParticleEngine::breakConnection(ParticleConnection* connection)
     224{
     225  this->connectionList->remove(connection);
     226  return true;
     227}
     228
    218229/**
    219230 *  removes a Connection between an Emitter and a System
     
    221232 * @param system The system of the connection to remove
    222233 * @returns true, if the connection was broken, false if the conntection was not found
    223 
    224    only if both system and emitter are in the connection the Connection will be broken
     234 *
     235 * only if both system and emitter are in the connection the Connection will be broken
    225236*/
    226237bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
     
    245256/**
    246257 *  removes a Connection between an Emitter and a System
    247  * @param connection the connection to remove
    248 
    249    \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
    250 */
    251 bool ParticleEngine::breakConnection(ParticleConnection* connection)
    252 {
    253   this->connectionList->remove(connection);
    254   return true;
    255 }
    256 
     258 * @param emitter The emitter of the connections to remove
     259 * @returns the count of connections that were broken, 0 if no conntection was not found
     260 */
     261unsigned int ParticleEngine::breakConnections(ParticleEmitter* emitter)
     262{
     263  unsigned int retVal = 0;
     264  // look, if we have already added this connection
     265  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
     266  ParticleConnection* tmpConnection = tmpConIt->firstElement();
     267  while(tmpConnection)
     268  {
     269    if (tmpConnection->emitter == emitter)
     270    {
     271      this->breakConnection(tmpConnection);
     272      retVal++;
     273    }
     274    tmpConnection = tmpConIt->nextElement();
     275  }
     276  delete tmpConIt;
     277  return retVal;
     278}
     279
     280
     281/**
     282 *  removes a Connection between an Emitter and a System
     283 * @param system The system of the connections to remove
     284 * @returns the count of connections that were broken, 0 if no conntection was not found
     285 */
     286unsigned int ParticleEngine::breakConnections(ParticleSystem* system)
     287{
     288  unsigned int retVal = 0;
     289  // look, if we have already added this connection
     290  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
     291  ParticleConnection* tmpConnection = tmpConIt->firstElement();
     292  while(tmpConnection)
     293  {
     294    if (tmpConnection->system == system)
     295    {
     296      this->breakConnection(tmpConnection);
     297      retVal++;
     298    }
     299    tmpConnection = tmpConIt->nextElement();
     300  }
     301  delete tmpConIt;
     302  return retVal;
     303}
    257304
    258305/**
     
    406453
    407454}
     455
  • trunk/src/lib/particles/particle_engine.h

    r5445 r5447  
    5050  bool removeSystem(ParticleSystem* system);
    5151  bool removeEmitter(ParticleEmitter* emitter);
     52  bool breakConnection(ParticleConnection* connection);
    5253  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
    53   bool breakConnection(ParticleConnection* connection);
     54  unsigned int breakConnections(ParticleEmitter* emitter);
     55  unsigned int breakConnections(ParticleSystem* system);
    5456
    5557   ParticleSystem* getSystemByNumber(unsigned int number) const;
Note: See TracChangeset for help on using the changeset viewer.