Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3945 in orxonox.OLD


Ignore:
Timestamp:
Apr 24, 2005, 4:06:58 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: doxyTags, and some rearanging

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

Legend:

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

    r3944 r3945  
    5353
    5454/**
    55    \brief standard destructor
    56 
     55   \brief deletes all the system, emitters, connections and Lists
    5756*/
    5857ParticleEngine::~ParticleEngine ()
    5958{
     59  // delete all remaining systems
     60  tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
     61  ParticleSystem* tmpSys = sysIt->nextElement();
     62  while(tmpSys)
     63    {
     64      delete tmpSys;
     65      tmpSys = sysIt->nextElement();
     66    }
     67  delete sysIt;
    6068  delete this->systemList;
    6169
    62   delete this->connectionList;
     70  // delete all remaining emitters
     71  tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
     72  ParticleEmitter* tmpEmit = emitIt->nextElement();
     73  while(tmpEmit)
     74    {
     75      delete tmpEmit;
     76      tmpEmit = emitIt->nextElement();
     77    }
     78  delete emitIt;
     79  delete this->emitterList;
     80
     81  // there should be no more Connections
     82  if (this->connectionList->getSize() == 0)
     83    delete this->connectionList;
     84  else
     85    PRINTF(2)("The Connection List is not empty. This should not happen.\n");
    6386
    6487  ParticleEngine::singletonRef = NULL;
    6588}
    6689
     90/**
     91   \brief Adds a System to the System list.
     92
     93   this is done automatically when creating a ParticleSystem
     94*/
    6795void ParticleEngine::addSystem(ParticleSystem* system)
    6896{
     
    7098}
    7199
     100/**
     101   \brief Adds an emitter to the emitterList
     102
     103   this is done automatically when creating a ParticleEmitter
     104*/
    72105void ParticleEngine::addEmitter(ParticleEmitter* emitter)
    73106{
     
    76109
    77110/**
    78    \brief
    79 
    80    \todo header, check for double connections
     111   \brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
     112   \param emitter the Emitter to connect to the System
     113   \param system the System to connect to the Emitter
    81114*/
    82115void ParticleEngine::addConnection(ParticleEmitter* emitter, ParticleSystem* system)
     
    107140}
    108141
    109 
     142/**
     143   \brief Removes a system from the systemList and also removes all Connections to the System
     144   \param system The ParticleSystem to delete
     145*/
    110146bool ParticleEngine::removeSystem(ParticleSystem* system)
    111147{
     
    125161}
    126162
     163/**
     164   \brief removes an emitter from the emitterList and also from all Connections it is attached to.
     165   \param emitter the ParticleEmitter to remove.
     166*/
    127167bool ParticleEngine::removeEmitter(ParticleEmitter* emitter)
    128168{
     
    142182}
    143183
    144 
     184/**
     185   \brief removes a Connection between an Emitter and a System
     186   \param emitter The emitter of the connection to remove
     187   \param system The system of the connection to remove
     188   \returns true, if the connection was broken, false if the conntection was not found
     189
     190   only if both system and emitter are in the connection the Connection will be broken
     191*/
    145192bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
    146193{
     
    150197  while(tmpConnection)
    151198    {
    152       if (tmpConnection->emitter == emitter && tmpConnection->system == system)
     199    if (tmpConnection->emitter == emitter && tmpConnection->system == system)
     200      {
    153201        this->breakConnection(tmpConnection);
    154       tmpConnection = tmpConIt->nextElement();
    155     }
    156   delete tmpConIt; 
    157 }
    158 
     202        delete tmpConIt;
     203        return true;
     204      }
     205    tmpConnection = tmpConIt->nextElement();
     206    }
     207  delete tmpConIt;
     208  return false;
     209}
     210
     211/**
     212   \brief removes a Connection between an Emitter and a System
     213   \param connection the connection to remove
     214
     215   \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
     216*/
    159217bool ParticleEngine::breakConnection(ParticleConnection* connection)
    160218{
    161219  this->connectionList->remove(connection);
     220  return true;
    162221}
    163222
     
    169228void ParticleEngine::tick(float dt)
    170229{
    171   // add new Particles to each System they are connected to.
     230  // add new Particles to each System connected to an Emitter.
    172231  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    173232  ParticleConnection* tmpConnection = tmpConIt->nextElement();
     
    191250}
    192251
    193 
     252/**
     253   \brief draws all the systems and their Particles.
     254*/
    194255void ParticleEngine::draw(void)
    195256{
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3944 r3945  
    5252/**
    5353   \brief standard deconstructor
    54 
    5554*/
    5655ParticleSystem::~ParticleSystem()
     
    6059}
    6160
     61/**
     62   \brief sets the Name of the Particle System
     63   \param name the Name of the System
     64*/
    6265void ParticleSystem::setName(const char* name)
    6366{
     
    6871}
    6972
     73/**
     74   \returns the Name of the ParticleSystem
     75*/
    7076const char* ParticleSystem::getName(void) const
    7177{
     
    7379}
    7480
    75 
     81/**
     82   \todo this will be different
     83*/
    7684void ParticleSystem::setType(PARTICLE_TYPE particleType, int count)
    7785{
     
    93101  glBegin(GL_TRIANGLE_STRIP);
    94102  glTexCoord2f(1, 1);
    95   glVertex3f(0.0, 1.0, 1.0);
     103  glVertex3f(0.0, .5, .5);
    96104  glTexCoord2f(1, 0);
    97   glVertex3f(0.0, 1.0, 0.0);
     105  glVertex3f(0.0, .5, -.5);
    98106  glTexCoord2f(0, 1);
    99   glVertex3f(0.0, 0.0, 1.0);
     107  glVertex3f(0.0, -.5, .5);
    100108  glTexCoord2f(0, 0);
    101   glVertex3f(0.0, 0.0, 0.0);
     109  glVertex3f(0.0, -.5, -.5);
    102110  glEnd();
    103111  glEndList();
     
    130138}
    131139
    132 
     140/**
     141   \brief Sets the lifespan of newly created particles
     142*/   
    133143void ParticleSystem::setLifeSpan(float lifeSpan, float randomLifeSpan)
    134144{
     
    137147}
    138148
     149/**
     150   \brief sets the radius of newly created particles
     151*/
    139152void ParticleSystem::setRadius(float startRadius, float endRadius, float randomStartRadius, float randomEndRadius)
    140153{
     
    145158}
    146159
     160/**
     161   \brief sets the conserve Factor of newly created particles
     162*/
    147163void ParticleSystem::setConserve(float conserve)
    148164{
     
    155171}
    156172
    157 
    158 
     173/**
     174   \brief ticks the system.
     175   \param dt the time to tick all the Particles of the System
     176
     177   this is used to get all the particles some motion
     178*/
    159179void ParticleSystem::tick(float dt)
    160180{
     
    200220}
    201221
     222/**
     223   \brief draws all the Particles of this System
     224*/
    202225void ParticleSystem::draw(void)
    203226{
     
    227250}
    228251
    229 
     252/**
     253   \brief adds a new Particle to the System
     254   \param position the position where the particle gets emitted.
     255   \param velocity the Starting velocity of the particle.
     256   \param data some more data given by the emitter
     257*/
    230258void ParticleSystem::addParticle(Vector position, Vector velocity, unsigned int data)
    231259{
     
    261289}
    262290
    263 
    264291/**
    265292   \brief outputs some nice debug information
Note: See TracChangeset for help on using the changeset viewer.