Orxonox  0.0.5 Codename: Arcturus
ForceField.h
Go to the documentation of this file.
1 
2 /*
3  * ORXONOX - the hottest 3D action shooter ever to exist
4  * > www.orxonox.net <
5  *
6  *
7  * License notice:
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22  *
23  * Author:
24  * Aurelian Jaggi
25  * Co-authors:
26  * Damian 'Mozork' Frick
27  * Kevin Young
28  *
29  */
30 
37 #ifndef _ForceField_H__
38 #define _ForceField_H__
39 
40 #include "objects/ObjectsPrereqs.h"
41 
44 
45 namespace orxonox
46 {
47 
54  enum class ForceFieldMode {
55  tube,
56  sphere,
59  homogen
60  };
61 
86  {
87  public:
88  ForceField(Context* context);
89  virtual ~ForceField();
90 
91  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
92  void registerVariables();
93  virtual void tick(float dt) override;
94 
95 
100  inline void setFieldVelocity(float vel)
101  { this->velocity_ = vel; }
106  inline float getFieldVelocity()
107  { return this->velocity_; }
108 
113  inline void setDiameter(float diam)
114  { this->radius_ = diam/2; }
119  inline float getDiameter()
120  { return this->radius_*2; }
121 
126  inline void setMassDiameter(float massDiam)
127  { this->massRadius_ = massDiam/2; }
128 
133  inline float getMassDiameter()
134  { return this->massRadius_*2; }
135 
140  inline void setLength(float l)
141  { this->halfLength_ = l/2; }
146  inline float getLength()
147  { return this->halfLength_*2; }
148 
149  inline void setForceDirection(Vector3 forcedir)
150  { this->forceDirection_ = forcedir; }
151 
152  inline Vector3 getForceDirection()
153  { return this->forceDirection_; }
154 
155 
156  void setMode(const std::string& mode);
157  const std::string& getMode(void);
158 
160  static const std::string modeTube_s;
161  static const std::string modeSphere_s;
165 
166  private:
167  float velocity_;
168  float radius_;
169  float massRadius_;
170  float halfLength_;
172 
174  static const float gravConstant_;
176  static const float attenFactor_;
178  };
179 }
180 
181 #endif
#define _ObjectsExport
Definition: ObjectsPrereqs.h:60
The ForceField has a tube shape.
ForceFieldMode
The mode of the ForceField.
Definition: ForceField.h:54
float halfLength_
Half of the length of the ForceField.
Definition: ForceField.h:170
The StaticEntity is the simplest derivative of the orxonox::WorldEntity class.
Definition: StaticEntity.h:50
Declaration of the Tickable interface.
void setMassDiameter(float massDiam)
Set the diameter of the stellar body for the Newtonian ForceField.
Definition: ForceField.h:126
static const float attenFactor_
Attenuation factor for Newtonian ForceFields.
Definition: ForceField.h:176
::std::string string
Definition: gtest-port.h:756
static const float gravConstant_
Gravitational constant for Newtonian ForceFields.
Definition: ForceField.h:174
Vector3 getForceDirection()
Definition: ForceField.h:152
static const std::string modeTube_s
Strings to represent the modes.
Definition: ForceField.h:160
Local homogenous Force field with changeable direction for the Space Station.
The ForceField has a spherical shape but "inverted" behavior.
The ForceField imitates Newtonian gravitation for use in stellar bodies.
void setForceDirection(Vector3 forcedir)
Definition: ForceField.h:149
float getDiameter()
Get the diameter of the ForceField.
Definition: ForceField.h:119
xmlelement
Definition: Super.h:519
float massRadius_
The radius of the stellar body for the Newtonian ForceField.
Definition: ForceField.h:169
ForceFieldMode mode_
The mode of the ForceField.
Definition: ForceField.h:171
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
void setDiameter(float diam)
Set the diameter of the ForceField.
Definition: ForceField.h:113
Mode
Definition: CorePrereqs.h:102
Vector3 forceDirection_
Definition: ForceField.h:177
static const std::string modeHomogen_s
Definition: ForceField.h:164
float getMassDiameter()
Get the diameter of the stellar body for the Newtonian ForceField.
Definition: ForceField.h:133
static const std::string modeSphere_s
Definition: ForceField.h:161
Definition: Context.h:45
void setFieldVelocity(float vel)
Set the velocity of the ForceField.
Definition: ForceField.h:100
static const std::string modeInvertedSphere_s
Definition: ForceField.h:162
Shared library macros, enums, constants and forward declarations for the objects module ...
float getFieldVelocity()
Get the velocity of the ForceField.
Definition: ForceField.h:106
void setLength(float l)
Set the length of the ForceField.
Definition: ForceField.h:140
float getLength()
Get the length of the ForceField.
Definition: ForceField.h:146
The Tickable interface provides a tick(dt) function, that gets called every frame.
Definition: Tickable.h:52
float velocity_
The velocity of the ForceField.
Definition: ForceField.h:167
float radius_
The radius of the ForceField.
Definition: ForceField.h:168
static const std::string modeNewtonianGravity_s
Definition: ForceField.h:163
Implements a force field, that applies a force to any MobileEntity that enters its range...
Definition: ForceField.h:85
The ForceField has a spherical shape.