Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 22, 2005, 11:23:48 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: some more definitions of the particleSystem/Emitter

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

    r3929 r3930  
    2929   this->setClassName ("ParticleEmitter");
    3030   this->direction = direction;
    31    this->angle = angle;
     31   this->setSpread(angle);
    3232   this->emissionRate = emissionRate;
    3333   this->velocity = velocity;
    34    this->timeToLive = ttl;
    3534}
    3635
     
    6463   \brief set the angle of the emitter
    6564   \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
    6666
    6767   if you want to change the value of this variable during emission time (to make it more dynamic)
    68    you will have to use the animation class
     68   you may want to use the animation class
    6969*/
    70 void ParticleEmitter::setAngle(float angle)
     70void ParticleEmitter::setSpread(float angle, float random)
    7171{}
    7272
     
    7575   \brief set the emission rate
    7676   \param sets the number of particles emitted per second
     77   \param random A random emissionRate, the +- randomness of this option
    7778
    7879   if you want to change the value of this variable during emission time (to make it more dynamic)
    79    you will have to use the animation class
     80   you may want to use the animation class
    8081*/
    81 void ParticleEmitter::setEmissionRate(float emissionRate)
     82void ParticleEmitter::setEmissionRate(float emissionRate, float random)
    8283{}
    8384
     
    8586/**
    8687   \brief sets the velocity of all particles emitted
    87    \param velocity of the emitted particles
     88   \param velocity The starting velocity of the emitted particles
     89   \param random A random starting velocity, the +- randomness of this option
    8890
    8991   if you want to change the value of this variable during emission time (to make it more dynamic)
    90    you will have to use the animation class
     92   you may want to use the animation class
    9193*/
    92 void ParticleEmitter::setVelocity(float velocity)
     94void ParticleEmitter::setVelocity(float velocity, float random)
    9395{}
    9496
     
    98100
    99101   if you want to change the value of this variable during emission time (to make it more dynamic)
    100    you will have to use the animation class
     102   you may want to use the animation class
    101103*/
    102 void ParticleEmitter::setTTL(float ttl)
    103 {}
    104 
    105104
    106105/**
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.h

    r3929 r3930  
    2727
    2828  /* controlling the behavour: these can be used as Animation interfaces */
    29   void setAngle(float angle);
    30   void setEmissionRate(float emissionRate);
    31   void setVelocity(float velocity);
    32   void setTTL(float ttl);
     29  void setSpread(float angle, float random = 0.0);
     30  void setEmissionRate(float emissionRate, float random = 0.0);
     31  void setVelocity(float velocity, float random = 0.0);
    3332
    3433  /* some functions needed for internal use */
     
    4039  float emissionRate;   //!< amount of particles per seconds emitted by emiter
    4140  float velocity;       //!< the contant speed a particle gets if been emitted
    42   float timeToLive;     //!< this is the global time to live (ttl) definition
    4341};
    4442
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc

    r3924 r3930  
    1818#include "particle_engine.h"
    1919
     20#include "list.h"
     21
    2022using namespace std;
    21 
    2223
    2324/**
     
    2829   this->setClassName ("ParticleEngine");
    2930
     31   this->partSysList = new tList<ParticleSystem>;
    3032}
    3133
     
    5153ParticleEngine::~ParticleEngine ()
    5254{
     55  delete this->partSysList;
     56
     57
    5358  ParticleEngine::singletonRef = NULL;
    54 
    5559}
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.h

    r3926 r3930  
    2828
    2929  tList<ParticleSystem>* partSysList;
    30 
    3130};
    3231
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3925 r3930  
    1818#include "particle_system.h"
    1919
     20#include "particle_emitter.h"
     21#include "particle_engine.h"
     22
    2023using namespace std;
    2124
     
    2326/**
    2427   \brief standard constructor
     28   \param count the Count of particles in the System
     29   \param type The Type of the ParticleSystem
     30
    2531   \todo this constructor is not jet implemented - do it
    2632*/
    27 ParticleSystem::ParticleSystem ()
     33ParticleSystem::ParticleSystem (unsigned int count, PARTICLE_TYPE type)
    2834{
    2935   this->setClassName ("ParticleSystem");
     36
     37   this->particleType = type;
    3038}
    3139
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h

    r3926 r3930  
    99#include "base_object.h"
    1010#include "vector.h"
     11
     12//! An enumerator for the different types of particles.
     13typedef enum PARTICLE_TYPE {PARTICLE_DOT,
     14                            PARTICLE_SPRITE,
     15                            PARTICLE_OBJECT,
     16                            PARTICLE_OBJECT_ARRAY,
     17                            PARTICLE_PRIMITIVE};
     18
     19#define PARTICLE_DEFAULT_COUNT 200             //!< a default count of particles in the system.
     20#define PARTICLE_DEFAULT_TYPE  PARTICLE_SPRITE //!< A default type of the system.
     21
    1122// FORWARD DEFINITION
    12 
    1323class Material;
    14 class Vector;
     24class ParticleEmitter;
    1525
    1626
     
    1828typedef struct Particle
    1929{
    20   float timeToLive;
    21   Vector position;
    22   Quaternion rotation;
    23   Material* material; 
     30  float timeToLive;           //!< The time this particle lives from NOW on.
     31  Vector position;            //!< The current position of this particle.
     32  Vector velocity;            //!< The current velocity of this particle.
     33  Quaternion rotation;        //!< The current rotation of this particle.
     34
     35  //  Particle* next;            //!< pointer to the next particle in the List. (NULL if no preceding one)
    2436};
    2537
     
    2840
    2941 public:
    30   ParticleSystem();
     42  ParticleSystem(unsigned int particleCount = PARTICLE_DEFAULT_COUNT, PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
    3143  virtual ~ParticleSystem();
    3244
     45  void setMaterial(Material* material);
     46  void addEmitter(ParticleEmitter* emitter);
    3347
    3448 private:
     49  int particleCount;         //!< the count of Particles for this ParticleSystem.
     50  PARTICLE_TYPE particleType;//!< A type for the Particles
     51  Particle* particles;       //!< A list of particles of this System.
     52  Material* material;        //!< A Material for all the Particles.
    3553
    36   int particleCount;
    37 
    38   Particle* particles;
     54  ParticleEmitter* emitter;  //!< An emitter for this particleSystem.
    3955};
    4056
Note: See TracChangeset for help on using the changeset viewer.