Changeset 3931 in orxonox.OLD for orxonox/branches/particleEngine/src
- Timestamp:
- Apr 22, 2005, 10:01:18 PM (20 years ago)
- 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 25 25 */ 26 26 ParticleEmitter::ParticleEmitter(const Vector& direction, float angle, float emissionRate, 27 float velocity , float ttl)27 float velocity) 28 28 { 29 29 this->setClassName ("ParticleEmitter"); … … 61 61 62 62 /** 63 \brief set the angle of the emitter64 \param angle around the direction in which there are particles to be emitted65 \param random A random spread-angle, the +- randomness of this option66 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 class69 */70 void ParticleEmitter::setSpread(float angle, float random)71 {}72 73 74 /**75 63 \brief set the emission rate 76 64 \param sets the number of particles emitted per second … … 80 68 you may want to use the animation class 81 69 */ 82 void ParticleEmitter::setEmissionRate(float emissionRate , float random)70 void ParticleEmitter::setEmissionRate(float emissionRate) 83 71 {} 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 */ 81 void ParticleEmitter::setSpread(float angle, float randomAngle) 82 {} 83 84 84 85 85 86 … … 103 104 */ 104 105 105 /**106 \brief this is called from the particle emitter to give the pulse of time...107 \param time passed since last tick108 */109 void ParticleEmitter::tick(float dt)110 {} -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.h
r3930 r3931 13 13 class ParticleSystem; 14 14 15 typedef enum EMITTER_TYPE {EMITTER_DOT, 16 EMITTER_PLANE, 17 EMITTER_SPHERE, 18 EMITTER_CUBE}; 15 19 16 20 //! A default singleton class. … … 19 23 public: 20 24 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); 22 26 virtual ~ParticleEmitter(void); 23 27 … … 27 31 28 32 /* controlling the behavour: these can be used as Animation interfaces */ 29 void set Spread(float angle, float random = 0.0);30 void set EmissionRate(float emissionRate, float random= 0.0);33 void setEmissionRate(float emissionRate); 34 void setSpread(float angle, float randomAngle = 0.0); 31 35 void setVelocity(float velocity, float random = 0.0); 32 33 /* some functions needed for internal use */34 void tick(float dt);35 36 36 37 private: 37 38 Vector direction; //!< emition direction 38 39 float angle; //!< max angle from the direction of the emitter 40 float angleRandom; //!< random emission angle (angle +- angleRandom is the emitted angle. 39 41 float emissionRate; //!< amount of particles per seconds emitted by emiter 40 42 float velocity; //!< the contant speed a particle gets if been emitted -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc
r3930 r3931 18 18 #include "particle_engine.h" 19 19 20 #include "particle_system.h" 21 #include "particle_emitter.h" 22 20 23 #include "list.h" 21 24 … … 29 32 this->setClassName ("ParticleEngine"); 30 33 31 this-> partSysList = new tList<ParticleSystem>;34 this->systemList = new tList<ParticleSystem>; 32 35 } 33 36 … … 53 56 ParticleEngine::~ParticleEngine () 54 57 { 55 delete this-> partSysList;58 delete this->systemList; 56 59 57 60 58 61 ParticleEngine::singletonRef = NULL; 59 62 } 63 64 /** 65 \brief this function ticks all the ParticleSystems, so an animation will flow 66 \param dt passed since last tick 67 */ 68 void 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 12 12 template<class T> class tList; 13 13 class ParticleSystem; 14 class ParticleEmitter; 14 15 16 struct ParticleConnection 17 { 18 ParticleEmitter* emitter; //!< The emitter to emit system from. 19 ParticleSystem* system; //!< The Particles emitted from emitter. 20 }; 15 21 16 22 //! A default singleton class. … … 23 29 void tick(float dt); 24 30 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 25 39 private: 26 40 ParticleEngine(void); 27 41 static ParticleEngine* singletonRef; 28 42 29 tList<ParticleSystem>* partSysList; 43 tList<ParticleSystem>* systemList; 44 tList<ParticleEmitter>* emitterList; 45 46 tList<ParticleConnection>* connectionList; 30 47 }; 31 48 -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc
r3930 r3931 48 48 } 49 49 50 51 void ParticleSystem::tick(float dt) 52 { 53 54 55 } -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h
r3930 r3931 13 13 typedef enum PARTICLE_TYPE {PARTICLE_DOT, 14 14 PARTICLE_SPRITE, 15 PARTICLE_MULTI_SPRITE, 15 16 PARTICLE_OBJECT, 16 PARTICLE_ OBJECT_ARRAY,17 PARTICLE_MULTI_OBJECT, 17 18 PARTICLE_PRIMITIVE}; 18 19 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. 20 21 #define PARTICLE_DEFAULT_TYPE PARTICLE_SPRITE //!< A default type of the system. 21 22 … … 32 33 Vector velocity; //!< The current velocity of this particle. 33 34 Quaternion rotation; //!< The current rotation of this particle. 35 float mass; //!< The mass of this particle. 36 float radius; //!< The size of this particle. 34 37 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) 36 40 }; 37 41 … … 40 44 41 45 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); 43 47 virtual ~ParticleSystem(); 44 48 45 49 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); 47 54 48 55 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. 51 67 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.55 68 }; 56 69
Note: See TracChangeset
for help on using the changeset viewer.