Changeset 4217 in orxonox.OLD for orxonox/branches/movie_player/src/lib/graphics/particles/particle_emitter.cc
- Timestamp:
- May 18, 2005, 11:27:40 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/movie_player/src/lib/graphics/particles/particle_emitter.cc
r3966 r4217 124 124 // saving the time 125 125 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; 128 127 PRINTF(5)("emitting %f particles, saving %f seconds for the next round\n", count, this->saveTime); 129 128 130 for (int i = 0; i < count; i++) 131 // emmits from EMITTER_DOT, 129 if (likely(count > 0)) 132 130 { 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; 137 139 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 } 139 145 } 140 146 }
Note: See TracChangeset
for help on using the changeset viewer.