Changeset 9869 in orxonox.OLD for trunk/src/lib/physics
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- Location:
- trunk/src/lib/physics
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/physics/fields/field.cc
r9406 r9869 23 23 #include "util/loading/load_param.h" 24 24 25 ObjectListDefinition(Field); 25 26 26 27 /** 27 * standard constructor28 * @brief standard constructor 28 29 */ 29 30 Field::Field () … … 33 34 34 35 /** 35 * standard deconstructor 36 37 */ 36 * @brief standard deconstructor 37 */ 38 38 Field::~Field () 39 39 { … … 42 42 43 43 /** 44 \brief initializes a Field45 */44 * @brief initializes a Field 45 */ 46 46 void Field::init() 47 47 { 48 this-> setClassID(CL_FIELD, "Field");48 this->registerObject(this, Field::_objectList); 49 49 this->setMagnitude(1); 50 50 this->setAttenuation(0); … … 54 54 55 55 /** 56 * @param root The XML-element to load settings from56 * @param root The XML-element to load settings from 57 57 */ 58 58 void Field::loadParams(const TiXmlElement* root) -
trunk/src/lib/physics/fields/field.h
r6512 r9869 16 16 /*! 17 17 * @file field.h 18 *abstract definition of a Physical Field19 20 21 22 */18 * abstract definition of a Physical Field 19 * 20 * This is a totally abstract class, that only enables different Physical Fields to 21 * exist on a common Level. 22 */ 23 23 24 24 #ifndef _FIELD_H … … 34 34 class Field : public PNode 35 35 { 36 ObjectListDeclaration(Field); 36 37 public: 37 38 Field(); -
trunk/src/lib/physics/fields/gravity.cc
r9406 r9869 21 21 #include "util/loading/factory.h" 22 22 23 #include "class_id_DEPRECATED.h" 24 ObjectListDefinitionID(Gravity, CL_FIELD_GRAVITY); 23 25 24 25 CREATE_FACTORY(Gravity, CL_FIELD_GRAVITY); 26 CREATE_FACTORY(Gravity); 26 27 27 28 Gravity::Gravity(const TiXmlElement* root) 28 29 { 29 this-> setClassID(CL_FIELD_GRAVITY, "Gravity");30 this->registerObject(this, Gravity::_objectList); 30 31 31 32 if (root != NULL) -
trunk/src/lib/physics/fields/gravity.h
r6512 r9869 16 16 //! A class for ... 17 17 class Gravity : public Field { 18 ObjectListDeclaration(Gravity); 18 19 19 20 public: -
trunk/src/lib/physics/fields/point_gravity.cc
r9406 r9869 20 20 21 21 22 #include "class_id_DEPRECATED.h" 23 ObjectListDefinitionID(PointGravity, CL_FIELD_POINT_GRAVITY); 24 22 25 23 26 /** … … 27 30 PointGravity::PointGravity () 28 31 { 29 this->setClassID(CL_FIELD_POINT_GRAVITY, "PointGravity");32 this->registerObject(this, PointGravity::_objectList); 30 33 } 31 34 -
trunk/src/lib/physics/fields/point_gravity.h
r5405 r9869 1 /*! 1 /*! 2 2 * @file point_gravity.h 3 3 * Definition of ... … … 16 16 //! A class for ... 17 17 class PointGravity : public Field { 18 ObjectListDeclaration(PointGravity); 18 19 19 20 public: -
trunk/src/lib/physics/fields/twirl.cc
r9406 r9869 20 20 21 21 22 #include "class_id_DEPRECATED.h" 23 ObjectListDefinitionID(Twirl, CL_FIELD_TWIRL); 24 22 25 23 26 /** … … 27 30 Twirl::Twirl () 28 31 { 29 this->setClassID(CL_FIELD_TWIRL, "Twirl");32 this->registerObject(this, Twirl::_objectList); 30 33 } 31 34 -
trunk/src/lib/physics/fields/twirl.h
r5405 r9869 1 /*! 1 /*! 2 2 * @file twirl.h 3 3 * Definition of ... … … 16 16 //! A class for ... 17 17 class Twirl : public Field { 18 ObjectListDeclaration(Twirl); 18 19 19 20 public: -
trunk/src/lib/physics/physics_connection.cc
r9406 r9869 19 19 20 20 #include "physics_engine.h" 21 #include "debug.h" 21 22 22 #include "field .h"23 #include "particle _system.h"23 #include "fields/field.h" 24 #include "particles/particle_system.h" 24 25 #include "physics_interface.h" 25 26 … … 27 28 #include "util/loading/load_param.h" 28 29 29 30 31 CREATE_FACTORY(PhysicsConnection, CL_PHYSICS_CONNECTION); 32 30 #include "class_id_DEPRECATED.h" 31 ObjectListDefinition(PhysicsConnection); 32 CREATE_FACTORY(PhysicsConnection); 33 33 /** 34 34 * creates a PhysicsConnection … … 36 36 PhysicsConnection::PhysicsConnection(PhysicsInterface* subject, Field* field) 37 37 { 38 this-> setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");38 this->registerObject(this, PhysicsConnection::_objectList); 39 39 this->type = PCON_PhysIField; 40 40 … … 47 47 PhysicsConnection::PhysicsConnection(const TiXmlElement* root) 48 48 { 49 this-> setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");49 this->registerObject(this, PhysicsConnection::_objectList); 50 50 this->type = PCON_PhysIField; 51 51 -
trunk/src/lib/physics/physics_connection.h
r7221 r9869 27 27 class PhysicsConnection : public BaseObject 28 28 { 29 29 ObjectListDeclaration(PhysicsConnection); 30 30 public: 31 31 PhysicsConnection(PhysicsInterface* subject, Field* field); -
trunk/src/lib/physics/physics_engine.cc
r9406 r9869 18 18 #include "physics_engine.h" 19 19 20 #include "class_list.h"21 #include "parser/tinyxml/tinyxml.h"22 20 #include "util/loading/factory.h" 23 #include "util/loading/load_param .h"24 25 26 27 28 /** 29 * standard constructor30 */21 #include "util/loading/load_param_xml.h" 22 23 24 25 ObjectListDefinition(PhysicsEngine); 26 /** 27 * @brief standard constructor 28 */ 31 29 PhysicsEngine::PhysicsEngine() 32 30 { 33 this-> setClassID(CL_PHYSICS_ENGINE, "PhysicsEngine");31 this->registerObject(this, PhysicsEngine::_objectList); 34 32 this->setName("PhysicsEngine"); 35 33 this->interfaces = NULL; … … 130 128 PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const std::string& physicsInterfaceName) const 131 129 { 132 BaseObject* interface = ClassList::getObject(physicsInterfaceName, CL_PHYSICS_INTERFACE); 133 return (interface != NULL)? dynamic_cast<PhysicsInterface*>(interface) : NULL; 130 return PhysicsInterface::objectList().getObject(physicsInterfaceName); 134 131 } 135 132 … … 223 220 224 221 /* actually tick all the PhysicsInterfaces. Move the objects around */ 225 if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL) 226 {227 std::list<BaseObject*>::const_iterator tickPhys;228 for (tickPhys = this->interfaces->begin(); tickPhys != this->interfaces->end(); tickPhys++)229 dynamic_cast<PhysicsInterface*>(*tickPhys)->tickPhys(dt);230 }222 223 ObjectList<PhysicsInterface>::const_iterator it; 224 for (it = PhysicsInterface::objectList().begin(); 225 it != PhysicsInterface::objectList().end(); 226 ++it) 227 (*it)->tickPhys(dt); 231 228 } 232 229 -
trunk/src/lib/physics/physics_engine.h
r7221 r9869 12 12 #include "physics_connection.h" 13 13 #include "physics_interface.h" 14 #include "field .h"14 #include "fields/field.h" 15 15 #include <list> 16 16 … … 20 20 21 21 //! A class, that brings things into motion through Physics. 22 class PhysicsEngine : public BaseObject { 23 24 public: 22 class PhysicsEngine : public BaseObject 23 { 24 ObjectListDeclaration(PhysicsEngine); 25 public: 25 26 virtual ~PhysicsEngine(); 26 27 /** @returns a Pointer to the only object of this Class */ … … 46 47 void debug() const; 47 48 48 49 private: 49 50 PhysicsEngine(); 50 51 51 52 private: 52 53 static PhysicsEngine* singletonRef; //!< the singleton reference of the PhysicsEngine 53 54 -
trunk/src/lib/physics/physics_interface.cc
r9406 r9869 23 23 #include "physics_engine.h" 24 24 25 #include "field .h"25 #include "fields/field.h" 26 26 #include "p_node.h" 27 27 … … 31 31 32 32 33 33 ObjectListDefinition(PhysicsInterface); 34 34 /** 35 * standard constructor35 * @brief standard constructor 36 36 */ 37 37 PhysicsInterface::PhysicsInterface () 38 38 { 39 this-> setClassID(CL_PHYSICS_INTERFACE, "PhysicsInterface");39 this->registerObject(this, PhysicsInterface::_objectList); 40 40 41 41 this->mass = 1; -
trunk/src/lib/physics/physics_interface.h
r8190 r9869 29 29 class PhysicsInterface : virtual public BaseObject 30 30 { 31 ObjectListDeclaration(PhysicsInterface); 31 32 public: 32 33 PhysicsInterface();
Note: See TracChangeset
for help on using the changeset viewer.