Changeset 4728 in orxonox.OLD for orxonox/trunk/src/lib/physics/fields
- Timestamp:
- Jun 28, 2005, 11:56:46 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/physics/fields
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/physics/fields/field.cc
r4394 r4728 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 20 20 #include "physics_engine.h" 21 21 22 #include "factory.h" 23 #include "load_param.h" 22 24 using namespace std; 23 24 25 25 26 /** 26 27 \brief standard constructor 27 \todo this constructor is not jet implemented - do it28 28 */ 29 Field::Field () 29 Field::Field () 30 30 { 31 this->setClassName ("Field"); 32 this->setMagnitude(1); 33 this->setAttenuation(0); 34 35 PhysicsEngine::getInstance()->addField(this); 31 this->init(); 36 32 } 37 33 34 /** 35 \param root The XML-element to load settings from 36 */ 37 Field::Field(const TiXmlElement* root) 38 { 39 this->init(); 40 this->loadParams(root); 41 } 38 42 39 43 /** … … 41 45 42 46 */ 43 Field::~Field () 47 Field::~Field () 44 48 { 45 49 PhysicsEngine::getInstance()->removeField(this); 46 50 } 47 51 52 /** 53 \brief initializes a Field 54 */ 55 void Field::init(void) 56 { 57 this->setClassID(CL_FIELD, "Field"); 58 this->setMagnitude(1); 59 this->setAttenuation(0); 60 61 PhysicsEngine::getInstance()->addField(this); 62 } 63 64 /** 65 \param root The XML-element to load settings from 66 */ 67 void Field::loadParams(const TiXmlElement* root) 68 { 69 static_cast<PNode*>(this)->loadParams(root); 70 71 LoadParam<Field>(root, "magnitude", this, &Field::setMagnitude) 72 .describe("sets the magnitude of this Field"); 73 74 LoadParam<Field>(root, "attenuation", this, &Field::setAttenuation) 75 .describe("sets the attenuation of this Field."); 76 77 } 48 78 49 79 /** 50 80 \param magnitude the magnitude of the Field. 51 81 */ 52 void Field::setMagnitude( const float&magnitude)82 void Field::setMagnitude(float magnitude) 53 83 { 54 84 this->magnitude = magnitude; … … 58 88 \param attenuation The attenuation of the Field (the bigger the smaller the region of influence) 59 89 */ 60 void Field::setAttenuation( const float&attenuation)90 void Field::setAttenuation(float attenuation) 61 91 { 62 92 this->attenuation = attenuation; -
orxonox/trunk/src/lib/physics/fields/field.h
r4481 r4728 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 14 14 */ 15 15 16 /*! 16 /*! 17 17 \file field.h 18 18 \brief abstract definition of a Physical Field 19 19 20 This is a totally abstract class, that only enables different Physical Fields to 20 This is a totally abstract class, that only enables different Physical Fields to 21 21 exist on a common Level. 22 22 */ … … 28 28 29 29 // FORWARD DEFINITION 30 30 class TiXmlElement; 31 31 32 32 33 33 //! An abstract class that represents a Force. 34 class Field : public PNode 34 class Field : public PNode 35 35 { 36 36 public: 37 37 Field(); 38 Field(const TiXmlElement* root); 38 39 virtual ~Field(); 39 40 40 /** 41 void init(void); 42 void loadParams(const TiXmlElement* root); 43 44 /** 41 45 \param data This is the data given to this force, to calculate the ForceVector 42 46 \returns The Force Vector … … 44 48 virtual Vector calcForce(const Vector& data) const = 0; 45 49 46 void setMagnitude( const float&magnitude);50 void setMagnitude(float magnitude); 47 51 /** \returns The Magnitude of the Field */ 48 52 inline const float& getMagnitude(void) const {return this->magnitude;} 49 53 50 void setAttenuation( const float&attenuation);54 void setAttenuation(float attenuation); 51 55 /** \returns The Attenuation of the Fiels */ 52 56 inline const float& getAttenuation(void) const {return this->attenuation;} -
orxonox/trunk/src/lib/physics/fields/gravity.cc
r4396 r4728 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 18 18 #include "gravity.h" 19 19 20 #include "load_param.h" 21 #include "factory.h" 22 20 23 using namespace std; 21 24 25 CREATE_FACTORY(Gravity); 22 26 23 27 /** … … 25 29 \todo this constructor is not jet implemented - do it 26 30 */ 27 Gravity::Gravity () 31 Gravity::Gravity () 28 32 { 29 this->setClassName 33 this->setClassName("Gravity"); 30 34 } 31 35 36 Gravity::Gravity(const TiXmlElement* root) 37 { 38 this->setClassName("Gravity"); 39 40 this->loadParams(root); 41 } 32 42 33 43 /** … … 35 45 36 46 */ 37 Gravity::~Gravity () 47 Gravity::~Gravity () 38 48 { 39 49 // delete what has to be deleted here 50 } 51 52 void Gravity::loadParams(const TiXmlElement* root) 53 { 54 static_cast<Field*>(this)->loadParams(root); 55 40 56 } 41 57 -
orxonox/trunk/src/lib/physics/fields/gravity.h
r4395 r4728 1 /*! 1 /*! 2 2 \file gravity.h 3 3 \brief Definition of ... … … 19 19 public: 20 20 Gravity(); 21 Gravity(const TiXmlElement* root); 21 22 virtual ~Gravity(); 23 24 void loadParams(const TiXmlElement* root); 22 25 23 26 virtual Vector calcForce(const Vector& data) const;
Note: See TracChangeset
for help on using the changeset viewer.