Changeset 3950 in orxonox.OLD for orxonox/branches/particleEngine/src/lib
- Timestamp:
- Apr 24, 2005, 11:32:48 PM (20 years ago)
- Location:
- orxonox/branches/particleEngine/src/lib/graphics/particles
- Files:
-
- 2 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 -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.h
r3944 r3950 22 22 23 23 public: 24 ParticleEmitter(const Vector& direction, float angle = .5, float emissionRate = 1.0, 24 ParticleEmitter(const Vector& direction, float angle = .5, float emissionRate = 1.0, 25 25 float velocity = 1.0); 26 26 virtual ~ParticleEmitter(void);
Note: See TracChangeset
for help on using the changeset viewer.