Changeset 6826 in orxonox.OLD for trunk/src/lib/particles
- Timestamp:
- Jan 29, 2006, 1:35:43 PM (19 years ago)
- Location:
- trunk/src/lib/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/particles/box_emitter.cc
r6825 r6826 81 81 } 82 82 83 void BoxEmitter::setSize(float x, float y, float z) 84 { 85 this->size = Vector (x,y,z); 86 } 87 88 83 89 void BoxEmitter::emitParticles(unsigned int count) const 84 90 { 85 91 Vector inheritVelocity = this->getVelocity() * this->inheritSpeed; 92 93 Vector xDir = this->getAbsDirX() * this->size.x; 94 Vector yDir = this->getAbsDirY() * this->size.y; 95 Vector zDir = this->getAbsDirZ() * this->size.z; 86 96 87 97 for (unsigned int i = 0; i < count; i++) … … 92 102 Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity; 93 103 94 Vector extension = Vector(((float)rand()/RAND_MAX -.5)*this->size.x,95 ((float)rand()/RAND_MAX -.5) *this->size.y,96 ((float)rand()/RAND_MAX -.5) * this->size.z);97 104 Vector box = this->getAbsCoor() + 105 xDir * ((float)rand()/RAND_MAX -.5) + 106 yDir * ((float)rand()/RAND_MAX -.5) + 107 zDir * ((float)rand()/RAND_MAX -.5); 98 108 99 109 // ROTATIONAL CALCULATION (this must not be done for all types of particles.) … … 103 113 Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir); 104 114 105 this->getSystem()->addParticle( this->getAbsCoor() + extension, velocityV, orient, moment);115 this->getSystem()->addParticle(box, velocityV, orient, moment); 106 116 107 117 } -
trunk/src/lib/particles/box_emitter.h
r6825 r6826 11 11 #define BOX_EMITTER_DEFAULT_SIZE Vector(1.0f, 1.0f, 1.0f) 12 12 13 //! A class to handle an Emitter. 13 //! A class to handle a Box Emitter. 14 /** 15 * A Box Emitter is a special kind of emitter, that has the (underlying) PNode 16 * at its center, and from there on is a Box in the Direction of the PNode 17 * out around size in the corresponding directions 18 */ 14 19 class BoxEmitter : public ParticleEmitter 15 20 {
Note: See TracChangeset
for help on using the changeset viewer.