Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 23, 2005, 3:30:45 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: spread works, and many other functions implemented

File:
1 edited

Legend:

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

    r3934 r3935  
    4040   this->particleType = type;
    4141   this->particles = NULL;
    42    this->conserve = 1.0;
     42   this->setConserve(.8);
    4343   this->setLifeSpan(.1);
    4444
     
    5454{
    5555  // delete what has to be deleted here
     56   ParticleEngine::getInstance()->removeSystem(this);
    5657}
    5758
     
    5960void ParticleSystem::setMaterial(Material* material)
    6061{
    61  
     62  this->material = material;
    6263}
    6364
     
    7071void ParticleSystem::setRadius(float startRadius, float endRadius, float randomRadius)
    7172{
    72 
     73  this->startRadius = startRadius;
     74  this->endRadius = endRadius;
     75  this->randomRadius = randomRadius;
    7376}
    7477
    7578void ParticleSystem::setConserve(float conserve)
    7679{
    77   this->conserve = conserve;
     80  if (conserve > 1.0)
     81    this->conserve = 1.0;
     82  else if (conserve < 0.0)
     83    this->conserve = 0.0;
     84  else
     85    this->conserve = conserve;
    7886}
    7987
     
    8694  while (likely(tickPart != NULL))
    8795    {
    88          
     96     
    8997      tickPart->position = tickPart->position + tickPart->velocity;
    9098      // many more to come
     
    94102
    95103
    96 
     104      if (this->conserve < 1.0)
     105        tickPart->velocity = tickPart->velocity * this->conserve;
    97106      // find out if we have to delete tickPart
    98107      if ((tickPart->timeToLive -= dt) <= 0)
     
    113122            }
    114123          --this->count;
    115           printf("deleted particle: count %d\n", count);
    116124        }
    117125      else
     
    128136  if (likely(drawPart != NULL))
    129137    {
    130       glBegin(GL_TRIANGLES);
     138      glBegin(GL_POINTS);
    131139      while (likely(drawPart != NULL))
    132140        {
Note: See TracChangeset for help on using the changeset viewer.