Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4394 in orxonox.OLD for orxonox/trunk/src/lib/physics


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

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

Location:
orxonox/trunk/src/lib/physics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.