Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3933 in orxonox.OLD for orxonox/branches/particleEngine


Ignore:
Timestamp:
Apr 23, 2005, 1:10:58 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: emitting 10000 particles a second …. without deleting anyone of them :)

Location:
orxonox/branches/particleEngine/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc

    r3932 r3933  
    3232   this->direction = direction;
    3333   this->setSpread(angle);
    34    this->emissionRate = emissionRate;
     34   this->setEmissionRate(emissionRate);
    3535   this->velocity = velocity;
    3636
     
    6767   \brief set the emission rate
    6868   \param sets the number of particles emitted per second
    69    \param random A random emissionRate, the +- randomness of this option
    7069
    7170   if you want to change the value of this variable during emission time (to make it more dynamic)
     
    7372*/
    7473void ParticleEmitter::setEmissionRate(float emissionRate)
    75 {}
     74{
     75  this->emissionRate = emissionRate;
     76}
    7677
    7778/**
     
    111112{
    112113  // saving the time
    113   float countF = (dt+this->saveTime) / emissionRate;
     114  float countF = (dt+this->saveTime) * this->emissionRate;
    114115  int count = (int)round(countF);
    115116  this->saveTime = countF - (float)count;
    116117
     118  printf( "%d::%f::emmit %f\n", count, countF, emissionRate);
     119
    117120  for (int i = 0; i <= count; i++)
    118121    // 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    }
    120127}
  • orxonox/branches/particleEngine/src/story_entities/world.cc

    r3932 r3933  
    377377            this->glmis->step();
    378378           
    379             testEmitter = new ParticleEmitter(Vector(1,0,0));
     379            testEmitter = new ParticleEmitter(Vector(1,0,0), 20.0, 10000.0, .1);
     380            testEmitter->setParent(localPlayer);
    380381            testSystem = new ParticleSystem();
    381382
Note: See TracChangeset for help on using the changeset viewer.