| Line |   | 
|---|
| 1 | /*! | 
|---|
| 2 |  * @file emitter_node.h | 
|---|
| 3 |   *  Definition of a EmitterNode | 
|---|
| 4 |   *  An emitter node is a node that takes an emitter and a particle system and keeps them alive for a given amount of time. | 
|---|
| 5 | */ | 
|---|
| 6 |  | 
|---|
| 7 | #ifndef _EMITTER_NODE_H | 
|---|
| 8 | #define _EMITTER_NODE_H | 
|---|
| 9 |  | 
|---|
| 10 | #include "world_entity.h" | 
|---|
| 11 | #include "dot_emitter.h" | 
|---|
| 12 | #include "particle_system.h" | 
|---|
| 13 |  | 
|---|
| 14 | // FORWARD DECLARATION | 
|---|
| 15 | class DotEmitter; | 
|---|
| 16 | class ParticleEmitter; | 
|---|
| 17 | class TiXmlElement; | 
|---|
| 18 |  | 
|---|
| 19 | //! A class to handle an Emitter. | 
|---|
| 20 | class EmitterNode : public WorldEntity | 
|---|
| 21 | { | 
|---|
| 22 |   ObjectListDeclaration(EmitterNode); | 
|---|
| 23 | public: | 
|---|
| 24 |   EmitterNode(float lifetime); | 
|---|
| 25 |   virtual ~EmitterNode(); | 
|---|
| 26 |  | 
|---|
| 27 |   virtual void loadParams(const TiXmlElement* root = NULL); | 
|---|
| 28 |    | 
|---|
| 29 |   virtual void tick( float time); | 
|---|
| 30 |  | 
|---|
| 31 |   bool start(); | 
|---|
| 32 |   inline void setVelocity(Vector velocity) { this->velocity = velocity;}; | 
|---|
| 33 |  | 
|---|
| 34 |   inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->emitter->setParent( this); this->system = system;} ; | 
|---|
| 35 |   void setLifetime( float lifeTime) { this->lifeSpan  = lifeTime;}; | 
|---|
| 36 |  | 
|---|
| 37 | private: | 
|---|
| 38 |   float           lifeSpan;           //!< Life time of this emitter node | 
|---|
| 39 |   float           lifeCycle;           | 
|---|
| 40 |   bool            started;            //!< was this emitter node started? | 
|---|
| 41 |  | 
|---|
| 42 |   Vector          velocity;           //!< Velocity per second of the node | 
|---|
| 43 |  | 
|---|
| 44 |   DotEmitter*  emitter;          //!< emitter which is held and kept alive | 
|---|
| 45 |   ParticleSystem*   system;           //!< system to be used on the particle emitter | 
|---|
| 46 | }; | 
|---|
| 47 |  | 
|---|
| 48 | #endif /* _EMITTER_NODE_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.