Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6619 in orxonox.OLD


Ignore:
Timestamp:
Jan 19, 2006, 6:23:56 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: rendering without the ParticleEngine, so now we are FAST :)

Location:
trunk/src
Files:
1 added
12 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/event/event_handler.cc

    r6578 r6619  
    262262    SDL_WM_GrabInput(SDL_GRAB_OFF);
    263263  else
    264     ;//SDL_WM_GrabInput(SDL_GRAB_ON);
     264    SDL_WM_GrabInput(SDL_GRAB_ON);
    265265}
    266266
  • trunk/src/lib/particles/Makefile.am

    r5463 r6619  
    44noinst_LIBRARIES = libORXparticles.a
    55
    6 libORXparticles_a_SOURCES = particle_engine.cc \
    7                             particle_emitter.cc \
     6libORXparticles_a_SOURCES = particle_emitter.cc \
    87                            particle_system.cc \
    98                            quick_animation.cc
    109
    1110
    12 noinst_HEADERS= particle_engine.h \
    13                 particle_emitter.h \
     11noinst_HEADERS= particle_emitter.h \
    1412                particle_system.h \
    1513                quick_animation.h
  • trunk/src/lib/particles/particle_emitter.cc

    r6512 r6619  
    1919
    2020#include "particle_system.h"
    21 #include "particle_engine.h"
    2221
    2322#include "load_param.h"
     
    4443  this->setEmissionVelocity(velocity);
    4544
    46   ParticleEngine::getInstance()->addEmitter(this);
    4745}
    4846
     
    5755   if (root != NULL)
    5856     this->loadParams(root);
    59 
    60    ParticleEngine::getInstance()->addEmitter(this);
    6157}
    6258
     
    6864ParticleEmitter::~ParticleEmitter ()
    6965{
    70   ParticleEngine::getInstance()->removeEmitter(this);
    7166}
    7267
     
    8479  this->setSize(PARTICLE_EMITTER_DEFAULT_SIZE);
    8580
     81  this->system = NULL;
     82
    8683  this->saveTime = 0.0;
    8784}
     
    118115
    119116  LoadParam(root, "emission-direction", this, ParticleEmitter, setDirection);
     117}
     118
     119void 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;
    120126}
    121127
  • trunk/src/lib/particles/particle_emitter.h

    r6512 r6619  
    2121
    2222//! The form of the Emitter to emit from
    23   typedef enum EMITTER_TYPE
     23typedef enum EMITTER_TYPE
    2424{
    2525  EMITTER_DOT     = 1,
     
    3030
    3131//! A class to handle an Emitter.
    32 class ParticleEmitter : public PNode {
    33 
    34  public:
     32class ParticleEmitter : public PNode
     33{
     34  friend class ParticleSystem;
     35public:
    3536  ParticleEmitter(const Vector& direction, float angle = .5,
    3637                  float emissionRate = 1.0, float velocity = 1.0);
     
    4647  void tick(float dt, ParticleSystem* system);
    4748
     49  void setSystem(ParticleSystem* system);
     50  ParticleSystem* getSystem() const { return this->system; };
     51
    4852  /* controlling the behavour: these can be used as Animation interfaces */
    4953  void setType(EMITTER_TYPE type);
     
    5660  void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
    5761
    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
    5964
    6065  /** @returns the type of the emitter */
     
    7782  void debug() const;
    7883
    79  private:
     84
     85private:
     86  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
     87
    8088  EMITTER_TYPE    type;              //!< The type of emitter this is.
    8189  float           emitterSize;       //!< The size of the emitter (not for EMITTER_DOT).
  • trunk/src/lib/particles/particle_system.cc

    r6612 r6619  
    1919
    2020#include "particle_emitter.h"
    21 #include "particle_engine.h"
    2221
    2322#include "field.h"
     
    6968ParticleSystem::~ParticleSystem()
    7069{
    71   // delete what has to be deleted here
    72    ParticleEngine::getInstance()->removeSystem(this);
    73 
    7470   // deleting all the living Particles
    7571   while (this->particles)
     
    108104  this->glID = NULL;
    109105  this->setType(PARTICLE_DEFAULT_TYPE, 1);
    110   ParticleEngine::getInstance()->addSystem(this);
    111106
    112107  this->toList(OM_ENVIRON);
     
    297292void ParticleSystem::addEmitter(ParticleEmitter* emitter)
    298293{
     294  assert (emitter != NULL);
     295  if (emitter->getSystem() != NULL)
     296    emitter->getSystem()->removeEmitter(emitter);
    299297  this->emitters.push_back(emitter);
    300298}
  • trunk/src/story_entities/game_world.cc

    r6512 r6619  
    4747#include "shell_command.h"
    4848
    49 #include "particle_engine.h"
    5049#include "graphics_engine.h"
    5150#include "event_handler.h"
     
    339338    this->dataTank->localCamera->tick(this->dtS);
    340339    AnimationPlayer::getInstance()->tick(this->dtS);
    341     ParticleEngine::getInstance()->tick(this->dtS);
    342340    PhysicsEngine::getInstance()->tick(this->dtS);
    343341
     
    414412  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01));
    415413  engine->draw(State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ));
    416   /* draws the particles */
    417   ParticleEngine::getInstance()->draw();
    418414
    419415  if( unlikely( this->showBV))
  • trunk/src/story_entities/game_world_data.cc

    r6434 r6619  
    4444#include "load_param.h"
    4545
    46 #include "particle_engine.h"
    4746#include "graphics_engine.h"
    4847#include "event_handler.h"
     
    115114  /* initialize some graphics engines and graphical elements */
    116115  AnimationPlayer::getInstance();
    117   ParticleEngine::getInstance();
    118116  PhysicsEngine::getInstance();
    119117}
     
    279277  LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
    280278
    281   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
     279//  LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
    282280  //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
    283281
     
    301299  /* delete some garphics and scene eingines */
    302300  delete LightManager::getInstance();
    303   delete ParticleEngine::getInstance();
    304301  delete AnimationPlayer::getInstance();
    305302  delete PhysicsEngine::getInstance();
  • trunk/src/world_entities/projectiles/bomb.cc

    r6512 r6619  
    2525#include "object_manager.h"
    2626
    27 #include "particle_engine.h"
    2827#include "particle_emitter.h"
    2928#include "particle_system.h"
  • trunk/src/world_entities/projectiles/guided_missile.cc

    r6434 r6619  
    2323#include "class_list.h"
    2424
    25 #include "particle_engine.h"
    2625#include "particle_emitter.h"
    2726#include "particle_system.h"
     
    113112  }
    114113
    115   ParticleEngine::getInstance()->addConnection(this->emitter, GuidedMissile::trailParticles);
     114  this->emitter->setSystem(GuidedMissile::trailParticles);
    116115
    117116  this->updateNode(0);
     
    123122void GuidedMissile::deactivate()
    124123{
    125   ParticleEngine::getInstance()->breakConnections(this->emitter);
     124  this->emitter->setSystem(NULL);
    126125  this->lifeCycle = 0.0;
    127126
     
    184183  PRINTF(5)("DESTROY GuidedMissile\n");
    185184  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);
    188186
    189187  this->emitter->setEmissionRate(1000.0);
  • trunk/src/world_entities/projectiles/laser.cc

    r6434 r6619  
    2424#include "model.h"
    2525
    26 #include "particle_engine.h"
    2726#include "particle_emitter.h"
    2827#include "particle_system.h"
     
    9392void Laser::deactivate()
    9493{
    95   ParticleEngine::getInstance()->breakConnections(this->emitter);
     94  assert (Laser::explosionParticles != NULL);
     95  Laser::explosionParticles->removeEmitter(this->emitter);
    9696  this->lifeCycle = 0.0;
    9797
     
    130130  PRINTF(5)("DESTROY Laser\n");
    131131  this->lifeCycle = .95; //!< @todo calculate this usefully.
    132   ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles);
     132
     133  this->emitter->setSystem(Laser::explosionParticles);
    133134}
    134135
  • trunk/src/world_entities/projectiles/rocket.cc

    r6434 r6619  
    2323#include "class_list.h"
    2424
    25 #include "particle_engine.h"
    2625#include "particle_emitter.h"
    2726#include "particle_system.h"
     
    110109  }
    111110
    112   ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::trailParticles);
     111  this->emitter->setSystem(Rocket::trailParticles);
    113112
    114113  this->updateNode(0);
     
    120119void Rocket::deactivate()
    121120{
    122   ParticleEngine::getInstance()->breakConnections(this->emitter);
     121  this->emitter->setSystem(NULL);
    123122  this->lifeCycle = 0.0;
    124123  this->toList(OM_NULL);
     
    158157  PRINTF(5)("DESTROY Rocket\n");
    159158  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);
    162160
    163161  this->emitter->setEmissionRate(1000.0);
  • trunk/src/world_entities/projectiles/test_bullet.cc

    r6434 r6619  
    2323#include "class_list.h"
    2424
    25 #include "particle_engine.h"
    2625#include "particle_emitter.h"
    2726#include "particle_system.h"
     
    105104  }
    106105
    107   ParticleEngine::getInstance()->addConnection(this->emitter, TestBullet::trailParticles);
     106  this->emitter->setSystem(TestBullet::trailParticles);
    108107
    109108  this->emitter->setEmissionRate(20.0);
     
    114113void TestBullet::deactivate()
    115114{
    116   ParticleEngine::getInstance()->breakConnections(this->emitter);
     115  this->emitter->setSystem(NULL);
    117116  this->lifeCycle = 0.0;
    118117  this->toList(OM_NULL);
     
    157156  PRINTF(5)("DESTROY TestBullet\n");
    158157  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);
    161159
    162160  this->emitter->setEmissionRate(30.0);
Note: See TracChangeset for help on using the changeset viewer.