Changeset 4017 in orxonox.OLD for orxonox/trunk/src/lib/graphics/particles/particle_emitter.cc
- Timestamp:
- May 2, 2005, 10:49:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/particles/particle_emitter.cc
r3966 r4017 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); 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 } 139 142 } 140 143 }
Note: See TracChangeset
for help on using the changeset viewer.