Emergency 20 Dokumentation  4.2.0
GroundSpotComponent.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 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public definitions ]
38  //[-------------------------------------------------------]
39  public:
40  static const uint32 COMPONENT_ID;
41 
42 
43  //[-------------------------------------------------------]
44  //[ Public methods ]
45  //[-------------------------------------------------------]
46  public:
54  explicit GroundSpotComponent(qsf::Prototype* prototype);
55 
60  inline virtual ~GroundSpotComponent();
61 
62  inline float getRadius() const;
63 
71  void setRadius(float radius);
72 
73  inline qsf::Entity* getGroundSpotLightEntity() const;
74 
75  inline float getGroundSpotLightHeight() const;
76  inline void setGroundSpotLightHeight(float groundSpotLightHeight);
77 
78  void setClipFactors(float nearClipFactor, float farClipFactor);
79 
89  void setSpotLightTexture(const std::string& assetId);
90 
91 
92  //[-------------------------------------------------------]
93  //[ Protected virtual qsf::Component methods ]
94  //[-------------------------------------------------------]
95  protected:
96  virtual void onShutdown() override;
97  virtual void onSetActive(bool active) override;
98  virtual void onSetSimulating(bool simulating) override;
99 
100 
101  //[-------------------------------------------------------]
102  //[ Private methods ]
103  //[-------------------------------------------------------]
104  protected:
105  qsf::Entity* createSpotLightEntity(const std::string& textureAssetName);
106  void setupLightForEntity(qsf::Entity& entity);
107 
108 
109  //[-------------------------------------------------------]
110  //[ Private methods ]
111  //[-------------------------------------------------------]
112  private:
113  void createGroundLight();
114  void destroyGroundLight();
115  void setupGroundLight();
116 
117 
118  //[-------------------------------------------------------]
119  //[ Protected data ]
120  //[-------------------------------------------------------]
121  protected:
127 
128 
129  //[-------------------------------------------------------]
130  //[ Private data ]
131  //[-------------------------------------------------------]
132  private:
133  std::string mSpotLightTexture;
134 
135 
136  //[-------------------------------------------------------]
137  //[ CAMP reflection system ]
138  //[-------------------------------------------------------]
139  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
140 
141 
142  };
143 
144 
145 //[-------------------------------------------------------]
146 //[ Namespace ]
147 //[-------------------------------------------------------]
148 } // em5
149 
150 
151 //[-------------------------------------------------------]
152 //[ Implementation ]
153 //[-------------------------------------------------------]
155 
156 
157 //[-------------------------------------------------------]
158 //[ CAMP reflection system ]
159 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
float mGroundSpotLightHeight
Height of spotlight above entity.
Definition: GroundSpotComponent.h:124
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
float mGroundSpotLightRadius
Radius of highlighted circle on the ground.
Definition: GroundSpotComponent.h:122
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Highlight component to highlight an entity.
Definition: GroundSpotComponent.h:32
qsf::WeakPtr< qsf::Entity > mGroundSpotLightEntity
Spotlight used to highlight a circle on the ground.
Definition: GroundSpotComponent.h:123
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
float mNearClipFactor
Definition: GroundSpotComponent.h:125
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Prototype class.
Definition: Prototype.h:100
static const uint32 COMPONENT_ID
"em5::GroundSpotComponent" unique component ID
Definition: GroundSpotComponent.h:40
float mFarClipFactor
Definition: GroundSpotComponent.h:126