Emergency 20 Dokumentation  4.2.0
TransformData.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 //[-------------------------------------------------------]
14 
15 #include <qsf/base/WeakPtr.h>
16 
17 #include <glm/gtc/quaternion.hpp>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace qsf
24 {
25  class Entity;
26  class TransformComponent;
27  namespace game
28  {
29  class BitStream;
30  }
31 }
32 
33 
34 //[-------------------------------------------------------]
35 //[ Namespace ]
36 //[-------------------------------------------------------]
37 namespace em5
38 {
39  namespace multiplayer
40  {
41 
42 
43  //[-------------------------------------------------------]
44  //[ Classes ]
45  //[-------------------------------------------------------]
51  {
52 
53 
54  //[-------------------------------------------------------]
55  //[ Public methods ]
56  //[-------------------------------------------------------]
57  public:
58  TransformData(const qsf::Entity& targetEntity);
59  virtual ~TransformData();
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public virtual em5::multiplayer::DataCacheBase methods ]
64  //[-------------------------------------------------------]
65  public:
66  virtual bool prepareForUpdate(const qsf::Entity& targetEntity, const qsf::Clock& clock) override;
67  virtual void updateData(qsf::game::BitStream& bitStream, bool force) override;
68  virtual void setData(const qsf::game::BitStream& bitStream, const int32 receivedHostTickCount) override;
69  virtual void interpolate(qsf::Entity& targetEntity, const qsf::Clock& clock, const int32 receivedHostTickCount) override;
70 
71 
72  //[-------------------------------------------------------]
73  //[ Private methods ]
74  //[-------------------------------------------------------]
75  private:
76  // Checks if the entity is linked to a another entity as child
77  bool isEntityLinked(const qsf::Entity& entity) const;
78 
79 
80  //[-------------------------------------------------------]
81  //[ Private data ]
82  //[-------------------------------------------------------]
83  private:
85  bool mInitialTransfer;
86  bool mPositionChanged;
87  glm::vec3 mLastPosition;
88  bool mRotationChanged;
89  glm::quat mLastRotation;
90 
91  // For client side only
92  struct HistoryEntry
93  {
94  int32 tickCount;
95  bool positionChanged;
96  glm::vec3 position;
97  bool rotationChanged;
98  glm::quat rotation;
99  };
100 
101  std::vector<HistoryEntry> mHistoryList;
102 
103 
104  };
105 
106 
107 //[-------------------------------------------------------]
108 //[ Namespace ]
109 //[-------------------------------------------------------]
110  } // multiplayer
111 } // em5
Definition: ActionPriority.h:13
EMERGENCY 5 multiplayer data cache base class.
Definition: DataCacheBase.h:48
Entity class.
Definition: Entity.h:46
virtual void updateData(qsf::game::BitStream &bitStream, bool force) override
Updates the cache and writes any changed data to the given bit stream.
Clock class.
Definition: Clock.h:33
virtual bool prepareForUpdate(const qsf::Entity &targetEntity, const qsf::Clock &clock) override
Prepares for an update.
virtual void interpolate(qsf::Entity &targetEntity, const qsf::Clock &clock, const int32 receivedHostTickCount) override
Does any interpolation steps needed to apply the cached data to the entity.
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
Definition: PickupPersonByParamedicAction.h:21
TransformData(const qsf::Entity &targetEntity)
signed int int32
Definition: PlatformTypes.h:180
EMERGENCY 5 entity with a transform componet data cache for a single entity for multiplayer.
Definition: TransformData.h:50
virtual void setData(const qsf::game::BitStream &bitStream, const int32 receivedHostTickCount) override
Reads the data from the bit stream.