Rev | Line | |
---|
[4728] | 1 | /* |
---|
[4179] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Benjamin Grauer |
---|
| 13 | co-programmer: ... |
---|
| 14 | */ |
---|
| 15 | |
---|
[4728] | 16 | /*! |
---|
[5039] | 17 | * @file field.h |
---|
[9869] | 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 | */ |
---|
[3329] | 23 | |
---|
[4179] | 24 | #ifndef _FIELD_H |
---|
| 25 | #define _FIELD_H |
---|
[1853] | 26 | |
---|
[4179] | 27 | #include "p_node.h" |
---|
[1853] | 28 | |
---|
[5405] | 29 | // FORWARD DECLARATION |
---|
[4728] | 30 | class TiXmlElement; |
---|
[3543] | 31 | |
---|
| 32 | |
---|
[4179] | 33 | //! An abstract class that represents a Force. |
---|
[4728] | 34 | class Field : public PNode |
---|
[4179] | 35 | { |
---|
[9869] | 36 | ObjectListDeclaration(Field); |
---|
[1904] | 37 | public: |
---|
[4179] | 38 | Field(); |
---|
| 39 | virtual ~Field(); |
---|
[1853] | 40 | |
---|
[4746] | 41 | void init(); |
---|
[6512] | 42 | virtual void loadParams(const TiXmlElement* root); |
---|
[4728] | 43 | |
---|
| 44 | /** |
---|
[4836] | 45 | * @param data This is the data given to this force, to calculate the ForceVector |
---|
| 46 | * @returns The Force Vector |
---|
[4179] | 47 | */ |
---|
[4395] | 48 | virtual Vector calcForce(const Vector& data) const = 0; |
---|
[3245] | 49 | |
---|
[4728] | 50 | void setMagnitude(float magnitude); |
---|
[4836] | 51 | /** @returns The Magnitude of the Field */ |
---|
[4746] | 52 | inline const float& getMagnitude() const {return this->magnitude;} |
---|
[4179] | 53 | |
---|
[4728] | 54 | void setAttenuation(float attenuation); |
---|
[4836] | 55 | /** @returns The Attenuation of the Fiels */ |
---|
[4746] | 56 | inline const float& getAttenuation() const {return this->attenuation;} |
---|
[4179] | 57 | |
---|
[3245] | 58 | private: |
---|
[4179] | 59 | float magnitude; //!< The strength of the field |
---|
| 60 | float attenuation; //!< The Attenuation (the bigger the shorter the influenced distance). |
---|
[1853] | 61 | }; |
---|
| 62 | |
---|
[4179] | 63 | #endif /* _FIELD_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.