- Timestamp:
- Oct 29, 2005, 11:08:08 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r5434 r5445 172 172 CL_LIGHT = 0x00000809, 173 173 CL_PARTICLE_EMITTER = 0x0000080a, 174 CL_PARTICLE_SYSTEM = 0x0000080 a,174 CL_PARTICLE_SYSTEM = 0x0000080b, 175 175 CL_ENVIRONMENT = 0x00000810, 176 176 CL_SHADER = 0x00000811, -
trunk/src/lib/particles/particle_emitter.cc
r5357 r5445 54 54 this->init(); 55 55 56 if (root )56 if (root != NULL) 57 57 this->loadParams(root); 58 58 -
trunk/src/lib/particles/particle_engine.cc
r5439 r5445 51 51 ParticleEngine::~ParticleEngine () 52 52 { 53 // we must not do this, because PNoe does it for us 54 // or we do this with help from ClassList, which essentially makes much more sense 53 /// @todo we must not do this, because PNoe does it for us 54 /// or we do this with help from ClassList, which essentially makes much more sense 55 55 56 // delete all remaining systems 56 57 // tIterator<ParticleSystem>* sysIt = this->systemList->getIterator(); … … 64 65 delete this->systemList; 65 66 // 66 //// delete all remaining emitters67 //tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();68 //ParticleEmitter* tmpEmit = emitIt->firstElement();69 //while(tmpEmit)70 //{71 //delete tmpEmit;72 //tmpEmit = emitIt->nextElement();73 //}74 //delete emitIt;67 // delete all remaining emitters 68 tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator(); 69 ParticleEmitter* tmpEmit = emitIt->firstElement(); 70 while(tmpEmit) 71 { 72 delete tmpEmit; 73 tmpEmit = emitIt->nextElement(); 74 } 75 delete emitIt; 75 76 delete this->emitterList; 76 77 … … 119 120 } 120 121 122 #include "class_list.h" 121 123 /** 122 124 * @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles. … … 126 128 void ParticleEngine::addConnection(const char* emitter, const char* system) 127 129 { 128 ParticleEmitter* tmpEmit = this->getEmitterByName(emitter);129 ParticleSystem* tmpSys = this->getSystemByName(system);130 ParticleEmitter* tmpEmit = dynamic_cast<ParticleEmitter*>(ClassList::getObject(emitter, CL_PARTICLE_EMITTER));//this->getEmitterByName(emitter); 131 ParticleSystem* tmpSys = dynamic_cast<ParticleSystem*>(ClassList::getObject(system, CL_PARTICLE_SYSTEM));//this->getSystemByName(system); 130 132 131 133 if (tmpEmit != NULL && tmpSys != NULL) … … 154 156 if (tmpConnection->emitter == emitter && tmpConnection->system == system) 155 157 { 156 PRINTF(2)("Connection between Emitter and System already added\n");158 PRINTF(2)("Connection between Emitter and System already exists.\n"); 157 159 delete tmpConIt; 158 160 return; … … 181 183 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 182 184 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 183 while(tmpConnection )185 while(tmpConnection != NULL) 184 186 { 185 187 if (tmpConnection->system == system) … … 202 204 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 203 205 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 204 while(tmpConnection )206 while(tmpConnection != NULL) 205 207 { 206 208 if (tmpConnection->emitter == emitter) … … 298 300 299 301 /** 300 * @param systemName the name of the system to search for301 * @returns the system called by systemName or NULL if not found302 */303 ParticleSystem* ParticleEngine::getSystemByName(const char* systemName) const304 {305 tIterator<ParticleSystem>* tmpIt = systemList->getIterator();306 ParticleSystem* tmpSys = tmpIt->firstElement();307 while(tmpSys)308 {309 if (!strcmp(systemName, tmpSys->getName()))310 {311 delete tmpIt;312 return tmpSys;313 }314 tmpSys = tmpIt->nextElement();315 }316 delete tmpIt;317 return NULL;318 }319 320 /**321 302 * @param number the n-th system to return 322 303 * @returns the system called by number or NULL if not found … … 342 323 343 324 /** 344 * @param emitterName the name of the emitter to search for345 * @returns the emitter called by emitterName or NULL if not found346 */347 ParticleEmitter* ParticleEngine::getEmitterByName(const char* emitterName) const348 {349 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();350 ParticleEmitter* tmpEmit = tmpIt->firstElement();351 while(tmpEmit)352 {353 if (!strcmp(emitterName, tmpEmit->getName()))354 {355 delete tmpIt;356 return tmpEmit;357 }358 tmpEmit = tmpIt->nextElement();359 }360 delete tmpIt;361 return NULL;362 }363 364 365 /**366 325 * @param number the n-th emitter to return 367 326 * @returns the emitter called by number or NULL if not found -
trunk/src/lib/particles/particle_engine.h
r5405 r5445 53 53 bool breakConnection(ParticleConnection* connection); 54 54 55 ParticleSystem* getSystemByName(const char* systemName) const; 56 ParticleSystem* getSystemByNumber(unsigned int number) const; 57 ParticleEmitter* getEmitterByName(const char* emitterName) const; 58 ParticleEmitter* getEmitterByNumber(unsigned int number) const; 55 ParticleSystem* getSystemByNumber(unsigned int number) const; 56 ParticleEmitter* getEmitterByNumber(unsigned int number) const; 59 57 60 58 void debug(); -
trunk/src/lib/particles/particle_system.cc
r5357 r5445 49 49 50 50 /** 51 \brief creates a Particle System out of a XML-element52 * @param root: the XML-element to load from51 * @brief creates a Particle System out of a XML-element 52 * @param root: the XML-element to load from 53 53 */ 54 54 ParticleSystem::ParticleSystem(const TiXmlElement* root) … … 198 198 case PARTICLE_SPRITE: 199 199 this->material = new Material("transperencyMap"); 200 this->material->setDiffuseMap(" pictures/radialTransparency.png");200 this->material->setDiffuseMap("maps/radialTransparency.png"); 201 201 // material->setTransparency(.5); 202 202 break; -
trunk/src/world_entities/weapons/test_bullet.cc
r5444 r5445 64 64 TestBullet::~TestBullet () 65 65 { 66 delete this->emitter;66 // delete this->emitter; 67 67 68 /* this is normaly done by World.cc by deleting the ParticleEngine 69 if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() == 1)68 /* this is normaly done by World.cc by deleting the ParticleEngine */ 69 if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1) 70 70 { 71 delete TestBullet::explosionParticles; 71 if (ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM)) 72 delete TestBullet::explosionParticles; 72 73 TestBullet::explosionParticles = NULL; 74 printf("-------------------\n"); 73 75 } 74 */ 76 75 77 } 76 78 … … 83 85 if (unlikely(TestBullet::explosionParticles == NULL)) 84 86 { 87 ClassList::debug(3, CL_PARTICLE_SYSTEM); 85 88 TestBullet::explosionParticles = new ParticleSystem(10000, PARTICLE_SPRITE); 89 TestBullet::explosionParticles->setName("TestBulletTrailParticles"); 86 90 TestBullet::explosionParticles->setLifeSpan(.5); 87 91 TestBullet::explosionParticles->setRadius(0.0, .5); … … 91 95 TestBullet::explosionParticles->setColor(0.5, .8,.8,0,.5); 92 96 TestBullet::explosionParticles->setColor(1.0, .5,.5,.5,.0); 97 printf("::::::::::::::::::::::::::::\n"); 93 98 } 94 99
Note: See TracChangeset
for help on using the changeset viewer.