- Timestamp:
- Jan 19, 2006, 6:23:56 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 12 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/event/event_handler.cc
r6578 r6619 262 262 SDL_WM_GrabInput(SDL_GRAB_OFF); 263 263 else 264 ;//SDL_WM_GrabInput(SDL_GRAB_ON);264 SDL_WM_GrabInput(SDL_GRAB_ON); 265 265 } 266 266 -
trunk/src/lib/particles/Makefile.am
r5463 r6619 4 4 noinst_LIBRARIES = libORXparticles.a 5 5 6 libORXparticles_a_SOURCES = particle_engine.cc \ 7 particle_emitter.cc \ 6 libORXparticles_a_SOURCES = particle_emitter.cc \ 8 7 particle_system.cc \ 9 8 quick_animation.cc 10 9 11 10 12 noinst_HEADERS= particle_engine.h \ 13 particle_emitter.h \ 11 noinst_HEADERS= particle_emitter.h \ 14 12 particle_system.h \ 15 13 quick_animation.h -
trunk/src/lib/particles/particle_emitter.cc
r6512 r6619 19 19 20 20 #include "particle_system.h" 21 #include "particle_engine.h"22 21 23 22 #include "load_param.h" … … 44 43 this->setEmissionVelocity(velocity); 45 44 46 ParticleEngine::getInstance()->addEmitter(this);47 45 } 48 46 … … 57 55 if (root != NULL) 58 56 this->loadParams(root); 59 60 ParticleEngine::getInstance()->addEmitter(this);61 57 } 62 58 … … 68 64 ParticleEmitter::~ParticleEmitter () 69 65 { 70 ParticleEngine::getInstance()->removeEmitter(this);71 66 } 72 67 … … 84 79 this->setSize(PARTICLE_EMITTER_DEFAULT_SIZE); 85 80 81 this->system = NULL; 82 86 83 this->saveTime = 0.0; 87 84 } … … 118 115 119 116 LoadParam(root, "emission-direction", this, ParticleEmitter, setDirection); 117 } 118 119 void ParticleEmitter::setSystem(ParticleSystem* system) 120 { 121 if (system != NULL) 122 system->addEmitter(this); 123 else if (this->system != NULL) 124 this->system->removeEmitter(this); 125 this->system = system; 120 126 } 121 127 -
trunk/src/lib/particles/particle_emitter.h
r6512 r6619 21 21 22 22 //! The form of the Emitter to emit from 23 23 typedef enum EMITTER_TYPE 24 24 { 25 25 EMITTER_DOT = 1, … … 30 30 31 31 //! A class to handle an Emitter. 32 class ParticleEmitter : public PNode { 33 34 public: 32 class ParticleEmitter : public PNode 33 { 34 friend class ParticleSystem; 35 public: 35 36 ParticleEmitter(const Vector& direction, float angle = .5, 36 37 float emissionRate = 1.0, float velocity = 1.0); … … 46 47 void tick(float dt, ParticleSystem* system); 47 48 49 void setSystem(ParticleSystem* system); 50 ParticleSystem* getSystem() const { return this->system; }; 51 48 52 /* controlling the behavour: these can be used as Animation interfaces */ 49 53 void setType(EMITTER_TYPE type); … … 56 60 void setEmissionMomentum(float momentum, float randomMomentum = 0.0); 57 61 58 void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); }; //!< todo this should be done via PNODE 62 void setDirection(float x, float y, float z) { this->direction = Vector(x,y,z); } 63 ; //!< todo this should be done via PNODE 59 64 60 65 /** @returns the type of the emitter */ … … 77 82 void debug() const; 78 83 79 private: 84 85 private: 86 ParticleSystem* system; //!< The ParticleSystem this Emitter Emits into. 87 80 88 EMITTER_TYPE type; //!< The type of emitter this is. 81 89 float emitterSize; //!< The size of the emitter (not for EMITTER_DOT). -
trunk/src/lib/particles/particle_system.cc
r6612 r6619 19 19 20 20 #include "particle_emitter.h" 21 #include "particle_engine.h"22 21 23 22 #include "field.h" … … 69 68 ParticleSystem::~ParticleSystem() 70 69 { 71 // delete what has to be deleted here72 ParticleEngine::getInstance()->removeSystem(this);73 74 70 // deleting all the living Particles 75 71 while (this->particles) … … 108 104 this->glID = NULL; 109 105 this->setType(PARTICLE_DEFAULT_TYPE, 1); 110 ParticleEngine::getInstance()->addSystem(this);111 106 112 107 this->toList(OM_ENVIRON); … … 297 292 void ParticleSystem::addEmitter(ParticleEmitter* emitter) 298 293 { 294 assert (emitter != NULL); 295 if (emitter->getSystem() != NULL) 296 emitter->getSystem()->removeEmitter(emitter); 299 297 this->emitters.push_back(emitter); 300 298 } -
trunk/src/story_entities/game_world.cc
r6512 r6619 47 47 #include "shell_command.h" 48 48 49 #include "particle_engine.h"50 49 #include "graphics_engine.h" 51 50 #include "event_handler.h" … … 339 338 this->dataTank->localCamera->tick(this->dtS); 340 339 AnimationPlayer::getInstance()->tick(this->dtS); 341 ParticleEngine::getInstance()->tick(this->dtS);342 340 PhysicsEngine::getInstance()->tick(this->dtS); 343 341 … … 414 412 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01)); 415 413 engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ)); 416 /* draws the particles */417 ParticleEngine::getInstance()->draw();418 414 419 415 if( unlikely( this->showBV)) -
trunk/src/story_entities/game_world_data.cc
r6434 r6619 44 44 #include "load_param.h" 45 45 46 #include "particle_engine.h"47 46 #include "graphics_engine.h" 48 47 #include "event_handler.h" … … 115 114 /* initialize some graphics engines and graphical elements */ 116 115 AnimationPlayer::getInstance(); 117 ParticleEngine::getInstance();118 116 PhysicsEngine::getInstance(); 119 117 } … … 279 277 LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams); 280 278 281 LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);279 // LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams); 282 280 //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams); 283 281 … … 301 299 /* delete some garphics and scene eingines */ 302 300 delete LightManager::getInstance(); 303 delete ParticleEngine::getInstance();304 301 delete AnimationPlayer::getInstance(); 305 302 delete PhysicsEngine::getInstance(); -
trunk/src/world_entities/projectiles/bomb.cc
r6512 r6619 25 25 #include "object_manager.h" 26 26 27 #include "particle_engine.h"28 27 #include "particle_emitter.h" 29 28 #include "particle_system.h" -
trunk/src/world_entities/projectiles/guided_missile.cc
r6434 r6619 23 23 #include "class_list.h" 24 24 25 #include "particle_engine.h"26 25 #include "particle_emitter.h" 27 26 #include "particle_system.h" … … 113 112 } 114 113 115 ParticleEngine::getInstance()->addConnection(this->emitter,GuidedMissile::trailParticles);114 this->emitter->setSystem(GuidedMissile::trailParticles); 116 115 117 116 this->updateNode(0); … … 123 122 void GuidedMissile::deactivate() 124 123 { 125 ParticleEngine::getInstance()->breakConnections(this->emitter);124 this->emitter->setSystem(NULL); 126 125 this->lifeCycle = 0.0; 127 126 … … 184 183 PRINTF(5)("DESTROY GuidedMissile\n"); 185 184 this->lifeCycle = .95; //!< @todo calculate this usefully. 186 ParticleEngine::getInstance()->breakConnection(this->emitter, GuidedMissile::trailParticles); 187 ParticleEngine::getInstance()->addConnection(this->emitter, GuidedMissile::explosionParticles); 185 this->emitter->setSystem(GuidedMissile::explosionParticles); 188 186 189 187 this->emitter->setEmissionRate(1000.0); -
trunk/src/world_entities/projectiles/laser.cc
r6434 r6619 24 24 #include "model.h" 25 25 26 #include "particle_engine.h"27 26 #include "particle_emitter.h" 28 27 #include "particle_system.h" … … 93 92 void Laser::deactivate() 94 93 { 95 ParticleEngine::getInstance()->breakConnections(this->emitter); 94 assert (Laser::explosionParticles != NULL); 95 Laser::explosionParticles->removeEmitter(this->emitter); 96 96 this->lifeCycle = 0.0; 97 97 … … 130 130 PRINTF(5)("DESTROY Laser\n"); 131 131 this->lifeCycle = .95; //!< @todo calculate this usefully. 132 ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles); 132 133 this->emitter->setSystem(Laser::explosionParticles); 133 134 } 134 135 -
trunk/src/world_entities/projectiles/rocket.cc
r6434 r6619 23 23 #include "class_list.h" 24 24 25 #include "particle_engine.h"26 25 #include "particle_emitter.h" 27 26 #include "particle_system.h" … … 110 109 } 111 110 112 ParticleEngine::getInstance()->addConnection(this->emitter,Rocket::trailParticles);111 this->emitter->setSystem(Rocket::trailParticles); 113 112 114 113 this->updateNode(0); … … 120 119 void Rocket::deactivate() 121 120 { 122 ParticleEngine::getInstance()->breakConnections(this->emitter);121 this->emitter->setSystem(NULL); 123 122 this->lifeCycle = 0.0; 124 123 this->toList(OM_NULL); … … 158 157 PRINTF(5)("DESTROY Rocket\n"); 159 158 this->lifeCycle = .95; //!< @todo calculate this usefully. 160 ParticleEngine::getInstance()->breakConnection(this->emitter, Rocket::trailParticles); 161 ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::explosionParticles); 159 this->emitter->setSystem(Rocket::explosionParticles); 162 160 163 161 this->emitter->setEmissionRate(1000.0); -
trunk/src/world_entities/projectiles/test_bullet.cc
r6434 r6619 23 23 #include "class_list.h" 24 24 25 #include "particle_engine.h"26 25 #include "particle_emitter.h" 27 26 #include "particle_system.h" … … 105 104 } 106 105 107 ParticleEngine::getInstance()->addConnection(this->emitter,TestBullet::trailParticles);106 this->emitter->setSystem(TestBullet::trailParticles); 108 107 109 108 this->emitter->setEmissionRate(20.0); … … 114 113 void TestBullet::deactivate() 115 114 { 116 ParticleEngine::getInstance()->breakConnections(this->emitter);115 this->emitter->setSystem(NULL); 117 116 this->lifeCycle = 0.0; 118 117 this->toList(OM_NULL); … … 157 156 PRINTF(5)("DESTROY TestBullet\n"); 158 157 this->lifeCycle = .95; //!< @todo calculate this usefully. 159 ParticleEngine::getInstance()->breakConnection(this->emitter, TestBullet::trailParticles); 160 ParticleEngine::getInstance()->addConnection(this->emitter, TestBullet::explosionParticles); 158 this->emitter->setSystem(TestBullet::explosionParticles); 161 159 162 160 this->emitter->setEmissionRate(30.0);
Note: See TracChangeset
for help on using the changeset viewer.