Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4129 in orxonox.OLD for orxonox/branches/particleEngine/src/lib


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

orxonox/branches/particleEngine: particles should get spread evenly if Emitter moves

Location:
orxonox/branches/particleEngine/src/lib/graphics/particles
Files:
3 edited

Legend:

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

    r4017 r4129  
    137137            randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->direction);
    138138            Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
    139            
    140             system->addParticle(this->getAbsCoor(), velocityV);
     139
     140            // this should spread the Particles evenly. if the Emitter is moved around quickly
     141            Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt;
     142            equalSpread.debug();
     143
     144            system->addParticle(this->getAbsCoor() - equalSpread, velocityV);
    141145          }
    142146      }
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc

    r3966 r4129  
    228228void ParticleEngine::tick(float dt)
    229229{
    230   // add new Particles to each System connected to an Emitter.
    231   tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    232   ParticleConnection* tmpConnection = tmpConIt->nextElement();
    233   while(tmpConnection)
    234     {
    235       tmpConnection->emitter->tick(dt, tmpConnection->system);
    236       tmpConnection = tmpConIt->nextElement();
    237     }
    238   delete tmpConIt;
    239  
    240 
    241230  // ticks all the ParticleSystems
    242231  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
     
    248237    }
    249238  delete tmpIt;
     239
     240  // add new Particles to each System connected to an Emitter.
     241  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
     242  ParticleConnection* tmpConnection = tmpConIt->nextElement();
     243  while(tmpConnection)
     244    {
     245      tmpConnection->emitter->tick(dt, tmpConnection->system);
     246      tmpConnection = tmpConIt->nextElement();
     247    }
     248  delete tmpConIt;
    250249}
    251250
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r4125 r4129  
    291291            }
    292292          else
    293             this->particles = new Particle;
     293            {
     294              PRINTF(5)("Generating new Particle\n");
     295              this->particles = new Particle;
     296            }
    294297          this->particles->next = NULL;
    295298        }
     
    304307            }
    305308          else
    306             tmpPart = new Particle;
     309            {
     310              PRINTF(5)("Generating new Particle\n");
     311              tmpPart = new Particle;
     312            }
    307313          tmpPart->next = this->particles;
    308314          this->particles = tmpPart;
Note: See TracChangeset for help on using the changeset viewer.