Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 30, 2005, 1:30:23 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: physicsInterfaces now check in at constuctiontime with the PhysicsEngine

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

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/physics/Makefile.in

    r4375 r4392  
    218218          esac; \
    219219        done; \
    220         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/physics/Makefile'; \
     220        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/physics/Makefile'; \
    221221        cd $(top_srcdir) && \
    222           $(AUTOMAKE) --foreign  src/lib/physics/Makefile
     222          $(AUTOMAKE) --gnu  src/lib/physics/Makefile
    223223.PRECIOUS: Makefile
    224224Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/trunk/src/lib/physics/physics_engine.cc

    r4381 r4392  
    3333
    3434   this->connections = new tList<PhysicsConnection>;
     35   this->interfaces = new tList<PhysicsInterface>;
    3536}
    3637
     
    5758{
    5859  PhysicsEngine::singletonRef = NULL;
     60}
     61
     62
     63/**
     64   \brief adds a PhysicsInterface to the list of handeled physicsInterfaces
     65   \param physicsInterface the interface to add
     66
     67   this is normally done in the constructor of any PhysicsInterface
     68*/
     69void PhysicsEngine::addPhysicsInterface(PhysicsInterface* physicsInterface)
     70{
     71  this->interfaces->add(physicsInterface);
     72}
     73
     74/**
     75   \brief removes a PhysicsInterface from the list of handeled physicsInterfaces
     76   \param physicsInterface the interface to remove
     77
     78   this is normally done in the destructor of any PhysicsInterface
     79*/
     80void PhysicsEngine::removePhysicsInterface(PhysicsInterface* physicsInterface)
     81{
     82  this->interfaces->remove(physicsInterface); 
    5983}
    6084
     
    114138  PRINT(0)("====================================\n");
    115139  PRINT(0)(" reference: %p\n", this);
    116   PRINT(0)(" numbers of Connections: %d\n", this->connections->getSize());
     140  PRINT(0)(" number of Interfaces: %d\n", this->interfaces->getSize());
     141  PRINT(0)(" number of Connections: %d\n", this->connections->getSize());
    117142
    118143  PRINT(0)("==============================PHYS==\n");
  • orxonox/trunk/src/lib/physics/physics_engine.h

    r4378 r4392  
    99
    1010#include "base_object.h"
     11
    1112#include "physics_connection.h"
     13#include "physics_interface.h"
    1214
    1315// Forward Declaration
     
    2224  virtual ~PhysicsEngine(void);
    2325
     26  void addPhysicsInterface(PhysicsInterface* physicsInterface);
     27  void removePhysicsInterface(PhysicsInterface* physicsInterface);
     28
     29
    2430  void addConnection(PhysicsConnection* connection);
    2531  void removeConnection(PhysicsConnection* connection);
    26  
    27 
    2832
    2933  void tick(float dt);
     
    3337 private:
    3438  PhysicsEngine(void);
    35   static PhysicsEngine* singletonRef;
     39  static PhysicsEngine* singletonRef;      //!< the singleton reference of the PhysicsEngine
    3640
    37   tList<PhysicsConnection>* connections;
     41  tList<PhysicsInterface>* interfaces;     //!< a list of physically based objects
     42  tList<PhysicsConnection>* connections;   //!< a list of physical connections
    3843};
    3944
  • orxonox/trunk/src/lib/physics/physics_interface.cc

    r4377 r4392  
    2121
    2222#include "physics_interface.h"
     23#include "physics_engine.h"
    2324
    2425#include "field.h"
     
    4142   this->massChildren = 0;
    4243   this->forceSum = Vector(0, 0, 0);
     44
     45   PhysicsEngine::getInstance()->addPhysicsInterface(this);
    4346}
    4447
     
    5053PhysicsInterface::~PhysicsInterface ()
    5154{
    52   // delete what has to be deleted here
     55   PhysicsEngine::getInstance()->removePhysicsInterface(this);
    5356}
    5457
Note: See TracChangeset for help on using the changeset viewer.