Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2005, 10:49:05 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged particleSystem back into the Trunk
merged with command:
svn merge particleEngine/ ../trunk/ -r 3966:HEAD
U ../trunk/src/lib/graphics/particles/particle_emitter.cc
U ../trunk/src/lib/graphics/particles/particle_system.cc
U ../trunk/src/lib/graphics/particles/particle_system.h

as you can see, no conflicts

File:
1 edited

Legend:

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

    r3966 r4017  
    124124    // saving the time
    125125    float count = (dt+this->saveTime) * this->emissionRate;
    126     this->saveTime = modff(count, &count);
    127     this->saveTime /= this->emissionRate;
     126    this->saveTime = modff(count, &count) / this->emissionRate;
    128127    PRINTF(5)("emitting %f particles, saving %f seconds for the next round\n", count, this->saveTime);
    129128   
    130     for (int i = 0; i < count; i++)
    131       // emmits from EMITTER_DOT,
     129    if (likely(count > 0))
    132130      {
    133         Vector randDir = Vector(random()-RAND_MAX/2, random()-RAND_MAX/2, random()-RAND_MAX/2);
    134         randDir.normalize();
    135         randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)random()/RAND_MAX -.5), randDir)).apply(this->direction);
    136         randDir = randDir.getNormalized()*velocity + (this->getVelocity() * system->inheritSpeed);
    137 
    138         system->addParticle(this->getAbsCoor(), randDir);
     131        Vector inheritVelocity = this->getVelocity() * system->inheritSpeed;
     132        for (int i = 0; i < count; i++)
     133          // emmits from EMITTER_DOT,
     134          {
     135            Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
     136            randDir.normalize();
     137            randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->direction);
     138            Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
     139           
     140            system->addParticle(this->getAbsCoor(), velocityV);
     141          }
    139142      }
    140143  }
Note: See TracChangeset for help on using the changeset viewer.