Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2005, 9:16:53 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/physics back to the trunk
merged with command
svn merge -r 3866:HEAD . ../../trunk/
many conflict that i tried to resolv
@patrick: i hope i did not interfere with your stuff :/

File:
1 edited

Legend:

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

    r4320 r4338  
    3131{
    3232   this->setClassID(CL_PARTICLE_EMITTER, "ParticleEmitter");
     33
     34   this->type = EMITTER_DOT;
     35   this->emitterSize = 1.0;
    3336   this->direction = direction;
    3437   this->setSpread(angle);
    3538   this->setEmissionRate(emissionRate);
    36    this->setVelocity(velocity);
     39   this->setEmissionVelocity(velocity);
    3740
    3841   this->saveTime = 0.0;
     
    5053{
    5154  ParticleEngine::getInstance()->removeEmitter(this);
    52  
    5355}
    5456
     
    7173
    7274/**
     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  if (emitterSize > 0.0)
     85    this->emitterSize = emitterSize;
     86  else
     87    emitterSize = 0.0;
     88}
     89
     90/**
    7391   \brief set the emission rate
    7492   \param sets the number of particles emitted per second
     
    7997void ParticleEmitter::setEmissionRate(float emissionRate)
    8098{
    81   this->emissionRate = emissionRate;
     99  if (emissionRate > 0.0)
     100    this->emissionRate = emissionRate;
     101  else
     102    this->emissionRate = 0.0;
    82103}
    83104
     
    104125   you may want to use the animation class
    105126*/
    106 void ParticleEmitter::setVelocity(float velocity, float randomVelocity)
     127void ParticleEmitter::setEmissionVelocity(float velocity, float randomVelocity)
    107128{
    108129  this->velocity = velocity;
     
    139160
    140161            // this should spread the Particles evenly. if the Emitter is moved around quickly
    141             Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt;
     162            Vector equalSpread = this->getVelocity() * rand()/RAND_MAX * dt;
     163            Vector extension; // the Vector for different fields.
    142164
    143             system->addParticle(this->getAbsCoor() - equalSpread, velocityV);
     165            if (this->type & 2)
     166              {
     167                extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));
     168                extension = this->getAbsDir().apply(extension);
     169              }
     170            else if (this->type & 8)
     171              {
     172                extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;
     173              }
     174
     175            system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV);
     176           
    144177          }
    145178      }
Note: See TracChangeset for help on using the changeset viewer.