Emergency 20 Dokumentation  4.2.0
HighlightComponent.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 #include <qsf/job/JobProxy.h>
18 #include <qsf/math/EnumBitmask.h>
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 
46  {
51  FLAG_CUSTOM
52  };
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public methods ]
58  //[-------------------------------------------------------]
59  public:
67  explicit HighlightComponent(qsf::Prototype* prototype);
68 
73  virtual ~HighlightComponent();
74 
79  inline bool getHighlightFlags(HighlightComponent::HighlightFlags flag) const;
80 
85  void setHighlightFlags(HighlightComponent::HighlightFlags flag, bool value);
86 
87  inline HighlightFlags getCurrentHighlightType() const;
88  inline float getGroundSpotLightRadius() const;
89 
97  void setGroundSpotLightRadius(float radius);
98 
99  inline float getSpotLightNearClipDistance() const;
100  void setSpotLightNearClipDistance(float distance);
101 
102  inline float getGroundHeight() const;
103  void setGroundHeight(float groundHeight);
104 
105 
106  //[-------------------------------------------------------]
107  //[ Protected virtual qsf::Component methods ]
108  //[-------------------------------------------------------]
109  protected:
110  virtual bool onStartup() override;
111  virtual void onShutdown() override;
112  virtual void onSetActive(bool active) override;
113 
114 
115  //[-------------------------------------------------------]
116  //[ Private methods ]
117  //[-------------------------------------------------------]
118  private:
119  void createOrUpdateGroundSpotComponent();
120  void updateHighlight();
121  void resetHighlightValues();
122  void updateJob(const qsf::JobArguments& jobArguments);
123 
124 
125  //[-------------------------------------------------------]
126  //[ Private data ]
127  //[-------------------------------------------------------]
128  private:
129  HighlightFlagSet mHighlightFlags;
130  HighlightFlags mCurrentHighlightType;
131  qsf::JobProxy mJobProxy;
132  float mGroundHeight;
133  float mGroundSpotLightRadius;
134  float mSpotLightNearClipDistance;
135 
136 
137  //[-------------------------------------------------------]
138  //[ CAMP reflection system ]
139  //[-------------------------------------------------------]
140  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
141 
142 
143  };
144 
145 
146 //[-------------------------------------------------------]
147 //[ Namespace ]
148 //[-------------------------------------------------------]
149 } // em5
150 
151 
152 //[-------------------------------------------------------]
153 //[ Implementation ]
154 //[-------------------------------------------------------]
156 
157 
158 //[-------------------------------------------------------]
159 //[ CAMP reflection system ]
160 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Highlight component to highlight a entity.
Definition: HighlightComponent.h:55
Highlight component to highlight an entity.
Definition: HighlightComponent.h:35
No highlighting.
Definition: HighlightComponent.h:47
Entity is selected highlighting.
Definition: HighlightComponent.h:49
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
static const uint32 COMPONENT_ID
"em5::HighlightComponent" unique component ID
Definition: HighlightComponent.h:43
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
HighlightFlags
Definition: HighlightComponent.h:45
Prototype class.
Definition: Prototype.h:100
qsf::EnumBitmask< uint8, HighlightFlags > HighlightFlagSet
Definition: HighlightComponent.h:53
Entity is selectable highlighting.
Definition: HighlightComponent.h:48
Entity is target for next command highlighting.
Definition: HighlightComponent.h:50