Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 14, 2005, 1:15:25 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: connection of Physical effects should work on ParticleSystems

File:
1 edited

Legend:

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

    r4178 r4182  
    2323#include "material.h"
    2424
     25#include "field.h"
     26
    2527using namespace std;
    2628
     
    3436ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type)
    3537{
    36    this->setClassName ("ParticleSystem");
    37    this->material = NULL;
    38    this->name = NULL;
    39    this->maxCount = maxCount;
    40    this->count = 0;
    41    this->particles = NULL;
    42    this->deadList = NULL;
    43    this->setConserve(1);
    44    this->setLifeSpan(1);
    45    this->setInheritSpeed(0);
    46    this->glID = NULL;
    47    this->setRadius(1.0, 1.0, 0.0);
    48    this->setType(type, 1);
    49    ParticleEngine::getInstance()->addSystem(this);
     38  this->setClassName ("ParticleSystem");
     39  this->material = NULL;
     40  this->name = NULL;
     41  this->maxCount = maxCount;
     42  this->count = 0;
     43  this->particles = NULL;
     44  this->deadList = NULL;
     45  this->setConserve(1);
     46  this->setLifeSpan(1);
     47  this->setInheritSpeed(0);
     48  this->glID = NULL;
     49  this->setRadius(1.0, 1.0, 0.0);
     50  this->setType(type, 1);
     51  ParticleEngine::getInstance()->addSystem(this);
    5052}
    5153
     
    207209      tickPart->radius += tickPart->radiusIt * dt;
    208210
     211      // applying force to the System.
     212      tickPart->velocity += tickPart->extForce * tickPart->mass;
     213      tickPart->extForce = Vector(0,0,0);
     214
    209215      // many more to come
    210 
    211216
    212217      if (this->conserve < 1.0)
     
    240245    }
    241246}
     247
     248/**
     249    \brief applies some force to a Particle.
     250 */
     251void ParticleSystem::applyField(Field* field)
     252{
     253  Particle* tickPart = particles;
     254  while (tickPart)
     255    {
     256      tickPart->extForce += field->calcForce(tickPart->position);
     257      tickPart = tickPart->next;
     258    }
     259}
     260
    242261
    243262/**
Note: See TracChangeset for help on using the changeset viewer.