Changeset 10107 in orxonox.OLD for branches/playability/src/world_entities/particles
- Timestamp:
- Dec 19, 2006, 10:03:19 PM (18 years ago)
- Location:
- branches/playability/src/world_entities/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/particles/emitter_node.cc
r10098 r10107 21 21 22 22 #include "util/loading/load_param.h" 23 #include "util/loading/factory.h" 23 24 #include "debug.h" 24 25 25 26 ObjectListDefinition(EmitterNode); 27 //CREATE_FAST_FACTORY(EmitterNode); 26 28 27 29 /** … … 32 34 this->registerObject(this, EmitterNode::_objectList); 33 35 36 this->toList(OM_DEAD_TICK); 37 34 38 this->system = NULL; 35 39 this->emitter = NULL; 36 40 this->lifeCycle = 0.0; 37 41 this->lifeSpan = lifetime; 42 43 this->setParent( PNode::getNullParent()); 38 44 } 39 45 … … 64 70 { 65 71 this->started = true; 72 73 this->emitter->start(); 74 this->emitter->setSystem( this->system); 75 66 76 return this->started; 67 77 } … … 69 79 void EmitterNode::tick(float dt) 70 80 { 81 71 82 if( !this->started) 72 83 return; 73 84 74 85 this->lifeCycle += dt/this->lifeSpan; 75 if (this->lifeCycle >= 1) 86 87 if( this->lifeCycle >= 1.0f) 76 88 { 77 89 this->removeNode(); 78 this->hide();79 this->system->removeEmitter(this->emitter);80 90 this->emitter->stop(); 81 91 this->emitter->setSystem(NULL); 82 92 this->started = false; 93 94 this->destroy( NULL ); 83 95 } 84 PRINTF(0)("Coordinate Update EmitterNode: (%f,%f,%f) -> (%f,%f,%f)\n",this->getAbsCoor().x,this->getAbsCoor().y,this->getAbsCoor().z,this->velocity.x,this->velocity.y,this->velocity.z); 85 this->setAbsCoor(this->getAbsCoor() + (this->velocity * dt)); 96 this->shiftCoor(this->velocity * dt); 86 97 } -
branches/playability/src/world_entities/particles/emitter_node.h
r10098 r10107 1 1 /*! 2 * @file particle_emitter.h2 * @file emitter_node.h 3 3 * Definition of a EmitterNode 4 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. … … 32 32 inline void setVelocity(Vector velocity) { this->velocity = velocity;}; 33 33 34 inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this-> system = system; this->system->setLifeSpan(this->lifeSpan);} ;34 inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->emitter->setParent( this); this->system = system;} ; 35 35 void setLifetime( float lifeTime) { this->lifeSpan = lifeTime;}; 36 36
Note: See TracChangeset
for help on using the changeset viewer.