Changeset 6612 in orxonox.OLD for trunk/src/lib/particles
- Timestamp:
- Jan 19, 2006, 1:50:39 AM (19 years ago)
- Location:
- trunk/src/lib/particles
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/particles/particle_engine.cc
r5654 r6612 309 309 { 310 310 // ticks all the ParticleSystems 311 // tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 312 // ParticleSystem* tmpSys = tmpIt->firstElement(); 313 // while(tmpSys) 314 // { 315 // tmpSys->tick(dt); 316 // tmpSys = tmpIt->nextElement(); 317 // } 318 // delete tmpIt; 319 320 // add new Particles to each System connected to an Emitter. 321 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 322 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 323 while(tmpConnection) 324 { 325 tmpConnection->emitter->tick(dt, tmpConnection->system); 326 tmpConnection = tmpConIt->nextElement(); 327 } 328 delete tmpConIt; 329 } 330 331 /** 332 * draws all the systems and their Particles. 333 */ 334 void ParticleEngine::draw() const 335 { 336 /* 311 337 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 312 338 ParticleSystem* tmpSys = tmpIt->firstElement(); 313 339 while(tmpSys) 314 340 { 315 tmpSys->tick(dt);316 tmpSys = tmpIt->nextElement();317 }318 delete tmpIt;319 320 // add new Particles to each System connected to an Emitter.321 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();322 ParticleConnection* tmpConnection = tmpConIt->firstElement();323 while(tmpConnection)324 {325 tmpConnection->emitter->tick(dt, tmpConnection->system);326 tmpConnection = tmpConIt->nextElement();327 }328 delete tmpConIt;329 }330 331 /**332 * draws all the systems and their Particles.333 */334 void ParticleEngine::draw() const335 {336 tIterator<ParticleSystem>* tmpIt = systemList->getIterator();337 ParticleSystem* tmpSys = tmpIt->firstElement();338 while(tmpSys)339 {340 341 tmpSys->draw(); 341 342 tmpSys = tmpIt->nextElement(); 342 343 } 343 delete tmpIt; 344 delete tmpIt;*/ 344 345 345 346 } -
trunk/src/lib/particles/particle_system.cc
r6512 r6612 31 31 32 32 #include "parser/tinyxml/tinyxml.h" 33 #include <algorithm> 34 33 35 34 36 CREATE_FACTORY(ParticleSystem, CL_PARTICLE_SYSTEM); … … 107 109 this->setType(PARTICLE_DEFAULT_TYPE, 1); 108 110 ParticleEngine::getInstance()->addSystem(this); 111 112 this->toList(OM_ENVIRON); 109 113 } 110 114 … … 132 136 133 137 LoadParam(root, "texture", this, ParticleSystem, setMaterialTexture); 138 LoadParamXML(root, "emitter", this, ParticleSystem, addEmitterXML); 134 139 135 140 LOAD_PARAM_START_CYCLE(root, element); … … 147 152 } 148 153 LOAD_PARAM_END_CYCLE(element); 149 150 154 } 151 155 … … 288 292 this->colorAnim[2].changeEntry(lifeCycleTime, blue); 289 293 this->colorAnim[3].changeEntry(lifeCycleTime, alpha); 294 } 295 296 297 void ParticleSystem::addEmitter(ParticleEmitter* emitter) 298 { 299 this->emitters.push_back(emitter); 300 } 301 302 void ParticleSystem::addEmitterXML(const TiXmlElement* emitterRoot) 303 { 304 ParticleEmitter* emitter = new ParticleEmitter(emitterRoot); 305 this->addEmitter(emitter); 306 } 307 308 309 void ParticleSystem::removeEmitter(ParticleEmitter* emitter) 310 { 311 std::list<ParticleEmitter*>::iterator it = std::find(this->emitters.begin(), this->emitters.end(), emitter); 312 if (it != this->emitters.end()) 313 this->emitters.erase(it); 290 314 } 291 315 … … 357 381 } 358 382 } 383 384 std::list<ParticleEmitter*>::iterator emitter; 385 for (emitter = this->emitters.begin(); emitter != this->emitters.end(); emitter++) 386 (*emitter)->tick(dt, this); 359 387 } 360 388 -
trunk/src/lib/particles/particle_system.h
r6512 r6612 12 12 #include "glincl.h" 13 13 #include "vector.h" 14 #include <list> 14 15 15 16 #include "quick_animation.h" … … 107 108 virtual unsigned int getFaceCount() const; 108 109 110 void addEmitter(ParticleEmitter* emitter); 111 void addEmitterXML(const TiXmlElement* emitterRoot); 112 void removeEmitter(ParticleEmitter* emitter); 109 113 110 114 virtual void applyField(Field* field); … … 136 140 GLuint dialectCount; //!< How many different types of particles are there in the Particle System 137 141 142 std::list<ParticleEmitter*> emitters; //!< The Emitters that do emit into this System. 143 138 144 // per particle attributes 139 145 QuickAnimation radiusAnim; //!< Animation of the radius
Note: See TracChangeset
for help on using the changeset viewer.