Changeset 4123 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 9, 2005, 3:39:52 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/particles/particle_system.cc
r4017 r4123 40 40 this->particleType = type; 41 41 this->particles = NULL; 42 this->deadList = NULL; 42 43 this->setConserve(.8); 43 44 this->setLifeSpan(.1); … … 57 58 // delete what has to be deleted here 58 59 ParticleEngine::getInstance()->removeSystem(this); 60 61 // deleting all the living Particles 62 while (this->particles) 63 { 64 Particle* tmpDelPart = this->particles; 65 this->particles = this->particles->next; 66 delete tmpDelPart; 67 } 68 69 // deleting all the dead particles 70 while (this->deadList) 71 { 72 Particle* tmpDelPart = this->deadList; 73 this->deadList = this->deadList->next; 74 delete tmpDelPart; 75 } 59 76 } 60 77 … … 199 216 { 200 217 prevPart->next = tickPart->next; 201 delete tickPart; 218 tickPart->next = this->deadList; 219 this->deadList = tickPart; 202 220 tickPart = prevPart->next; 203 221 } … … 206 224 prevPart = NULL; 207 225 this->particles = tickPart->next; 208 delete tickPart; 226 tickPart->next = this->deadList; 227 this->deadList = tickPart; 209 228 tickPart = this->particles; 210 229 } … … 266 285 if (unlikely(particles == NULL)) 267 286 { 268 this->particles = new Particle; 287 if (likely(deadList != NULL)) 288 { 289 this->particles = this->deadList; 290 deadList = deadList->next; 291 } 292 else 293 this->particles = new Particle; 269 294 this->particles->next = NULL; 270 295 } … … 272 297 else 273 298 { 274 Particle* tmpPart = new Particle; 299 Particle* tmpPart; 300 if (likely(deadList != NULL)) 301 { 302 tmpPart = this->deadList; 303 deadList = deadList->next; 304 } 305 else 306 tmpPart = new Particle; 275 307 tmpPart->next = this->particles; 276 308 this->particles = tmpPart; … … 300 332 PRINT(0)(" ParticleSystem %s\n", this->name); 301 333 PRINT(0)(" ParticleCount: %d, maximumCount: %d :: filled %d%%\n", this->count, this->maxCount, 100*this->count/this->maxCount); 302 } 334 if (deadList) 335 { 336 PRINT(0)(" - ParticleDeadList is used: "); 337 int i = 1; 338 Particle* tmpPart = this->deadList; 339 while (tmpPart = tmpPart->next) ++i; 340 PRINT(0)("count: %d\n", i); 341 } 342 } -
orxonox/trunk/src/lib/graphics/particles/particle_system.h
r4017 r4123 92 92 Material* material; //!< A Material for all the Particles. 93 93 Particle* particles; //!< A list of particles of this System. 94 Particle* deadList; //!< A list of dead Particles in the System. 94 95 95 96 GLuint* glID; //!< A List of different gl-List-ID's
Note: See TracChangeset
for help on using the changeset viewer.