Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by landauf, 16 years ago) (diff)

ParticleEngine

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

Particles are an easy to use, fast and efficient way to produce many different volumetric effects like

  • snow
  • dust
  • smoke
  • fire
  • commets
  • and much more

normally they are quite tiny objects, that follow some laws like velocity, forces and so on…

properties

each particle has some properties that are given to it by its ParticleSystem. those are:

  float         lifeTime;            //!< The time this particle has to live.
  float         lifeCycle;           //!< The fraction of time passed. (in percentage of its lifeTime)

  Vector        position;            //!< The current position of this particle.
  Vector        velocity;            //!< The current velocity of this particle.
  Vector        extForce;            //!< The external Force that influences this Particle.
  Quaternion    rotation;            //!< The current rotation of this particle.
  float         mass;                //!< The mass of this particle.
  float         massRand;            //!< A random mass
  float         radius;              //!< The current size of this particle.
  float         radiusRand;          //!< a random Radius
  GLfloat       color [4];           //!< A Color for the particles.

through the ParticleSystem, they are all animatable. (if you are interested in more detail how you can animate this stuff visit: this and goto ParticleSystem.

How It Works

https://www.orxonox.net/additionals/ParticleEngine.png

GENERAL IDEA

The Diagram above shows how the flow of the ParticleEngine works.

  1. The driver(world.cc) tells the ParticleEngine what to do (either tick or draw)
  2. The ParticleEngine tells the ParticleEmitter's to emitt into their ParticleSystem's
  3. The ParticleEngine telss the ParticleSystem's to tick themselves. moves/iterates/removes particles
  4. The ParticleEngine tells the ParticleSystem's to draw themselves

IN ORXONOX

  1. All the ParticleSystems are WorldEntitites? and as such are drawn within the internal engine. So our framework acts as ParticleEngine
  2. Emitters have one/or no ParticleSystem in which they emit into. The ParticleSystems tell them to emit
  3. Systems have multiple emitters, and they are tickt and drawn in ORXONOX OM_ENVIRON_TICK (see ObjectManager?)

Creation

  1. hardcoded
    /* create a ParticleSystem */
    ParticleSystem* system = new SpriteParticles(100000);
    /* create a ParticleEmitter */
    ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 400, .5);
    /* let the emitter emit into system */
    emitter->setSystem(system)
    // or
    system->addEmitter(emitter);
    
    
  2. lodeable this is the easiest version see the LoadParam? page for more information on howto do this

you could also use one of the many functions, to let the Particles look better, but this is for you to decide.