1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Yuning Chai |
---|
24 | * Felix Schulthess |
---|
25 | * Co-authors: |
---|
26 | * Reto Grieder |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | #ifndef _HUDRadar_H__ |
---|
31 | #define _HUDRadar_H__ |
---|
32 | |
---|
33 | #include "overlays/OverlaysPrereqs.h" |
---|
34 | |
---|
35 | #include <map> |
---|
36 | #include <vector> |
---|
37 | #include <string> |
---|
38 | |
---|
39 | #include "util/OgreForwardRefs.h" |
---|
40 | #include "interfaces/RadarListener.h" |
---|
41 | #include "interfaces/RadarViewable.h" |
---|
42 | #include "overlays/OrxonoxOverlay.h" |
---|
43 | |
---|
44 | namespace orxonox |
---|
45 | { |
---|
46 | class _OverlaysExport HUDRadar : public OrxonoxOverlay, public RadarListener |
---|
47 | { |
---|
48 | public: |
---|
49 | HUDRadar(Context* context); |
---|
50 | virtual ~HUDRadar(); |
---|
51 | |
---|
52 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
53 | virtual void changedOwner(); |
---|
54 | void setConfigValues(); |
---|
55 | |
---|
56 | private: |
---|
57 | // XML accessors |
---|
58 | float getHalfDotSizeDistance() const { return this->halfDotSizeDistance_; } |
---|
59 | void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; } |
---|
60 | |
---|
61 | void setDetectionLimit( float limit ) |
---|
62 | { this->detectionLimit_ = limit; } |
---|
63 | float getDetectionLimit() const |
---|
64 | { return this->detectionLimit_; } |
---|
65 | |
---|
66 | float getMaximumDotSize() const { return this->maximumDotSize_; } |
---|
67 | void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } |
---|
68 | |
---|
69 | float getMaximumDotSize3D() const { return this->maximumDotSize3D_; } |
---|
70 | void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;} |
---|
71 | |
---|
72 | std::string get2DMaterial() const {return this->material2D_; } |
---|
73 | void set2DMaterial(std::string material2D) { this->material2D_ = material2D; } |
---|
74 | |
---|
75 | std::string get3DMaterial() const {return this->material3D_; } |
---|
76 | void set3DMaterial(std::string material3D) { this->material3D_ = material3D; } |
---|
77 | |
---|
78 | float getRadarSensitivity() const { return this->sensitivity_; } |
---|
79 | // used also by RadarListener interface! |
---|
80 | void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; } |
---|
81 | |
---|
82 | // RadarListener interface |
---|
83 | virtual void addObject(RadarViewable* viewable); |
---|
84 | virtual void removeObject(RadarViewable* viewable); |
---|
85 | virtual void objectChanged( RadarViewable* rv ); |
---|
86 | void radarTick(float dt); |
---|
87 | bool showObject( RadarViewable* rv ); //!< Do not display an object on radar, if showObject(.) is false. |
---|
88 | |
---|
89 | void gatherObjects(); |
---|
90 | |
---|
91 | std::map<RadarViewable::Shape, std::string> shapeMaterials_; |
---|
92 | |
---|
93 | // std::vector<Ogre::PanelOverlayElement*> radarDots_; |
---|
94 | // std::vector<Ogre::PanelOverlayElement*>::iterator itRadarDots_; |
---|
95 | std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarObjects_; |
---|
96 | Ogre::PanelOverlayElement* marker_; |
---|
97 | |
---|
98 | bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode |
---|
99 | |
---|
100 | float halfDotSizeDistance_; |
---|
101 | float maximumDotSize_; |
---|
102 | float maximumDotSize3D_; |
---|
103 | |
---|
104 | std::string material2D_; |
---|
105 | std::string material3D_; |
---|
106 | |
---|
107 | float sensitivity_; |
---|
108 | float detectionLimit_; |
---|
109 | ControllableEntity* owner_; |
---|
110 | }; |
---|
111 | } |
---|
112 | |
---|
113 | #endif /* _HUDRadar_H__ */ |
---|