Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6629 in orxonox.OLD for trunk/src/lib/particles/particle_system.cc


Ignore:
Timestamp:
Jan 20, 2006, 8:11:04 PM (18 years ago)
Author:
bensch
Message:

trunk: particles: precache and ModelParticles

File:
1 edited

Legend:

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

    r6626 r6629  
    7474
    7575/**
    76   \brief initializes the ParticleSystem with default values
    77 */
     76 * @brief initializes the ParticleSystem with default values
     77 */
    7878void ParticleSystem::init()
    7979{
     
    125125  }
    126126  LOAD_PARAM_END_CYCLE(element);
     127
     128  LoadParam(root, "precache", this, ParticleSystem, precache)
     129      .describe("Precaches the ParticleSystem for %1 seconds, %2 times per Second")
     130      .defaultValues(2, 1, 25);
    127131}
    128132
     
    222226}
    223227
    224 
     228/**
     229 * @brief adds an Emitter to this System.
     230 * @param emitter the Emitter to add.
     231 */
    225232void ParticleSystem::addEmitter(ParticleEmitter* emitter)
    226233{
     
    232239}
    233240
    234 
     241/**
     242 * @brief removes a ParticleEmitter from this System
     243 * @param emitter the Emitter to remove
     244 */
    235245void ParticleSystem::removeEmitter(ParticleEmitter* emitter)
    236246{
     
    244254
    245255/**
     256 * @brief does a Precaching, meaning, that the ParticleSystem(and its emitters) will be ticked force
     257 * @param seconds: seconds
     258 * @param ticksPerSeconds times per Second.
     259 */
     260void ParticleSystem::precache(unsigned int seconds, unsigned int ticksPerSecond)
     261{
     262  PRINTF(4)("Precaching %s::%s %d seconds %d timesPerSecond\n", this->getClassName(), this->getName(), seconds, ticksPerSecond);
     263  this->debug();
     264  for (unsigned int i = 0; i < seconds*ticksPerSecond; i++)
     265    this->tick(1.0/(float)ticksPerSecond);
     266}
     267
     268
     269/**
    246270 *  ticks the system.
    247271 * @param dt the time to tick all the Particles of the System
     
    355379//   switch (this->particleType)
    356380//   {
    357 //     case PARTICLE_SPARK:
    358 //       glDisable(GL_LIGHTING);
    359 //       glDepthMask(GL_FALSE);
    360 //       //glEnable(GL_LINE_SMOOTH);
    361 //       glEnable(GL_BLEND);
    362 //
    363 //       glBegin(GL_LINES);
    364 //       while (likely(drawPart != NULL))
    365 //       {
    366 //         glColor4fv(drawPart->color);
    367 //         glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
    368 //         glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,
    369 //                    drawPart->position.y - drawPart->velocity.y * drawPart->radius,
    370 //                    drawPart->position.z - drawPart->velocity.z * drawPart->radius);
    371 //         drawPart = drawPart->next;
    372 //       }
    373 //       glEnd();
    374 //       break;
    375381//
    376382//     case PARTICLE_MODEL:
    377383//       {
    378 //         GLfloat matrix[4][4];
    379 //
    380 //         if (likely(this->getModel() != NULL))
    381 //           while (likely(drawPart != NULL))
    382 //         {
    383 //           glPushMatrix();
    384 //           glMatrixMode(GL_MODELVIEW);
    385 //           /* move */
    386 //           glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z);
    387 //           /* scale */
    388 //           glScalef(drawPart->radius, drawPart->radius, drawPart->radius);
    389 //           /* rotate */
    390 //           drawPart->orientation.matrix (matrix);
    391 //           glMultMatrixf((float*)matrix);
    392 //
    393 //           this->getModel()->draw();
    394 //
    395 //           glPopMatrix();
    396 //           drawPart = drawPart->next;
    397 //         }
    398 //         else
    399 //           PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getName());
    400384//       }
    401385//       break;
     
    488472void ParticleSystem::debug() const
    489473{
    490   PRINT(0)("  ParticleCount: %d, maximumCount: %d :: filled %d%%\n", this->count, this->maxCount, 100*this->count/this->maxCount);
     474  PRINT(0)("  ParticleCount: %d emitters: %d, maximumCount: %d :: filled %d%%\n", this->count, this->emitters.size(), this->maxCount, 100*this->count/this->maxCount);
    491475  if (deadList)
    492476  {
Note: See TracChangeset for help on using the changeset viewer.