Changeset 3933 in orxonox.OLD for orxonox/branches/particleEngine/src/lib/graphics
- Timestamp:
- Apr 23, 2005, 1:10:58 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
r3932 r3933 32 32 this->direction = direction; 33 33 this->setSpread(angle); 34 this-> emissionRate = emissionRate;34 this->setEmissionRate(emissionRate); 35 35 this->velocity = velocity; 36 36 … … 67 67 \brief set the emission rate 68 68 \param sets the number of particles emitted per second 69 \param random A random emissionRate, the +- randomness of this option70 69 71 70 if you want to change the value of this variable during emission time (to make it more dynamic) … … 73 72 */ 74 73 void ParticleEmitter::setEmissionRate(float emissionRate) 75 {} 74 { 75 this->emissionRate = emissionRate; 76 } 76 77 77 78 /** … … 111 112 { 112 113 // saving the time 113 float countF = (dt+this->saveTime) /emissionRate;114 float countF = (dt+this->saveTime) * this->emissionRate; 114 115 int count = (int)round(countF); 115 116 this->saveTime = countF - (float)count; 116 117 118 printf( "%d::%f::emmit %f\n", count, countF, emissionRate); 119 117 120 for (int i = 0; i <= count; i++) 118 121 // emmits from EMITTER_DOT, 119 system->addParticle(this->getAbsCoor(), direction * velocity ); 122 { 123 Vector randDir = Quaternion(Vector(random()-RAND_MAX/2, random()-RAND_MAX/2, random()-RAND_MAX/2), angle).apply(this->direction); 124 randDir.normalize(); 125 system->addParticle(this->getAbsCoor(), randDir* velocity); 126 } 120 127 }
Note: See TracChangeset
for help on using the changeset viewer.