Changeset 3950 in orxonox.OLD for orxonox/branches/particleEngine/src
- Timestamp:
- Apr 24, 2005, 11:32:48 PM (20 years ago)
- Location:
- orxonox/branches/particleEngine/src
- Files:
-
- 3 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); -
orxonox/branches/particleEngine/src/story_entities/world.cc
r3949 r3950 380 380 ParticleEmitter* testEmitter,* testEmitter2; 381 381 ParticleSystem* testSystem; 382 testEmitter = new ParticleEmitter(Vector(-1,0,0), .4, 120.0, .5);382 testEmitter = new ParticleEmitter(Vector(-1,0,0), .4, 60.0, 0); 383 383 testEmitter->setParent(localPlayer); 384 384 testEmitter->setRelCoor(Vector(-3, 0, 0)); … … 390 390 */ 391 391 testSystem = new ParticleSystem(10000); 392 testSystem->setLifeSpan( .3, .2);392 testSystem->setLifeSpan(1, .2); 393 393 testSystem->setRadius(3.0, 0.0, .5); 394 394 testSystem->setConserve(.8);
Note: See TracChangeset
for help on using the changeset viewer.