[1505] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
[1502] | 4 | * |
---|
[1505] | 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 | * |
---|
[1502] | 22 | * Author: |
---|
| 23 | * Yuning Chai |
---|
[1614] | 24 | * Felix Schulthess |
---|
[1502] | 25 | * Co-authors: |
---|
[1614] | 26 | * Reto Grieder |
---|
[1502] | 27 | * |
---|
| 28 | */ |
---|
[1283] | 29 | |
---|
[1604] | 30 | #ifndef _HUDRadar_H__ |
---|
| 31 | #define _HUDRadar_H__ |
---|
[1283] | 32 | |
---|
[5693] | 33 | #include "overlays/OverlaysPrereqs.h" |
---|
[1502] | 34 | |
---|
[3196] | 35 | #include <map> |
---|
[1614] | 36 | #include <vector> |
---|
[9939] | 37 | #include <string> |
---|
[3196] | 38 | |
---|
| 39 | #include "util/OgreForwardRefs.h" |
---|
| 40 | #include "interfaces/RadarListener.h" |
---|
| 41 | #include "interfaces/RadarViewable.h" |
---|
[1604] | 42 | #include "overlays/OrxonoxOverlay.h" |
---|
[1407] | 43 | |
---|
[1283] | 44 | namespace orxonox |
---|
| 45 | { |
---|
[5693] | 46 | class _OverlaysExport HUDRadar : public OrxonoxOverlay, public RadarListener |
---|
[1329] | 47 | { |
---|
[1615] | 48 | public: |
---|
[9667] | 49 | HUDRadar(Context* context); |
---|
[3196] | 50 | virtual ~HUDRadar(); |
---|
[1400] | 51 | |
---|
[7401] | 52 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[2662] | 53 | virtual void changedOwner(); |
---|
[9939] | 54 | void setConfigValues(); |
---|
[1604] | 55 | |
---|
[1615] | 56 | private: |
---|
| 57 | // XML accessors |
---|
[1613] | 58 | float getHalfDotSizeDistance() const { return this->halfDotSizeDistance_; } |
---|
| 59 | void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; } |
---|
[1604] | 60 | |
---|
[9939] | 61 | void setDetectionLimit( float limit ) { this->detectionLimit_ = limit; } |
---|
| 62 | float getDetectionLimit() const { return this->detectionLimit_; } |
---|
[8891] | 63 | |
---|
[1613] | 64 | float getMaximumDotSize() const { return this->maximumDotSize_; } |
---|
| 65 | void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } |
---|
| 66 | |
---|
[9939] | 67 | float getMaximumDotSize3D() const { return this->maximumDotSize3D_; } |
---|
| 68 | void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;} |
---|
| 69 | |
---|
| 70 | std::string get2DMaterial() const {return this->material2D_; } |
---|
| 71 | void set2DMaterial(std::string material2D) { this->material2D_ = material2D; } |
---|
| 72 | |
---|
| 73 | std::string get3DMaterial() const {return this->material3D_; } |
---|
| 74 | void set3DMaterial(std::string material3D) { this->material3D_ = material3D; } |
---|
| 75 | |
---|
| 76 | std::string get3DMaterialFront() const {return this->material3DFront_; } |
---|
| 77 | void set3DMaterialFront(std::string material3DFront) { this->material3DFront_ = material3DFront; } |
---|
| 78 | |
---|
| 79 | std::string get3DMaterialBack() const {return this->material3DBack_; } |
---|
| 80 | void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; } |
---|
| 81 | |
---|
[1615] | 82 | float getRadarSensitivity() const { return this->sensitivity_; } |
---|
| 83 | // used also by RadarListener interface! |
---|
| 84 | void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; } |
---|
| 85 | |
---|
[9939] | 86 | // Determines angle between line of sight and x/z-plain on the 3D minimap |
---|
| 87 | float getMapAngle() const { return this->mapAngle_; } |
---|
| 88 | void setMapAngle(float mapAngle) { this->mapAngle_ = mapAngle; } |
---|
| 89 | |
---|
[1615] | 90 | // RadarListener interface |
---|
[7163] | 91 | virtual void addObject(RadarViewable* viewable); |
---|
| 92 | virtual void removeObject(RadarViewable* viewable); |
---|
| 93 | virtual void objectChanged( RadarViewable* rv ); |
---|
[1613] | 94 | void radarTick(float dt); |
---|
[8891] | 95 | bool showObject( RadarViewable* rv ); //!< Do not display an object on radar, if showObject(.) is false. |
---|
[1604] | 96 | |
---|
[7163] | 97 | void gatherObjects(); |
---|
| 98 | |
---|
[1613] | 99 | std::map<RadarViewable::Shape, std::string> shapeMaterials_; |
---|
[1604] | 100 | |
---|
[7163] | 101 | // std::vector<Ogre::PanelOverlayElement*> radarDots_; |
---|
| 102 | // std::vector<Ogre::PanelOverlayElement*>::iterator itRadarDots_; |
---|
| 103 | std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarObjects_; |
---|
[1613] | 104 | Ogre::PanelOverlayElement* marker_; |
---|
| 105 | |
---|
[9939] | 106 | bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode |
---|
| 107 | |
---|
[1613] | 108 | float halfDotSizeDistance_; |
---|
| 109 | float maximumDotSize_; |
---|
[9939] | 110 | float maximumDotSize3D_; |
---|
| 111 | float mapAngle_; |
---|
[1613] | 112 | |
---|
[9939] | 113 | std::string material2D_; //Material name for 2D map |
---|
| 114 | std::string material3D_; //Material names For the 3D minimap |
---|
| 115 | std::string material3DFront_; |
---|
| 116 | std::string material3DBack_; |
---|
| 117 | |
---|
| 118 | Ogre::PanelOverlayElement* map3DFront_; //Overlayelements for the 3D minimap to be able to draw the points in a semi 3D matter |
---|
| 119 | Ogre::PanelOverlayElement* map3DBack_; |
---|
| 120 | |
---|
[1613] | 121 | float sensitivity_; |
---|
[8891] | 122 | float detectionLimit_; |
---|
[7880] | 123 | ControllableEntity* owner_; |
---|
[1604] | 124 | }; |
---|
[1302] | 125 | } |
---|
[1283] | 126 | |
---|
[1604] | 127 | #endif /* _HUDRadar_H__ */ |
---|