Emergency 20 Dokumentation  4.2.0
PersonPlacementComponent.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 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23  class DiverLogic;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
45  {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public definitions ]
50  //[-------------------------------------------------------]
51  public:
52  static const uint32 COMPONENT_ID;
53 
55  {
56  AUTOMATIC, // Will select water or terrain automatically based on the height difference between them
57  FORCE_DEFAULT, // Only use the map with water (always swim - never be under water)
58  FORCE_NO_WATER, // Only use the terrain map - ignore water
59  NO_MAP // Placement does nothing at all
60  };
61 
63  {
66  PERSONTYPE_DIVER
67  };
68 
69 
70  //[-------------------------------------------------------]
71  //[ Public static methods ]
72  //[-------------------------------------------------------]
73  public:
74  static bool mustBeSwimming(const glm::vec3& position, float swimmingMinimumWaterHeight);
75  static bool mustBeSwimming(const glm::vec3& position);
76 
77 
78  //[-------------------------------------------------------]
79  //[ Public methods ]
80  //[-------------------------------------------------------]
81  public:
89  explicit PersonPlacementComponent(qsf::Prototype* prototype);
90 
95  virtual ~PersonPlacementComponent();
96 
101  void setCollapsedFlag(bool active);
102  bool getCollapsedFlag() const;
103 
104 
105  //[-------------------------------------------------------]
106  //[ Public virtual qsf::PlacementComponent methods ]
107  //[-------------------------------------------------------]
108  public:
109  virtual bool applyPlacement(glm::vec3& position, glm::quat& rotation) override;
110  virtual bool applyPlacement(glm::vec3& position, const glm::quat& rotation) override;
111 
112 
113  //[-------------------------------------------------------]
114  //[ Protected virtual qsf::Component methods ]
115  //[-------------------------------------------------------]
116  protected:
117  virtual void onSetSimulating(bool simulating) override;
118 
119 
120  //[-------------------------------------------------------]
121  //[ Protected static methods ]
122  //[-------------------------------------------------------]
123  protected:
124  // NOTE: unlike base-class this returns only false when it fails
125  static bool dropToGround(glm::vec3& position, uint32 groundMapFilterMask);
126 
127 
128  //[-------------------------------------------------------]
129  //[ Private methods ]
130  //[-------------------------------------------------------]
131  private:
132  bool applyPlacementInternal(glm::vec3& position, glm::quat& rotation, bool needsUpdatedRotation);
133 
134 
135  //[-------------------------------------------------------]
136  //[ Private data ]
137  //[-------------------------------------------------------]
138  private:
139  PersonType mPersonType;
140  bool mIsCollapsed;
141 
142  qsf::WeakPtr<DiverLogic> mDiverLogic;
143 
144 
145  //[-------------------------------------------------------]
146  //[ CAMP reflection system ]
147  //[-------------------------------------------------------]
148  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
149 
150 
151  };
152 
153 
154 //[-------------------------------------------------------]
155 //[ Namespace ]
156 //[-------------------------------------------------------]
157 } // qsf
158 
159 
160 //[-------------------------------------------------------]
161 //[ CAMP reflection system ]
162 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
unsigned int uint32
Definition: PlatformTypes.h:181
static const uint32 COMPONENT_ID
"em5::PersonPlacementComponent" unique component ID
Definition: PersonPlacementComponent.h:52
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: PersonPlacementComponent.h:58
Lightweight weak pointer implementation.
Definition: WeakPtr.h:133
PersonType
Definition: PersonPlacementComponent.h:62
Pivot on ground placement component class.
Definition: PersonPlacementComponent.h:44
Definition: PersonPlacementComponent.h:64
#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
Definition: PersonPlacementComponent.h:57
ActiveGroundMap
Definition: PersonPlacementComponent.h:54
Placement component base class.
Definition: PlacementComponent.h:44
Prototype class.
Definition: Prototype.h:100
Definition: PersonPlacementComponent.h:56
Default person type.
Definition: PersonPlacementComponent.h:65