Changeset 3950 in orxonox.OLD for orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
- Timestamp:
- Apr 24, 2005, 11:32:48 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
r3944 r3950 120 120 void ParticleEmitter::tick(float dt, ParticleSystem* system) 121 121 { 122 // saving the time 123 float count = (dt+this->saveTime) * this->emissionRate; 124 this->saveTime = modff(count, &count); 125 this->saveTime /= this->emissionRate; 126 127 128 for (int i = 0; i <= count; i++) 129 // emmits from EMITTER_DOT, 130 { 131 Vector randDir = Vector(random()-RAND_MAX/2, random()-RAND_MAX/2, random()-RAND_MAX/2); 132 randDir.normalize(); 133 randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)random()/RAND_MAX -.5), randDir)).apply(this->direction); 134 randDir = *randDir.getNormalized() + (this->getVelocity() * system->inheritSpeed); 135 136 system->addParticle(this->getAbsCoor(), randDir* velocity); 137 } 122 if (likely(dt > 0.0 && this->emissionRate > 0.0)) 123 { 124 // saving the time 125 float count = (dt+this->saveTime) * this->emissionRate; 126 this->saveTime = modff(count, &count); 127 this->saveTime /= this->emissionRate; 128 PRINTF(5)("emitting %f particles, saving %f seconds for the next round\n", count, this->saveTime); 129 130 for (int i = 0; i < count; i++) 131 // emmits from EMITTER_DOT, 132 { 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() + (this->getVelocity() * system->inheritSpeed); 137 138 system->addParticle(this->getAbsCoor(), randDir* velocity); 139 } 140 } 138 141 } 139 142
Note: See TracChangeset
for help on using the changeset viewer.