Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7027 in orxonox.OLD for trunk/src/lib/particles/particle_emitter.cc


Ignore:
Timestamp:
Feb 3, 2006, 8:27:36 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: saver and faster emitter

File:
1 edited

Legend:

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

    r6825 r7027  
    186186    this->saveTime = modff(count, &count) / this->emissionRate;
    187187    PRINTF(5)("emitting %f particles, saving %f seconds for the next timestep\n", count, this->saveTime);
    188 
     188    if (count + this->system->getCount() > this->system->getMaxCount())
     189      count = this->system->getMaxCount() - this->system->getCount();
    189190    if (likely(count > 0.0f))
    190     {
    191191      this->emitParticles((unsigned int)count);
    192 
    193 /*      Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
    194       for (int i = 0; i < (int)count; i++)
    195       {
    196         Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
    197         randDir.normalize();
    198         randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->direction);
    199         Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
    200 
    201         // this should spread the Particles evenly. if the Emitter is moved around quickly
    202         Vector equalSpread = this->getVelocity() * rand()/RAND_MAX * dt;
    203         Vector extension; // the Vector for different fields.
    204 
    205 //         if (this->type & EMITTER_PLANE)
    206 //         {
    207 //           extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));
    208 //           extension = this->getAbsDir().apply(extension);
    209 //         }
    210 //         else if (this->type & EMITTER_CUBE)
    211 //         {
    212 //           extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;
    213 //         }
    214 
    215 
    216         // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
    217         randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
    218         randDir.normalize();
    219         Quaternion orient = Quaternion(M_PI, randDir);
    220         Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
    221 
    222         this->system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV, orient, moment);
    223       } */
    224     }
    225192  }
    226193}
Note: See TracChangeset for help on using the changeset viewer.