Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5217 in orxonox.OLD


Ignore:
Timestamp:
Sep 22, 2005, 5:06:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: physicsInterface fixed

Location:
trunk/src/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/model.cc

    r5216 r5217  
    107107    delete this->firstFace;
    108108
     109  // deleting the glList
     110  if (this->listNumber != 0)
     111    glDeleteLists(this->listNumber, 1);
     112
    109113  if (this->next !=NULL)
    110114    delete this->next;
    111115
    112   //  if (this->listNumber != 0)
    113 //    glDeleteLists(this->listNumber, 1);
    114116}
    115117
  • trunk/src/lib/physics/physics_engine.cc

    r5216 r5217  
    1818#include "physics_engine.h"
    1919
     20#include "class_list.h"
    2021#include "list.h"
    2122#include "tinyxml.h"
     
    3435  this->setName("PhysicsEngine");
    3536  this->connections = new tList<PhysicsConnection>;
    36   this->interfaces = new tList<PhysicsInterface>;
    3737  this->fields = new tList<Field>;
     38  this->interfaces = NULL;
    3839}
    3940
     
    7071//   }
    7172//   delete itPI;
    72    delete this->interfaces;
    7373//
    7474//   // delete all PhysicsFields, still in existence (this could be dangerous)
     
    133133
    134134/**
    135  *  adds a PhysicsInterface to the list of handeled physicsInterfaces
    136  * @param physicsInterface the interface to add
    137 
    138    this is normally done in the constructor of any PhysicsInterface
    139 */
    140 void PhysicsEngine::addPhysicsInterface(PhysicsInterface* physicsInterface)
    141 {
    142   this->interfaces->add(physicsInterface);
    143 }
    144 
    145 /**
    146  *  removes a PhysicsInterface from the list of handeled physicsInterfaces
    147  * @param physicsInterface the interface to remove
    148 
    149    this is normally done in the destructor of any PhysicsInterface
    150 */
    151 void PhysicsEngine::removePhysicsInterface(PhysicsInterface* physicsInterface)
    152 {
    153   this->interfaces->remove(physicsInterface);
    154 }
    155 
    156 /**
    157135* @param physicsInterfaceName the Name of the PhysicsInterface to search for
    158136  @returns the PhysicsInterface if found, or NULL if not
     
    160138PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const char* physicsInterfaceName) const
    161139{
    162   tIterator<PhysicsInterface>* tmpIt = interfaces->getIterator();
    163   PhysicsInterface* tmpInt = tmpIt->firstElement();
     140  tIterator<BaseObject>* tmpIt = ClassList::getList(CL_PHYSICS_INTERFACE)->getIterator();
     141  BaseObject* tmpInt = tmpIt->firstElement();
    164142  while(tmpInt)
    165143  {
     
    167145    {
    168146      delete tmpIt;
    169       return tmpInt;
     147      return dynamic_cast<PhysicsInterface*>(tmpInt);
    170148    }
    171149    tmpInt = tmpIt->nextElement();
     
    286264
    287265  /* actually tick all the PhysicsInterfaces. Move the objects around */
    288   tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator();
    289   PhysicsInterface* enumPI = itPI->firstElement();
    290   while (enumPI)
    291     {
    292       enumPI->tickPhys(dt);
    293 
    294       enumPI = itPI->nextElement();
    295     }
    296   delete itPI;
     266  if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL)
     267  {
     268    tIterator<BaseObject>* itPI = this->interfaces->getIterator();
     269    PhysicsInterface* enumPI = dynamic_cast<PhysicsInterface*>(itPI->firstElement());
     270    while (enumPI)
     271    {
     272       enumPI->tickPhys(dt);
     273
     274      enumPI = dynamic_cast<PhysicsInterface*>(itPI->nextElement());
     275    }
     276   delete itPI;
     277  }
    297278}
    298279
     
    308289  PRINT(0)("====================================\n");
    309290  PRINT(0)(" reference: %p\n", this);
    310   PRINT(0)(" number of Interfaces: %d\n", this->interfaces->getSize());
     291  if (this->interfaces != NULL)
     292    PRINT(0)(" number of Interfaces: %d\n", this->interfaces->getSize());
    311293  PRINT(0)(" number of Fields: %d\n", this->fields->getSize());
    312294  PRINT(0)(" number of Connections: %d\n", this->connections->getSize());
  • trunk/src/lib/physics/physics_engine.h

    r5039 r5217  
    3030  void loadConnections(const TiXmlElement* root);
    3131
    32   void                   addPhysicsInterface(PhysicsInterface* physicsInterface);
    33   void                   removePhysicsInterface(PhysicsInterface* physicsInterface);
    3432  PhysicsInterface*      getPhysicsInterfaceByName(const char* physicsInterfaceName) const;
    3533
     
    5351  static PhysicsEngine*         singletonRef;         //!< the singleton reference of the PhysicsEngine
    5452
    55   tList<PhysicsInterface>*      interfaces;           //!< a list of physically based objects
    5653  tList<Field>*                 fields;               //!< a list of physicsl fields.
    57   tList<PhysicsConnection>*     connections;          //!< a list of physical connections
     54  tList<PhysicsConnection>*     connections;          //!< a list of physical connections.
     55  const tList<BaseObject>*      interfaces;           //!< The list of physical interfaces.
    5856};
    5957
  • trunk/src/lib/physics/physics_interface.cc

    r5115 r5217  
    4545  this->bForceApplied = false;
    4646
    47    PhysicsEngine::getInstance()->addPhysicsInterface(this);
     47//   PhysicsEngine::getInstance()->addPhysicsInterface(this);
    4848}
    4949
     
    5353PhysicsInterface::~PhysicsInterface ()
    5454{
    55    PhysicsEngine::getInstance()->removePhysicsInterface(this);
     55//   PhysicsEngine::getInstance()->removePhysicsInterface(this);
    5656}
    5757
Note: See TracChangeset for help on using the changeset viewer.