Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4394 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 30, 2005, 2:05:21 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: PhysicsEngine is now aware of the existing fields and interfaces

Location:
orxonox/trunk/src/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/particles/particle_engine.h

    r4349 r4394  
    2020};
    2121
    22 //! A default singleton class.
     22//! The physicsEngine handles and stores Systems and Emitters.
     23/**
     24   It is responsible for driving on the Particles (tick)
     25   It draw particles (draw)
     26   and it emitts particles into the system
     27*/
    2328class ParticleEngine : public BaseObject {
    2429
     
    4853 private:
    4954  ParticleEngine(void);
    50   static ParticleEngine* singletonRef;
     55  static ParticleEngine* singletonRef;        //!< The reference to the engine.
    5156
    52   tList<ParticleSystem>* systemList;
    53   tList<ParticleEmitter>* emitterList;
     57  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
     58  tList<ParticleEmitter>* emitterList;        //!< A list of Emitters handled by the ParticleEngine.
    5459
    55   tList<ParticleConnection>* connectionList;
     60  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
    5661};
    5762
  • orxonox/trunk/src/lib/graphics/particles/particle_system.h

    r4381 r4394  
    5757};
    5858
    59 //! A class to handle particle Systems
     59//! A class to handle ParticleSystems
    6060class ParticleSystem : public PhysicsInterface {
    61   friend class ParticleEmitter;
    6261
    6362 public:
     
    10099  virtual void applyField(Field* field, float dt);
    101100
     101  void addParticle(const Vector& position, const Vector& velocity, unsigned int data = 0);
     102
    102103  void tick(float dt);
    103104  void draw(void) const;
     
    132133
    133134  GLuint* glID;              //!< A List of different gl-List-ID's
    134   GLuint dialectCount;       //!< How many different types of particles are there in the Particle System
    135 
    136   void addParticle(const Vector& position, const Vector& velocity, unsigned int data = 0);
    137  
     135  GLuint dialectCount;       //!< How many different types of particles are there in the Particle System 
    138136};
    139137
  • orxonox/trunk/src/lib/physics/fields/field.cc

    r4338 r4394  
    1818#include "field.h"
    1919
     20#include "physics_engine.h"
     21
    2022using namespace std;
    2123
     
    3032   this->setMagnitude(1);
    3133   this->setAttenuation(0);
     34   
     35   PhysicsEngine::getInstance()->addField(this);
    3236}
    3337
     
    3943Field::~Field ()
    4044{
    41   // delete what has to be deleted here
     45   PhysicsEngine::getInstance()->removeField(this);
    4246}
    4347
  • orxonox/trunk/src/lib/physics/physics_connection.h

    r4381 r4394  
    2121
    2222//! A class that Handles Physical Connection between subjects
    23 class PhysicsConnection : virtual public BaseObject
     23class PhysicsConnection : public BaseObject
    2424{
    2525
  • orxonox/trunk/src/lib/physics/physics_engine.cc

    r4392 r4394  
    3434   this->connections = new tList<PhysicsConnection>;
    3535   this->interfaces = new tList<PhysicsInterface>;
     36   this->fields = new tList<Field>;
    3637}
    3738
     
    8182{
    8283  this->interfaces->remove(physicsInterface); 
     84}
     85
     86/**
     87   \brief adds a Field to the list of handeled fields
     88   \param field the field to add
     89
     90   this is normally done in the constructor of any Field
     91*/
     92void PhysicsEngine::addField(Field* field)
     93{
     94  this->fields->add(field);
     95}
     96
     97/**
     98   \brief removes a Field from the list of handeled fields
     99   \param field the field to remove
     100
     101   this is normally done in the destructor of any Field
     102*/
     103void PhysicsEngine::removeField(Field* field)
     104{
     105  this->fields->remove(field);
    83106}
    84107
  • orxonox/trunk/src/lib/physics/physics_engine.h

    r4392 r4394  
    1212#include "physics_connection.h"
    1313#include "physics_interface.h"
     14#include "field.h"
    1415
    1516// Forward Declaration
     
    2728  void removePhysicsInterface(PhysicsInterface* physicsInterface);
    2829
     30  void addField(Field* field);
     31  void removeField(Field* field);
    2932
    3033  void addConnection(PhysicsConnection* connection);
     
    4043
    4144  tList<PhysicsInterface>* interfaces;     //!< a list of physically based objects
     45  tList<Field>* fields;                    //!< a list of physicsl fields.
    4246  tList<PhysicsConnection>* connections;   //!< a list of physical connections
    4347};
Note: See TracChangeset for help on using the changeset viewer.