Changeset 4687 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jun 24, 2005, 1:44:38 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/particles/particle_system.cc
r4677 r4687 273 273 274 274 // rendering new position. 275 tickPart->position = tickPart->position + tickPart->velocity * dt; 275 tickPart->position += tickPart->velocity * dt; 276 tickPart->orientation += tickPart->momentum *dt; 277 276 278 tickPart->radius = radiusAnim.getValue(tickPart->lifeCycle) 277 279 + randRadiusAnim.getValue(tickPart->lifeCycle) * tickPart->radiusRand; … … 439 441 440 442 case PARTICLE_MODEL: 441 if (likely(this->model != NULL))442 while (likely(drawPart != NULL))443 443 { 444 glPushMatrix(); 445 glMatrixMode(GL_MODELVIEW); 446 447 glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z); 448 glScalef(drawPart->radius, drawPart->radius, drawPart->radius); 449 450 this->model->draw(); 451 452 glPopMatrix(); 453 drawPart = drawPart->next; 444 GLfloat matrix[4][4]; 445 446 if (likely(this->model != NULL)) 447 while (likely(drawPart != NULL)) 448 { 449 glPushMatrix(); 450 glMatrixMode(GL_MODELVIEW); 451 /* move */ 452 glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z); 453 /* scale */ 454 glScalef(drawPart->radius, drawPart->radius, drawPart->radius); 455 /* rotate */ 456 drawPart->orientation.matrix (matrix); 457 glMultMatrixf((float*)matrix); 458 459 this->model->draw(); 460 461 glPopMatrix(); 462 drawPart = drawPart->next; 463 } 454 464 } 455 465 break; … … 515 525 this->particles = tmpPart; 516 526 } 517 518 527 particles->lifeTime = this->lifeSpan + (float)(rand()/RAND_MAX)* this->randomLifeSpan; 519 528 particles->lifeCycle = 0.0; 520 529 particles->position = position; 521 530 particles->velocity = velocity; 531 532 particles->orientation = Quaternion(.4, velocity.getNormalized()); 533 particles->momentum = Quaternion(.4, velocity.getNormalized()); 522 534 523 535 // particle->rotation = ; //! \todo rotation is once again something to be done. -
orxonox/trunk/src/lib/particles/particle_system.h
r4680 r4687 51 51 52 52 Vector position; //!< The current position of this particle. 53 Vector velocity; //!< The current velocity of this particle.53 Vector velocity; //!< The current velocity of this Particle. 54 54 Vector extForce; //!< The external Force that influences this Particle. 55 Quaternion rotation; //!< The current rotation of this particle. 56 float mass; //!< The mass of this particle. 55 Quaternion orientation; //!< The current orientation of this Particle. 56 Quaternion momentum; //!< The current angular momentum (spin) of this Particle. 57 float mass; //!< The mass of this Particle. 57 58 float massRand; //!< A random mass 58 float radius; //!< The current size of this particle.59 float radius; //!< The current size of this Particle. 59 60 float radiusRand; //!< a random Radius 60 61 GLfloat color [4]; //!< A Color for the particles.
Note: See TracChangeset
for help on using the changeset viewer.