Emergency 20 Dokumentation  4.2.0
WheelComponent.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
17 
18 #include <glm/gtc/quaternion.hpp>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public definitions ]
41  //[-------------------------------------------------------]
42  public:
43  static const uint32 COMPONENT_ID;
44 
45  enum WheelType
46  {
47  WHEELTYPE_UNDEFINED = 0,
53  WHEELTYPE_CHAIN_LEFT
54  };
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public methods ]
59  //[-------------------------------------------------------]
60  public:
68  inline explicit WheelComponent(qsf::Prototype* prototype);
69 
74  inline virtual ~WheelComponent();
75 
76  void updateWheel(float movedDistance, float turningAngle);
77 
82  bool isChain() const;
83 
84  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(WheelType, WheelType, mWheelType)
85  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(OriginalLocalRotation, const glm::quat&, mOriginalLocalRotation)
86  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(Radius, float, mRadius)
87  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(DistanceFromTurnPoint, float, mDistanceFromTurnPoint)
88  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(AngularPosition, float, mAngleInRadians)
89  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(ChainSpeedV, float, mChainSpeedV)
90  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(ChainSpeedU, float, mChainSpeedU)
91 
92 
93  //[-------------------------------------------------------]
94  //[ Public virtual qsf::Component methods ]
95  //[-------------------------------------------------------]
96  public:
97  virtual void serialize(qsf::BinarySerializer& serializer) override;
98 
99 
100  //[-------------------------------------------------------]
101  //[ Private data ]
102  //[-------------------------------------------------------]
103  private:
104  glm::quat mOriginalLocalRotation;
105  float mRadius;
106  float mAngleInRadians;
107  WheelType mWheelType;
108  float mChainSpeedV;
109  float mChainSpeedU;
110  float mDistanceFromTurnPoint;
111  float mChainOffsetU;
112  float mChainOffsetV;
113 
114 
115  //[-------------------------------------------------------]
116  //[ CAMP reflection system ]
117  //[-------------------------------------------------------]
118  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
119 
120 
121  };
122 
123 
124 //[-------------------------------------------------------]
125 //[ Namespace ]
126 //[-------------------------------------------------------]
127 } // em5
128 
129 
130 //[-------------------------------------------------------]
131 //[ Implementation ]
132 //[-------------------------------------------------------]
133 #include "em5/component/vehicle/parts/WheelComponent-inl.h"
134 
135 
136 //[-------------------------------------------------------]
137 //[ CAMP reflection system ]
138 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Right Back wheel type.
Definition: WheelComponent.h:51
Abstract component class.
Definition: Component.h:105
WheelType
Definition: WheelComponent.h:45
Left front wheel type.
Definition: WheelComponent.h:48
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 vehicle wheel component class.
Definition: WheelComponent.h:35
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
static const uint32 COMPONENT_ID
"em5::WheelComponent" unique component ID
Definition: WheelComponent.h:43
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Right front wheel type.
Definition: WheelComponent.h:49
Left Back wheel type.
Definition: WheelComponent.h:50
Right chain wheel type.
Definition: WheelComponent.h:52
#define QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(name, type, variable)
Definition: PropertyHelper.h:16
Prototype class.
Definition: Prototype.h:100