Changeset 3945 in orxonox.OLD for orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc
- Timestamp:
- Apr 24, 2005, 4:06:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc
r3944 r3945 53 53 54 54 /** 55 \brief standard destructor 56 55 \brief deletes all the system, emitters, connections and Lists 57 56 */ 58 57 ParticleEngine::~ParticleEngine () 59 58 { 59 // delete all remaining systems 60 tIterator<ParticleSystem>* sysIt = this->systemList->getIterator(); 61 ParticleSystem* tmpSys = sysIt->nextElement(); 62 while(tmpSys) 63 { 64 delete tmpSys; 65 tmpSys = sysIt->nextElement(); 66 } 67 delete sysIt; 60 68 delete this->systemList; 61 69 62 delete this->connectionList; 70 // delete all remaining emitters 71 tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator(); 72 ParticleEmitter* tmpEmit = emitIt->nextElement(); 73 while(tmpEmit) 74 { 75 delete tmpEmit; 76 tmpEmit = emitIt->nextElement(); 77 } 78 delete emitIt; 79 delete this->emitterList; 80 81 // there should be no more Connections 82 if (this->connectionList->getSize() == 0) 83 delete this->connectionList; 84 else 85 PRINTF(2)("The Connection List is not empty. This should not happen.\n"); 63 86 64 87 ParticleEngine::singletonRef = NULL; 65 88 } 66 89 90 /** 91 \brief Adds a System to the System list. 92 93 this is done automatically when creating a ParticleSystem 94 */ 67 95 void ParticleEngine::addSystem(ParticleSystem* system) 68 96 { … … 70 98 } 71 99 100 /** 101 \brief Adds an emitter to the emitterList 102 103 this is done automatically when creating a ParticleEmitter 104 */ 72 105 void ParticleEngine::addEmitter(ParticleEmitter* emitter) 73 106 { … … 76 109 77 110 /** 78 \brief 79 80 \ todo header, check for double connections111 \brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles. 112 \param emitter the Emitter to connect to the System 113 \param system the System to connect to the Emitter 81 114 */ 82 115 void ParticleEngine::addConnection(ParticleEmitter* emitter, ParticleSystem* system) … … 107 140 } 108 141 109 142 /** 143 \brief Removes a system from the systemList and also removes all Connections to the System 144 \param system The ParticleSystem to delete 145 */ 110 146 bool ParticleEngine::removeSystem(ParticleSystem* system) 111 147 { … … 125 161 } 126 162 163 /** 164 \brief removes an emitter from the emitterList and also from all Connections it is attached to. 165 \param emitter the ParticleEmitter to remove. 166 */ 127 167 bool ParticleEngine::removeEmitter(ParticleEmitter* emitter) 128 168 { … … 142 182 } 143 183 144 184 /** 185 \brief removes a Connection between an Emitter and a System 186 \param emitter The emitter of the connection to remove 187 \param system The system of the connection to remove 188 \returns true, if the connection was broken, false if the conntection was not found 189 190 only if both system and emitter are in the connection the Connection will be broken 191 */ 145 192 bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system) 146 193 { … … 150 197 while(tmpConnection) 151 198 { 152 if (tmpConnection->emitter == emitter && tmpConnection->system == system) 199 if (tmpConnection->emitter == emitter && tmpConnection->system == system) 200 { 153 201 this->breakConnection(tmpConnection); 154 tmpConnection = tmpConIt->nextElement(); 155 } 156 delete tmpConIt; 157 } 158 202 delete tmpConIt; 203 return true; 204 } 205 tmpConnection = tmpConIt->nextElement(); 206 } 207 delete tmpConIt; 208 return false; 209 } 210 211 /** 212 \brief removes a Connection between an Emitter and a System 213 \param connection the connection to remove 214 215 \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system) 216 */ 159 217 bool ParticleEngine::breakConnection(ParticleConnection* connection) 160 218 { 161 219 this->connectionList->remove(connection); 220 return true; 162 221 } 163 222 … … 169 228 void ParticleEngine::tick(float dt) 170 229 { 171 // add new Particles to each System they are connected to.230 // add new Particles to each System connected to an Emitter. 172 231 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 173 232 ParticleConnection* tmpConnection = tmpConIt->nextElement(); … … 191 250 } 192 251 193 252 /** 253 \brief draws all the systems and their Particles. 254 */ 194 255 void ParticleEngine::draw(void) 195 256 {
Note: See TracChangeset
for help on using the changeset viewer.