Rev | Line | |
---|
[10077] | 1 | /*! |
---|
| 2 | * @file particle_emitter.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 "p_node.h" |
---|
| 11 | #include "dot_emitter.h" |
---|
| 12 | |
---|
| 13 | // FORWARD DECLARATION |
---|
| 14 | class DotEmitter; |
---|
| 15 | class ParticleEmitter; |
---|
| 16 | class TiXmlElement; |
---|
| 17 | |
---|
| 18 | //! A class to handle an Emitter. |
---|
| 19 | class EmitterNode : public PNode |
---|
| 20 | { |
---|
| 21 | ObjectListDeclaration(EmitterNode); |
---|
| 22 | public: |
---|
| 23 | EmitterNode(float lifetime); |
---|
| 24 | virtual ~EmitterNode(); |
---|
| 25 | |
---|
| 26 | virtual void loadParams(const TiXmlElement* root = NULL); |
---|
| 27 | |
---|
| 28 | virtual void tick( float time); |
---|
| 29 | |
---|
| 30 | void start(); |
---|
| 31 | inline void setVelocity(Vector velocity) { this->velocity = velocity;}; |
---|
| 32 | |
---|
| 33 | inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->system = system;} ; |
---|
| 34 | void setLifetime( float lifeTime) { this->lifeSpan = lifeTime;}; |
---|
| 35 | |
---|
| 36 | private: |
---|
| 37 | float lifeSpan; //!< Life time of this emitter node |
---|
| 38 | float lifeCycle; |
---|
| 39 | bool started; //!< was this emitter node started? |
---|
| 40 | |
---|
| 41 | Vector velocity; //!< Velocity per second of the node |
---|
| 42 | |
---|
| 43 | DotEmitter* emitter; //!< emitter which is held and kept alive |
---|
| 44 | ParticleSystem* system; //!< system to be used on the particle emitter |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | #endif /* _EMITTER_NODE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.