Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4692 in orxonox.OLD


Ignore:
Timestamp:
Jun 24, 2005, 4:26:04 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: momentum

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/particles/particle_emitter.cc

    r4691 r4692  
    245245  if (likely(dt > 0.0 && this->emissionRate > 0.0))
    246246  {
    247     // saving the time
     247    // saving the time (particles only partly emitted in this timestep)
    248248    float count = (dt+this->saveTime) * this->emissionRate;
    249249    this->saveTime = modff(count, &count) / this->emissionRate;
    250     PRINTF(5)("emitting %f particles, saving %f seconds for the next round\n", count, this->saveTime);
     250    PRINTF(5)("emitting %f particles, saving %f seconds for the next timestep\n", count, this->saveTime);
    251251
    252252    if (likely(count > 0))
     
    254254      Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
    255255      for (int i = 0; i < count; i++)
    256           // emmits from EMITTER_DOT,
    257256      {
    258257        Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
     
    261260        Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
    262261
    263             // this should spread the Particles evenly. if the Emitter is moved around quickly
     262        // this should spread the Particles evenly. if the Emitter is moved around quickly
    264263        Vector equalSpread = this->getVelocity() * rand()/RAND_MAX * dt;
    265264        Vector extension; // the Vector for different fields.
    266265
    267         if (this->type & 2)
     266        if (this->type & EMITTER_PLANE)
    268267        {
    269268          extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));
    270269          extension = this->getAbsDir().apply(extension);
    271270        }
    272         else if (this->type & 8)
     271        else if (this->type & EMITTER_CUBE)
    273272        {
    274273          extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;
     
    283282
    284283        system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV, orient, moment);
    285 
    286284      }
    287285    }
  • orxonox/trunk/src/lib/particles/particle_system.cc

    r4691 r4692  
    265265{
    266266  Particle* tickPart = particles;  // the particle to Tick
    267   Particle* prevPart = NULL;       //
     267  Particle* prevPart = NULL;
    268268  while (likely(tickPart != NULL))
    269269    {
  • orxonox/trunk/src/subprojects/particles/particle_fun.cc

    r4690 r4692  
    2929#define PINIT_EMISSION_RATE          50
    3030#define PINIT_EMISSION_VELOCITY      5.0
     31#define PINIT_EMISSION_MOMENTUM      1.0
    3132#define PINIT_SPREAD_ANGLE           0.1
    3233#define PINIT_EMITTER_TYPE           EMITTER_DOT
     
    146147          PRINT(4)("Velocity set to %f\n", atof(value));
    147148        }
     149      else if (!strcmp(name, "Momentum"))
     150        {
     151          tmpEmit->setEmissionMomentum(atof(value));
     152          PRINT(4)("Momentum set to %f\n", atof(value));
     153        }
    148154      else if(!strcmp(name, "SpreadAngle"))
    149155        {
     
    294300          velocity->redraw();
    295301          emitterBox->fill(velocity);
     302
     303          emitterBox->fill(new Label("Momentum"));
     304          Slider* Momentum = new Slider("Momentum", 0, 20);
     305          Momentum->setExactness(2);
     306          Momentum->connectSignal("value_changed", (void*)Momentum, emitterChange );
     307          Momentum->setValue(PINIT_EMISSION_MOMENTUM);
     308          Momentum->redraw();
     309          emitterBox->fill(Momentum);
    296310
    297311          emitterBox->fill(new Label("SpreadAngle"));
Note: See TracChangeset for help on using the changeset viewer.