Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2005, 10:21:00 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: particles emitting from plane and Cube.

File:
1 edited

Legend:

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

    r4178 r4274  
    3131{
    3232   this->setClassName ("ParticleEmitter");
     33
     34   this->type = EMITTER_DOT;
     35   this->emitterSize = 1.0;
    3336   this->direction = direction;
    3437   this->setSpread(angle);
     
    5053{
    5154  ParticleEngine::getInstance()->removeEmitter(this);
    52  
    5355}
    5456
     
    6971
    7072/* these are Animation interfaces: so you can change spec values as you want */
     73
     74/**
     75   \param type the new Type of this emitter
     76*/
     77void ParticleEmitter::setType(EMITTER_TYPE type)
     78{
     79  this->type = type;
     80}
     81
     82void ParticleEmitter::setSize(float emitterSize)
     83{
     84  this->emitterSize = emitterSize;
     85}
    7186
    7287/**
     
    140155            // this should spread the Particles evenly. if the Emitter is moved around quickly
    141156            Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt;
     157            Vector extension; // the Vector for different fields.
    142158
    143             system->addParticle(this->getAbsCoor() - equalSpread, velocityV);
     159            if (this->type & 2)
     160              {
     161                extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));
     162                extension = this->getAbsDir().apply(extension);
     163              }
     164            else if (this->type & 8)
     165              {
     166                extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;
     167              }
     168
     169            system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV);
     170           
    144171          }
    145172      }
Note: See TracChangeset for help on using the changeset viewer.