Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4378 in orxonox.OLD for orxonox/trunk/src/lib/graphics


Ignore:
Timestamp:
May 29, 2005, 2:02:56 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: applying force works for particle-systems again

Location:
orxonox/trunk/src/lib/graphics/particles
Files:
2 edited

Legend:

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

    r4377 r4378  
    5656  this->setType(type, 1);
    5757  this->setColor(1.0,1.0,1.0,1.0, .5,.5,.5,.5, .0,.0,.0,.0);
     58  this->setMass(1.0, 0.0);
    5859  ParticleEngine::getInstance()->addSystem(this);
    5960}
     
    182183
    183184/**
     185   \brief sets the initial mass of any particle
     186*/
     187void ParticleSystem::setMass(float mass, float randomMass)
     188{
     189  this->initialMass = mass;
     190  this->randomInitialMass = randomMass;
     191}
     192
     193/**
    184194   \brief sets the conserve Factor of newly created particles
    185195*/
     
    231241  while (likely(tickPart != NULL))
    232242    {
     243      // applying force to the System.
     244      tickPart->velocity += tickPart->extForce * tickPart->mass;
     245
     246      // rendering new position.
    233247      tickPart->position = tickPart->position + tickPart->velocity * dt;
    234248      tickPart->radius += tickPart->radiusIt * dt;
    235 
    236       // applying force to the System.
    237       tickPart->velocity += tickPart->extForce * tickPart->mass;
     249     
    238250      tickPart->extForce = Vector(0,0,0);
    239251
  • orxonox/trunk/src/lib/graphics/particles/particle_system.h

    r4377 r4378  
    7474                 float randomStartRadius = 0.0, float randomEndRadius = 0.0);
    7575  void setConserve(float conserve);
    76   void setMass(float mass, float randomMass);
     76  void setMass(float mass, float randomMass = 0.0);
    7777
    7878  void setColor(GLfloat br, GLfloat bg, GLfloat bb, GLfloat ba,
     
    9797  inline float getMass(void) const { return this->initialMass; };
    9898
    99   void applyField(Field* field, float dt);
     99  virtual void applyField(Field* field, float dt);
    100100
    101101  void tick(float dt);
Note: See TracChangeset for help on using the changeset viewer.