Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2005, 11:27:40 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/movie_player: merged the trunk back into the movie_player
merged with command:
svn merge -r 4014:HEAD ../trunk/ movie_player/
no conflicts

File:
1 edited

Legend:

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

    r3966 r4217  
    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);
     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;
    137139
    138         system->addParticle(this->getAbsCoor(), randDir);
     140            // this should spread the Particles evenly. if the Emitter is moved around quickly
     141            Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt;
     142
     143            system->addParticle(this->getAbsCoor() - equalSpread, velocityV);
     144          }
    139145      }
    140146  }
Note: See TracChangeset for help on using the changeset viewer.