Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4478 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 2, 2005, 5:01:50 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: particles documented

Location:
orxonox/trunk/src/lib/particles
Files:
6 edited

Legend:

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

    r4439 r4478  
    4242}
    4343
     44/**
     45   \brief constructs and loads a ParticleEmitter from a XML-element
     46   \param root the XML-element to load from
     47*/
    4448ParticleEmitter::ParticleEmitter(const TiXmlElement* root)
    4549{
     
    6367}
    6468
     69/**
     70   \brief loads a ParticleEmitter from a XML-element
     71   \param root the XML-element to load from
     72*/
    6573void ParticleEmitter::loadParams(const TiXmlElement* root)
    6674{
     
    109117
    110118/**
    111    \param the type of emitter
     119   \brief sets the type of emitter
     120   \param type the type as a const char*
     121   dot: EMITTER_DOT, plane: EMITTER_PLANE, cube: EMITTER_CUBE, sphere, EMITTER_SPHERE;
    112122*/
    113123void ParticleEmitter::setType(const char* type)
     
    123133}
    124134
    125 
     135/**
     136   \brief sets a new size to the emitter
     137*/
    126138void ParticleEmitter::setSize(float emitterSize)
    127139{
     
    134146/**
    135147   \brief set the emission rate
    136    \param sets the number of particles emitted per second
     148   \param emissionRate: sets the number of particles emitted per second
    137149
    138150   if you want to change the value of this variable during emission time (to make it more dynamic)
     
    164176   \brief sets the velocity of all particles emitted
    165177   \param velocity The starting velocity of the emitted particles
    166    \param random A random starting velocity, the +- randomness of this option
     178   \param randomVelocity A random starting velocity, the +- randomness of this option
    167179
    168180   if you want to change the value of this variable during emission time (to make it more dynamic)
     
    177189/**
    178190   \brief this set the time to life of a particle, after which it will die
    179    \param the time to live in seconds
     191   \param dt: the time to live in seconds
     192   \param system: the system into which to emitt
    180193
    181194   if you want to change the value of this variable during emission time (to make it more dynamic)
  • orxonox/trunk/src/lib/particles/particle_emitter.h

    r4437 r4478  
    1010
    1111// FORWARD DEFINITION
    12 struct Particle;
    1312class ParticleSystem;
    1413class TiXmlElement;
    1514
    1615//! The form of the Emitter to emit from
    17 typedef enum EMITTER_TYPE {EMITTER_DOT   = 1,
    18                            EMITTER_PLANE = 2,
    19                            EMITTER_SPHERE= 4,
    20                            EMITTER_CUBE  = 8};
     16typedef enum EMITTER_TYPE { EMITTER_DOT   = 1,
     17                            EMITTER_PLANE = 2,
     18                            EMITTER_SPHERE= 4,
     19                            EMITTER_CUBE  = 8 };
    2120
    2221//! A class to handle an Emitter.
     
    5756  void debug(void);
    5857
     58
    5959 private:
    60   EMITTER_TYPE type;    //!< The type of emitter this is
    61   float emitterSize;    //!< The size of the emitter (not for EMITTER_DOT)
    62   Vector direction;     //!< emition direction
    63   float angle;          //!< max angle from the direction of the emitter
    64   float randomAngle;    //!< random emission angle (angle +- angleRandom is the emitted angle.
    65   float emissionRate;   //!< amount of particles per seconds emitted by emitter.
    66   float velocity;       //!< the initial speed of a Particles.
    67   float randomVelocity; //!< the random variation from the initial Speed.
     60  EMITTER_TYPE    type;              //!< The type of emitter this is
     61  float           emitterSize;       //!< The size of the emitter (not for EMITTER_DOT)
     62  Vector          direction;         //!< emition direction
     63  float           angle;             //!< max angle from the direction of the emitter
     64  float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
     65  float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
     66  float           velocity;          //!< the initial speed of a Particles.
     67  float           randomVelocity;    //!< the random variation from the initial Speed.
    6868
    69   float saveTime;       //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
     69  float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
    7070};
    7171
  • orxonox/trunk/src/lib/particles/particle_engine.cc

    r4381 r4478  
    253253/**
    254254   \brief draws all the systems and their Particles.
    255    \param dt the time passed in seconds (since the last Frame)
    256255*/
    257256void ParticleEngine::draw() const
  • orxonox/trunk/src/lib/particles/particle_engine.h

    r4394 r4478  
    1414template<class T> class tList;
    1515
    16 struct ParticleConnection
     16//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
     17typedef struct ParticleConnection
    1718{
    18   ParticleEmitter* emitter;    //!< The emitter to emit system from.
    19   ParticleSystem* system;      //!< The Particles emitted from emitter.
     19  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
     20  ParticleSystem*     system;      //!< The Particles emitted from emitter.
    2021};
    2122
  • orxonox/trunk/src/lib/particles/particle_system.cc

    r4436 r4478  
    3535/**
    3636   \brief standard constructor
    37    \param count the Count of particles in the System
     37   \param maxCount the Count of particles in the System
    3838   \param type The Type of the ParticleSystem
    39 
    40    \todo this constructor is not jet implemented - do it
    4139*/
    4240ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type) : PhysicsInterface(this)
     
    5452  this->glID = NULL;
    5553  this->setType(type, 1);
    56   //  this->setColor(1.0,1.0,1.0,1.0, .5,.5,.5,.5, .0,.0,.0,.0);
    5754  ParticleEngine::getInstance()->addSystem(this);
    5855}
     
    8885
    8986/**
     87   \param particleType the type of particles in this System
     88   \param count how many particles (in PARTICLE_MULTI-mode)
    9089   \todo this will be different
    9190*/
     
    115114
    116115// setting properties
     116/**
     117   \brief sets the material to an external material
     118   \param material: the material to set this material to.
     119
     120   !! important if the extern material gets deleted it MUST be unregistered here or segfault !!
     121*/
    117122void ParticleSystem::setMaterial(Material* material)
    118123{
     
    124129   \param value a Value between zero and one
    125130
    126    
    127131   if you want to change the value of this variable during emission time (to make it more dynamic)
    128132   you may want to use the animation class
     
    189193/**
    190194   \brief sets a key in the color-animation on a per-particle basis
    191    \param lifeCycleTime the time (partilceLifeTime/particleAge) [0-1]
    192    \param red red
    193    \param green green
    194    \param blue blue
     195   \param lifeCycleTime: the time (partilceLifeTime/particleAge) [0-1]
     196   \param red: red
     197   \param green: green
     198   \param blue: blue
     199   \param alpha: alpha
    195200*/
    196201void ParticleSystem::setColor(float lifeCycleTime, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
     
    270275    \brief applies some force to a Particle.
    271276    \param field the Field to apply.
    272     \param dt The time over which the field gets applied
    273277 */
    274278void ParticleSystem::applyField(Field* field)
     
    285289/**
    286290   \brief draws all the Particles of this System
    287    \param the time passed in seconds (since the last draw)
    288291
    289292   The Cases in this Function all do the same:
  • orxonox/trunk/src/lib/particles/particle_system.h

    r4436 r4478  
    1515#include "quick_animation.h"
    1616
    17 #define PARTICLE_DOT_MASK           0x000001
    18 #define PARTICLE_SPARK_MASK         0x000010
    19 #define PARTICLE_SPRITE_MASK        0x000100
    20 #define PARTICLE_MODEL_MASK         0x001000
    21 #define PARTICLE_WORDL_ENTITY_MASK  0x010000
    22 #define PARTICLE_MULTI_MASK         0x100000
     17#define PARTICLE_DOT_MASK              0x000001     //!< A Mask if the Particles should be displayed as DOTs
     18#define PARTICLE_SPARK_MASK            0x000010     //!< A Mask if the Particles should be displayed as SPARKs
     19#define PARTICLE_SPRITE_MASK           0x000100     //!< A Mask if the Particles should be displayed as SPRITESs
     20#define PARTICLE_MODEL_MASK            0x001000     //!< A Mask if the Particles should be displayed as MODELSs
     21#define PARTICLE_WORDL_ENTITY_MASK     0x010000     //!< A Mask if the Particles should be displayed as WORLD_ENTITIEs
     22#define PARTICLE_MULTI_MASK            0x100000     //!< A Mask if they are Multi-partilces
    2323
    2424//! An enumerator for the different types of particles.
    25 typedef enum PARTICLE_TYPE {PARTICLE_DOT = PARTICLE_DOT_MASK,
    26                             PARTICLE_SPARK = PARTICLE_SPARK_MASK,
    27                             PARTICLE_SPRITE = PARTICLE_SPRITE_MASK,
    28                             PARTICLE_MULTI_SPRITE = PARTICLE_SPRITE_MASK | PARTICLE_MULTI_MASK,
    29                             PARTICLE_MODEL = PARTICLE_MODEL_MASK,
    30                             PARTICLE_MULTI_MODE = PARTICLE_MODEL_MASK | PARTICLE_MULTI_MASK};
     25typedef enum PARTICLE_TYPE { PARTICLE_DOT           = PARTICLE_DOT_MASK,
     26                             PARTICLE_SPARK         = PARTICLE_SPARK_MASK,
     27                             PARTICLE_SPRITE        = PARTICLE_SPRITE_MASK,
     28                             PARTICLE_MULTI_SPRITE  = PARTICLE_SPRITE_MASK | PARTICLE_MULTI_MASK,
     29                             PARTICLE_MODEL         = PARTICLE_MODEL_MASK,
     30                             PARTICLE_MULTI_MODE    =  PARTICLE_MODEL_MASK | PARTICLE_MULTI_MASK };
    3131
    32 #define PARTICLE_DEFAULT_MAX_COUNT    200               //!< a default count of particles in the system.
     32#define PARTICLE_DEFAULT_MAX_COUNT    200               //!< A default count of particles in the system.
    3333#define PARTICLE_DEFAULT_TYPE         PARTICLE_SPRITE   //!< A default type of the system.
    3434
     
    4949  Quaternion rotation;        //!< The current rotation of this particle.
    5050  float mass;                 //!< The mass of this particle.
    51   float massRand;
     51  float massRand;             //!< A random mass
    5252  float radius;               //!< The current size of this particle.
    53   float radiusRand;
     53  float radiusRand;           //!< a random Radius
    5454
    5555  GLfloat color [4];          //!< A Color for the particles.
    56 
    57   PARTICLE_TYPE type;
    5856
    5957  Particle* next;             //!< pointer to the next particle in the List. (NULL if no preceding one)
     
    9896
    9997  virtual void applyField(Field* field);
     98  /** \brief this is an empty function, because the Physics are implemented in tick \param dt: useless here */
    10099  virtual void tickPhys(float dt) {};
    101100
     
    108107
    109108 private:
    110   char* name;                // the Name of the Particle System
     109  char*             name;                //!< the Name of the Particle System
    111110
    112   float conserve;            //!< How much energy gets conserved to the next Tick.
    113   float lifeSpan;            //!< Initial lifetime of a Particle.
    114   float randomLifeSpan;      //!< A random value for the Lifespan (around the initial lifetime)
    115   float initialMass;         //!< The initial Mass of the Particle
    116   float randomInitialMass;   //!< The random initial Mass of the Particle
    117   float inheritSpeed;        //!< How much speed the particle inherits from the Emitters speed \todo move this to the emitter
     111  float             conserve;            //!< How much energy gets conserved to the next Tick.
     112  float             lifeSpan;            //!< Initial lifetime of a Particle.
     113  float             randomLifeSpan;      //!< A random value for the Lifespan (around the initial lifetime)
     114  float             initialMass;         //!< The initial Mass of the Particle
     115  float             randomInitialMass;   //!< The random initial Mass of the Particle
     116  float             inheritSpeed;        //!< How much speed the particle inherits from the Emitters speed \todo move this to the emitter
    118117
    119118  // particles
    120   int maxCount;              //!< The maximum count of Particles.
    121   int count;                 //!< The current count of Particles.
    122   PARTICLE_TYPE particleType;//!< A type for all the Particles
    123   Material* material;        //!< A Material for all the Particles.
    124   Particle* particles;       //!< A list of particles of this System.
    125   Particle* deadList;        //!< A list of dead Particles in the System.
     119  int               maxCount;            //!< The maximum count of Particles.
     120  int               count;               //!< The current count of Particles.
     121  PARTICLE_TYPE     particleType;        //!< A type for all the Particles
     122  Material*         material;            //!< A Material for all the Particles.
     123  Particle*         particles;           //!< A list of particles of this System.
     124  Particle*         deadList;            //!< A list of dead Particles in the System.
    126125
    127   GLuint* glID;              //!< A List of different gl-List-ID's
    128   GLuint dialectCount;       //!< How many different types of particles are there in the Particle System 
     126  GLuint*           glID;                //!< A List of different gl-List-ID's
     127  GLuint            dialectCount;        //!< How many different types of particles are there in the Particle System 
    129128
    130129  // per particle attributes
    131   QuickAnimation radiusAnim;
    132   QuickAnimation randRadiusAnim;
    133   QuickAnimation massAnim;
    134   QuickAnimation randMassAnim;
    135   QuickAnimation colorAnim[4];
     130  QuickAnimation radiusAnim;             //!< Animation of the radius
     131  QuickAnimation randRadiusAnim;         //!< Animation of the random Value of the radius
     132  QuickAnimation massAnim;               //!< Animation of the mass
     133  QuickAnimation randMassAnim;           //!< Animation of the random Mass
     134  QuickAnimation colorAnim[4];           //!< Animation of the 4 colors (r,g,b,a)
    136135};
    137136
Note: See TracChangeset for help on using the changeset viewer.