Changeset 4183 in orxonox.OLD
- Timestamp:
- May 14, 2005, 2:50:25 PM (19 years ago)
- Location:
- orxonox/branches/physics/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/story_entities/world.cc
r4178 r4183 48 48 49 49 #include "animation3d.h" 50 #include "physics_engine.h" 51 #include "gravity.h" 50 52 51 53 #include "substring.h" … … 207 209 TextEngine::getInstance()->flush(); 208 210 211 delete PhysicsEngine::getInstance(); 209 212 delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence. 210 213 //delete garbagecollecor … … 255 258 256 259 AnimationPlayer::getInstance(); // initializes the animationPlayer 260 PhysicsEngine::getInstance(); 257 261 258 262 this->localCamera = new Camera(); … … 496 500 emitter->setParent(this->localPlayer); 497 501 502 Gravity* gravity = new Gravity(); 503 gravity->setMagnitude(0.001); 504 new PhysicsConnection(system, gravity); 505 498 506 particleEngine->addConnection(emitter, system); 499 507 } … … 1145 1153 1146 1154 AnimationPlayer::getInstance()->tick(this->dtS); 1155 PhysicsEngine::getInstance()->tick(this->dtS); 1156 1147 1157 particleEngine->tick(this->dtS); 1148 1158 } -
orxonox/branches/physics/src/util/physics/physics_connection.cc
r4182 r4183 17 17 18 18 #include "physics_connection.h" 19 #include "field.h" 20 #include "p article_system.h"19 20 #include "physics_engine.h" 21 21 22 22 using namespace std; … … 29 29 this->particleSystem = particleSystem; 30 30 this->field = field; 31 32 PhysicsEngine::getInstance()->addConnection(this); 31 33 } 32 34 … … 38 40 PhysicsConnection::~PhysicsConnection () 39 41 { 40 42 PhysicsEngine::getInstance()->removeConnection(this); 41 43 } 42 44 -
orxonox/branches/physics/src/util/physics/physics_connection.h
r4182 r4183 7 7 #define _PHYSICS_CONNECTION_H 8 8 9 #include "field.h" 10 #include "particle_system.h" 11 #include "i_physics.h" 12 9 13 //! An enumerator for different ConnectionTypes 10 14 typedef enum PCON_Type { PCON_IPhysIPhys = 0, … … 14 18 15 19 // Forward Declaration 16 class Field;17 class IPhysics;18 class ParticleSystem;19 20 20 21 //! A class that Handles Physical Connection between subjects -
orxonox/branches/physics/src/util/physics/physics_engine.cc
r4121 r4183 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 16 14 */ 17 15 18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 19 17 20 18 #include "physics_engine.h" 21 19 22 #include " stdincl.h" // maybe20 #include "list.h" 23 21 24 22 using namespace std; … … 27 25 /** 28 26 \brief standard constructor 29 \todo this constructor is not jet implemented - do it30 27 */ 31 PhysicsEngine::PhysicsEngine 28 PhysicsEngine::PhysicsEngine() 32 29 { 33 30 this->setClassName ("PhysicsEngine"); 31 32 this->connections = new tList<PhysicsConnection>; 34 33 } 35 34 35 /** 36 \brief the singleton reference to this class 37 */ 38 PhysicsEngine* PhysicsEngine::singletonRef = NULL; 39 40 /** 41 \returns a Pointer to this Class 42 */ 43 PhysicsEngine* PhysicsEngine::getInstance(void) 44 { 45 if (!PhysicsEngine::singletonRef) 46 PhysicsEngine::singletonRef = new PhysicsEngine(); 47 return PhysicsEngine::singletonRef; 48 } 36 49 37 50 /** … … 41 54 PhysicsEngine::~PhysicsEngine () 42 55 { 43 // delete what has to be deleted here56 PhysicsEngine::singletonRef = NULL; 44 57 } 45 58 46 59 /** 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 */ 65 void PhysicsEngine::addConnection(PhysicsConnection* connection) 66 { 67 this->connections->add(connection); 68 } 50 69 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 52 75 */ 53 bool PhysicsEngine::doNonSense (int nothing) {} 76 void 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 */ 91 void 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 } -
orxonox/branches/physics/src/util/physics/physics_engine.h
r4121 r4183 1 1 /*! 2 2 \file physics_engine.h 3 \brief Definition of the proto class template, used quickly start work 4 \todo Example: this shows how to use simply add a Marker that here has to be done something. 5 6 The PhysicsEngine exists, to help you quikly getting the run for how to develop in orxonox. 7 It is an example for the CODING-CONVENTION, and a starting-point for every class. 3 \brief Definition of the ... singleton Class 4 8 5 */ 9 6 … … 12 9 13 10 #include "base_object.h" 11 #include "physics_connection.h" 12 #include "field.h" 14 13 15 // F ORWARD DEFINITION \\16 class someClassWeNeed;14 // Forward Declaration 15 template<class T> class tList; 17 16 18 17 19 /*class Test;*/ /* forward definition of class Test (without including it here!)*/ 20 21 //! A default class that aids you to start creating a new class 22 /** 23 here can be some longer description of this class 24 */ 18 //! A default singleton class. 25 19 class PhysicsEngine : public BaseObject { 26 20 27 21 public: 28 PhysicsEngine();29 virtual ~PhysicsEngine( );22 static PhysicsEngine* getInstance(void); 23 virtual ~PhysicsEngine(void); 30 24 31 bool doNonSense (int nothing); 25 void addConnection(PhysicsConnection* connection); 26 void removeConnection(PhysicsConnection* connection); 27 28 void tick(float dt); 32 29 33 30 private: 34 int nonSense; //!< doxygen tag here like this for all the variables - delete this variable if you use this 31 PhysicsEngine(void); 32 static PhysicsEngine* singletonRef; 35 33 34 tList<PhysicsConnection>* connections; 35 36 36 37 }; 37 38 39 40 38 41 #endif /* _PHYSICS_ENGINE_H */
Note: See TracChangeset
for help on using the changeset viewer.