- Timestamp:
- Jan 29, 2006, 1:35:43 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 3 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 { -
trunk/src/world_entities/projectiles/hyperblast.cc
r6825 r6826 23 23 #include "class_list.h" 24 24 25 #include "dot_emitter.h" 26 #include "sprite_particles.h" 25 #include "box_emitter.h" 27 26 #include "spark_particles.h" 28 27 … … 47 46 this->size = 4.0; 48 47 49 this->emitter = new DotEmitter(100, 5, M_2_PI); 48 this->emitter = new BoxEmitter(Vector(400, 2, 2), 100, 5, M_2_PI); 49 this->emitter->setRelCoor(200,0,0); 50 50 this->emitter->setParent(this); 51 51 this->emitter->setSpread(M_PI, M_PI); … … 141 141 glPushMatrix(); 142 142 143 float matrix[4][4]; 144 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 145 this->getAbsDir().matrix (matrix); 146 glMultMatrixf((float*)matrix); 147 glScalef(2.0, this->size, this->size); 148 this->getModel()->draw(); 143 glTranslatef (this->getAbsCoor ().x, 144 this->getAbsCoor ().y, 145 this->getAbsCoor ().z); 146 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 147 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 148 149 // glScalef(2.0, this->size, this->size); 150 // this->getModel()->draw(); 149 151 150 152 glPopMatrix();
Note: See TracChangeset
for help on using the changeset viewer.