Changeset 3935 in orxonox.OLD for orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc
- Timestamp:
- Apr 23, 2005, 3:30:45 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc
r3934 r3935 40 40 this->particleType = type; 41 41 this->particles = NULL; 42 this-> conserve = 1.0;42 this->setConserve(.8); 43 43 this->setLifeSpan(.1); 44 44 … … 54 54 { 55 55 // delete what has to be deleted here 56 ParticleEngine::getInstance()->removeSystem(this); 56 57 } 57 58 … … 59 60 void ParticleSystem::setMaterial(Material* material) 60 61 { 61 62 this->material = material; 62 63 } 63 64 … … 70 71 void ParticleSystem::setRadius(float startRadius, float endRadius, float randomRadius) 71 72 { 72 73 this->startRadius = startRadius; 74 this->endRadius = endRadius; 75 this->randomRadius = randomRadius; 73 76 } 74 77 75 78 void ParticleSystem::setConserve(float conserve) 76 79 { 77 this->conserve = conserve; 80 if (conserve > 1.0) 81 this->conserve = 1.0; 82 else if (conserve < 0.0) 83 this->conserve = 0.0; 84 else 85 this->conserve = conserve; 78 86 } 79 87 … … 86 94 while (likely(tickPart != NULL)) 87 95 { 88 96 89 97 tickPart->position = tickPart->position + tickPart->velocity; 90 98 // many more to come … … 94 102 95 103 96 104 if (this->conserve < 1.0) 105 tickPart->velocity = tickPart->velocity * this->conserve; 97 106 // find out if we have to delete tickPart 98 107 if ((tickPart->timeToLive -= dt) <= 0) … … 113 122 } 114 123 --this->count; 115 printf("deleted particle: count %d\n", count);116 124 } 117 125 else … … 128 136 if (likely(drawPart != NULL)) 129 137 { 130 glBegin(GL_ TRIANGLES);138 glBegin(GL_POINTS); 131 139 while (likely(drawPart != NULL)) 132 140 {
Note: See TracChangeset
for help on using the changeset viewer.