Changeset 4437 in orxonox.OLD for orxonox/trunk/src/lib/particles
- Timestamp:
- Jun 1, 2005, 5:24:24 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/particles/particle_emitter.cc
r4381 r4437 21 21 #include "particle_engine.h" 22 22 23 #include "load_param.h" 23 24 #include "debug.h" 24 25 #include "stdlibincl.h" … … 33 34 float velocity) 34 35 { 36 } 37 38 ParticleEmitter::ParticleEmitter(const TiXmlElement* root) 39 { 35 40 this->setClassID(CL_PARTICLE_EMITTER, "ParticleEmitter"); 36 41 37 this->type = EMITTER_DOT;38 this->emitterSize = 1.0;39 this->direction = direction;40 this->setSpread(angle);41 this->setEmissionRate(emissionRate);42 this->setEmissionVelocity(velocity);43 44 42 this->saveTime = 0.0; 45 43 44 if (root) 45 this->loadParams(root); 46 46 47 ParticleEngine::getInstance()->addEmitter(this); 47 48 } 48 49 49 50 51 50 /** 52 51 \brief standard destructor … … 58 57 } 59 58 59 void ParticleEmitter::loadParams(const TiXmlElement* root) 60 { 61 static_cast<PNode*>(this)->loadParams(root); 62 63 LoadParam<ParticleEmitter>(root, "type", this, &ParticleEmitter::setType) 64 .describe("What type of emitter is this [dot, plane, cube, sphere]."); 65 66 LoadParam<ParticleEmitter>(root, "size", this, &ParticleEmitter::setSize) 67 .describe("How big the emitter is (no effect on dot-emitters)"); 68 69 LoadParam<ParticleEmitter>(root, "rate", this, &ParticleEmitter::setEmissionRate) 70 .describe("How many particles should be emittet from this emitter"); 71 72 LoadParam<ParticleEmitter>(root, "emission-velocity", this, &ParticleEmitter::setEmissionVelocity) 73 .describe("How fast the particles are emittet (their initial speed)"); 74 75 LoadParam<ParticleEmitter>(root, "spread", this, &ParticleEmitter::setSpread) 76 .describe("The angle the particles are emitted from (angle, deviation)"); 77 78 } 60 79 61 80 /** … … 82 101 this->type = type; 83 102 } 103 104 /** 105 \param the type of emitter 106 */ 107 void ParticleEmitter::setType(const char* type) 108 { 109 if (!strcmp(type, "plane")) 110 this->type = EMITTER_PLANE; 111 else if (!strcmp(type, "cube")) 112 this->type = EMITTER_CUBE; 113 else if (!strcmp(type, "sphere")) 114 this->type = EMITTER_SPHERE; 115 else 116 this->type = EMITTER_DOT; 117 } 118 84 119 85 120 void ParticleEmitter::setSize(float emitterSize) -
orxonox/trunk/src/lib/particles/particle_emitter.h
r4381 r4437 12 12 struct Particle; 13 13 class ParticleSystem; 14 class TiXmlElement; 14 15 15 16 //! The form of the Emitter to emit from … … 25 26 ParticleEmitter(const Vector& direction, float angle = .5, 26 27 float emissionRate = 1.0, float velocity = 1.0); 28 ParticleEmitter(const TiXmlElement* root); 27 29 virtual ~ParticleEmitter(void); 30 31 void loadParams(const TiXmlElement* root); 28 32 29 33 /* controlling the emitter: interface */ … … 34 38 /* controlling the behavour: these can be used as Animation interfaces */ 35 39 void setType(EMITTER_TYPE type); 40 void setType(const char* type); 36 41 void setSize(float emitterSize); 37 42 void setEmissionRate(float emissionRate);
Note: See TracChangeset
for help on using the changeset viewer.