Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 14, 2005, 2:50:25 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: physicsEngine works for particles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/util/physics/physics_engine.cc

    r4121 r4183  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    1614*/
    1715
    18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    1917
    2018#include "physics_engine.h"
    2119
    22 #include "stdincl.h" // maybe
     20#include "list.h"
    2321
    2422using namespace std;
     
    2725/**
    2826   \brief standard constructor
    29    \todo this constructor is not jet implemented - do it
    3027*/
    31 PhysicsEngine::PhysicsEngine ()
     28PhysicsEngine::PhysicsEngine()
    3229{
    3330   this->setClassName ("PhysicsEngine");
     31
     32   this->connections = new tList<PhysicsConnection>;
    3433}
    3534
     35/**
     36   \brief the singleton reference to this class
     37*/
     38PhysicsEngine* PhysicsEngine::singletonRef = NULL;
     39
     40/**
     41   \returns a Pointer to this Class
     42*/
     43PhysicsEngine* PhysicsEngine::getInstance(void)
     44{
     45  if (!PhysicsEngine::singletonRef)
     46    PhysicsEngine::singletonRef = new PhysicsEngine();
     47  return PhysicsEngine::singletonRef;
     48}
    3649
    3750/**
     
    4154PhysicsEngine::~PhysicsEngine ()
    4255{
    43   // delete what has to be deleted here
     56  PhysicsEngine::singletonRef = NULL;
    4457}
    4558
    4659/**
    47    \brief nonsense - delete this method
    48    \param realy nothing to give
    49    \returns true or false - probably nothing?
     60   \brief adds A Physical Connection to the List of Connections
     61   \param connection the Connection to add
     62   
     63   Usually this is done through the constructor of PhysicshConnections
     64*/
     65void PhysicsEngine::addConnection(PhysicsConnection* connection)
     66{
     67  this->connections->add(connection);
     68}
    5069
    51    this is just to show the doxygen abilities (this for example is an extension for a long comment)
     70/**
     71   \brief removes A Physical Connection from the List of Connections
     72   \param connection the Connection to remove
     73   
     74   Usually this is done through the destructor of PhysicsConnections
    5275*/
    53 bool PhysicsEngine::doNonSense (int nothing) {}
     76void PhysicsEngine::removeConnection(PhysicsConnection* connection)
     77{
     78  this->connections->remove(connection);
     79}
     80
     81
     82
     83
     84
     85/**
     86   \brief Steps through all the Connections and Ticks them
     87   \param dt The time Passed in Seconds
     88
     89   This function brings a flow into the whole animation
     90*/
     91void PhysicsEngine::tick(float dt)
     92{
     93  tIterator<PhysicsConnection>* iterator = this->connections->getIterator();
     94  PhysicsConnection* enumConn = iterator->nextElement();
     95  while (enumConn)
     96    {
     97      enumConn->apply();
     98      enumConn = iterator->nextElement();
     99    }
     100  delete iterator;
     101}
Note: See TracChangeset for help on using the changeset viewer.