Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6619 in orxonox.OLD for trunk/src/lib


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

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

Location:
trunk/src/lib
Files:
1 added
5 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}
Note: See TracChangeset for help on using the changeset viewer.