Changeset 3935 in orxonox.OLD for orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
- Timestamp:
- Apr 23, 2005, 3:30:45 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
r3934 r3935 19 19 20 20 #include "particle_system.h" 21 #include "particle_engine.h" 21 22 22 23 using namespace std; … … 33 34 this->setSpread(angle); 34 35 this->setEmissionRate(emissionRate); 35 this-> velocity = velocity;36 this->setVelocity(velocity); 36 37 37 38 this->saveTime = 0.0; 39 40 ParticleEngine::getInstance()->addEmitter(this); 38 41 } 39 42 … … 45 48 */ 46 49 ParticleEmitter::~ParticleEmitter () 47 {} 50 { 51 ParticleEngine::getInstance()->removeEmitter(this); 52 53 } 48 54 49 55 … … 85 91 */ 86 92 void ParticleEmitter::setSpread(float angle, float randomAngle) 87 { }88 89 90 93 { 94 this->angle = angle; 95 this->randomAngle = randomAngle; 96 } 91 97 92 98 /** … … 98 104 you may want to use the animation class 99 105 */ 100 void ParticleEmitter::setVelocity(float velocity, float random) 101 {} 106 void ParticleEmitter::setVelocity(float velocity, float randomVelocity) 107 { 108 this->velocity = velocity; 109 this->randomVelocity = randomVelocity; 110 } 102 111 103 112 /** … … 116 125 this->saveTime /= this->emissionRate; 117 126 127 118 128 for (int i = 0; i <= count; i++) 119 129 // emmits from EMITTER_DOT, 120 130 { 121 Vector randDir = Quaternion(Vector(random()-RAND_MAX/2, random()-RAND_MAX/2, random()-RAND_MAX/2), angle).apply(this->direction); 131 Vector randDir = Vector(random()-RAND_MAX/2, random()-RAND_MAX/2, random()-RAND_MAX/2); 132 randDir.normalize(); 133 randDir = Quaternion(angle + randomAngle *((float)random()/RAND_MAX -.5), randDir).apply(this->direction); 122 134 randDir.normalize(); 123 135 system->addParticle(this->getAbsCoor(), randDir* velocity);
Note: See TracChangeset
for help on using the changeset viewer.