Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 22, 2005, 10:01:18 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: some more properties

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

Legend:

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

    r3930 r3931  
    2525*/
    2626ParticleEmitter::ParticleEmitter(const Vector& direction, float angle, float emissionRate,
    27                   float velocity, float ttl)
     27                  float velocity)
    2828{
    2929   this->setClassName ("ParticleEmitter");
     
    6161
    6262/**
    63    \brief set the angle of the emitter
    64    \param angle around the direction in which there are particles to be emitted
    65    \param random A random spread-angle, the +- randomness of this option
    66 
    67    if you want to change the value of this variable during emission time (to make it more dynamic)
    68    you may want to use the animation class
    69 */
    70 void ParticleEmitter::setSpread(float angle, float random)
    71 {}
    72 
    73 
    74 /**
    7563   \brief set the emission rate
    7664   \param sets the number of particles emitted per second
     
    8068   you may want to use the animation class
    8169*/
    82 void ParticleEmitter::setEmissionRate(float emissionRate, float random)
     70void ParticleEmitter::setEmissionRate(float emissionRate)
    8371{}
     72
     73/**
     74   \brief set the angle of the emitter
     75   \param angle around the direction in which there are particles to be emitted
     76   \param randomAngle A random spread-angle, the +- randomness of this option
     77
     78   if you want to change the value of this variable during emission time (to make it more dynamic)
     79   you may want to use the animation class
     80*/
     81void ParticleEmitter::setSpread(float angle, float randomAngle)
     82{}
     83
     84
    8485
    8586
     
    103104*/
    104105
    105 /**
    106    \brief this is called from the particle emitter to give the pulse of time...
    107    \param time passed since last tick
    108 */
    109 void ParticleEmitter::tick(float dt)
    110 {}
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.h

    r3930 r3931  
    1313class ParticleSystem;
    1414
     15typedef enum EMITTER_TYPE {EMITTER_DOT,
     16                           EMITTER_PLANE,
     17                           EMITTER_SPHERE,
     18                           EMITTER_CUBE};
    1519
    1620//! A default singleton class.
     
    1923 public:
    2024  ParticleEmitter(const Vector& direction, float angle = 20.0, float emissionRate = 1.0,
    21                   float velocity = 1.0, float ttl = 1.0);
     25                  float velocity = 1.0);
    2226  virtual ~ParticleEmitter(void);
    2327
     
    2731
    2832  /* controlling the behavour: these can be used as Animation interfaces */
    29   void setSpread(float angle, float random = 0.0);
    30   void setEmissionRate(float emissionRate, float random = 0.0);
     33  void setEmissionRate(float emissionRate);
     34  void setSpread(float angle, float randomAngle = 0.0);
    3135  void setVelocity(float velocity, float random = 0.0);
    32 
    33   /* some functions needed for internal use */
    34   void tick(float dt);
    3536
    3637 private:
    3738  Vector direction;     //!< emition direction
    3839  float angle;          //!< max angle from the direction of the emitter
     40  float angleRandom;    //!< random emission angle (angle +- angleRandom is the emitted angle.
    3941  float emissionRate;   //!< amount of particles per seconds emitted by emiter
    4042  float velocity;       //!< the contant speed a particle gets if been emitted
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc

    r3930 r3931  
    1818#include "particle_engine.h"
    1919
     20#include "particle_system.h"
     21#include "particle_emitter.h"
     22
    2023#include "list.h"
    2124
     
    2932   this->setClassName ("ParticleEngine");
    3033
    31    this->partSysList = new tList<ParticleSystem>;
     34   this->systemList = new tList<ParticleSystem>;
    3235}
    3336
     
    5356ParticleEngine::~ParticleEngine ()
    5457{
    55   delete this->partSysList;
     58  delete this->systemList;
    5659
    5760
    5861  ParticleEngine::singletonRef = NULL;
    5962}
     63
     64/**
     65   \brief this function ticks all the ParticleSystems, so an animation will flow
     66   \param dt passed since last tick
     67*/
     68void ParticleEngine::tick(float dt)
     69{
     70  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
     71  ParticleSystem* tmpSys = tmpIt->nextElement();
     72  while(tmpSys)
     73    {
     74      tmpSys->tick(dt);
     75      tmpSys = tmpIt->nextElement();
     76    }
     77  delete tmpIt;
     78
     79}
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.h

    r3930 r3931  
    1212template<class T> class tList;
    1313class ParticleSystem;
     14class ParticleEmitter;
    1415
     16struct ParticleConnection
     17{
     18  ParticleEmitter* emitter;    //!< The emitter to emit system from.
     19  ParticleSystem* system;      //!< The Particles emitted from emitter.
     20};
    1521
    1622//! A default singleton class.
     
    2329  void tick(float dt);
    2430
     31  void addSystem(ParticleSystem* system);
     32  void addEmitter(ParticleEmitter* emitter);
     33  void addConection(ParticleEmitter* emitter, ParticleSystem* system);
     34
     35  bool removeSystem(ParticleSystem* system);
     36  bool removeEmitter(ParticleEmitter* emitter);
     37  bool breakConection(ParticleEmitter* emitter, ParticleSystem* system);
     38
    2539 private:
    2640  ParticleEngine(void);
    2741  static ParticleEngine* singletonRef;
    2842
    29   tList<ParticleSystem>* partSysList;
     43  tList<ParticleSystem>* systemList;
     44  tList<ParticleEmitter>* emitterList;
     45
     46  tList<ParticleConnection>* connectionList;
    3047};
    3148
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3930 r3931  
    4848}
    4949
     50
     51void ParticleSystem::tick(float dt)
     52{
     53 
     54
     55}
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h

    r3930 r3931  
    1313typedef enum PARTICLE_TYPE {PARTICLE_DOT,
    1414                            PARTICLE_SPRITE,
     15                            PARTICLE_MULTI_SPRITE,
    1516                            PARTICLE_OBJECT,
    16                             PARTICLE_OBJECT_ARRAY,
     17                            PARTICLE_MULTI_OBJECT,
    1718                            PARTICLE_PRIMITIVE};
    1819
    19 #define PARTICLE_DEFAULT_COUNT 200             //!< a default count of particles in the system.
     20#define PARTICLE_DEFAULT_MAX_COUNT 200         //!< a default count of particles in the system.
    2021#define PARTICLE_DEFAULT_TYPE  PARTICLE_SPRITE //!< A default type of the system.
    2122
     
    3233  Vector velocity;            //!< The current velocity of this particle.
    3334  Quaternion rotation;        //!< The current rotation of this particle.
     35  float mass;                 //!< The mass of this particle.
     36  float radius;               //!< The size of this particle.
    3437
    35   //  Particle* next;            //!< pointer to the next particle in the List. (NULL if no preceding one)
     38
     39  Particle* next;             //!< pointer to the next particle in the List. (NULL if no preceding one)
    3640};
    3741
     
    4044
    4145 public:
    42   ParticleSystem(unsigned int particleCount = PARTICLE_DEFAULT_COUNT, PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
     46  ParticleSystem(unsigned int particleCount = PARTICLE_DEFAULT_MAX_COUNT, PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
    4347  virtual ~ParticleSystem();
    4448
    4549  void setMaterial(Material* material);
    46   void addEmitter(ParticleEmitter* emitter);
     50  void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
     51  void setRadius(float startRadius, float endRadius, float randomRadius = 0.0);
     52
     53  void tick(float dt);
    4754
    4855 private:
    49   int particleCount;         //!< the count of Particles for this ParticleSystem.
    50   PARTICLE_TYPE particleType;//!< A type for the Particles
     56  float conserve;            //!< How much energy gets conserved to the next Tick.
     57  float lifeSpan;            //!< Initial lifetime of a Particle.
     58  float randomLifeSpan;
     59  float startRadius;
     60  float endRadius;
     61  float randomRadius;
     62 
     63  // particles
     64  int maxCount;              //!< the count of Particles for this ParticleSystem.
     65  PARTICLE_TYPE particleType;//!< A type for all the Particles
     66  Material* material;        //!< A Material for all the Particles.
    5167  Particle* particles;       //!< A list of particles of this System.
    52   Material* material;        //!< A Material for all the Particles.
    53 
    54   ParticleEmitter* emitter;  //!< An emitter for this particleSystem.
    5568};
    5669
Note: See TracChangeset for help on using the changeset viewer.