[1818] | 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 | * Reto Grieder |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _RadarViewable_H__ |
---|
| 30 | #define _RadarViewable_H__ |
---|
| 31 | |
---|
| 32 | #include "OrxonoxPrereqs.h" |
---|
[3157] | 33 | |
---|
[1818] | 34 | #include <string> |
---|
| 35 | #include <cassert> |
---|
[3157] | 36 | |
---|
[1818] | 37 | #include "util/Math.h" |
---|
[9667] | 38 | #include "core/class/OrxonoxInterface.h" |
---|
[10624] | 39 | #include "core/object/StrongPtr.h" |
---|
[1818] | 40 | |
---|
| 41 | namespace orxonox |
---|
| 42 | { |
---|
[7163] | 43 | class BaseObject; |
---|
| 44 | |
---|
[1818] | 45 | /** |
---|
| 46 | @brief Interface for receiving window events. |
---|
| 47 | */ |
---|
[9667] | 48 | class _OrxonoxExport RadarViewable : virtual public OrxonoxInterface |
---|
[1818] | 49 | { |
---|
| 50 | public: |
---|
| 51 | enum Shape |
---|
| 52 | { |
---|
| 53 | Square, |
---|
| 54 | Dot, |
---|
| 55 | Triangle |
---|
| 56 | }; |
---|
| 57 | |
---|
[3089] | 58 | |
---|
[1818] | 59 | public: |
---|
[7163] | 60 | RadarViewable(BaseObject* creator, const WorldEntity* wePtr); |
---|
[3089] | 61 | virtual ~RadarViewable(); |
---|
[1818] | 62 | |
---|
[9348] | 63 | virtual void setRadarName(const std::string& name) |
---|
| 64 | { |
---|
[9939] | 65 | // The following if-clause hides objects with radarname "HIDDEN" |
---|
| 66 | if (name == "HIDDEN") |
---|
| 67 | { |
---|
| 68 | this->bVisibility_ = 0; |
---|
| 69 | this->settingsChanged(); |
---|
| 70 | } |
---|
[9348] | 71 | if (this->radarName_ != name) |
---|
| 72 | { |
---|
| 73 | this->radarName_ = name; |
---|
| 74 | this->settingsChanged(); |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | const std::string& getRadarName() const |
---|
| 78 | { return this->radarName_; } |
---|
[9016] | 79 | |
---|
[2662] | 80 | inline void setRadarObjectCamouflage(float camouflage) |
---|
[7163] | 81 | { |
---|
| 82 | if( this->radarObjectCamouflage_ != camouflage ) |
---|
| 83 | { |
---|
| 84 | this->radarObjectCamouflage_ = camouflage; |
---|
| 85 | this->settingsChanged(); |
---|
| 86 | } |
---|
| 87 | } |
---|
[2662] | 88 | inline float getRadarObjectCamouflage() const |
---|
| 89 | { return this->radarObjectCamouflage_; } |
---|
[1818] | 90 | |
---|
[2662] | 91 | inline void setRadarObjectColour(const ColourValue& colour) |
---|
[7163] | 92 | { |
---|
| 93 | if(this->radarObjectColour_ != colour) |
---|
| 94 | { |
---|
| 95 | this->radarObjectColour_ = colour; |
---|
| 96 | this->settingsChanged(); |
---|
| 97 | } |
---|
| 98 | } |
---|
[2662] | 99 | inline const ColourValue& getRadarObjectColour() const |
---|
| 100 | { return this->radarObjectColour_; } |
---|
[1818] | 101 | |
---|
[7163] | 102 | // void setRadarObjectDescription(const std::string& str); |
---|
| 103 | // inline const std::string& getRadarObjectDescription() const |
---|
| 104 | // { return this->radarObjectDescription_; } |
---|
[1818] | 105 | |
---|
[3064] | 106 | inline void setRadarVisibility(bool b) |
---|
[7163] | 107 | { |
---|
| 108 | if(b!=this->bVisibility_) |
---|
| 109 | { |
---|
| 110 | this->bVisibility_ = b; |
---|
| 111 | this->settingsChanged(); |
---|
| 112 | } |
---|
| 113 | } |
---|
[3064] | 114 | inline bool getRadarVisibility() const |
---|
| 115 | { return this->bVisibility_; } |
---|
| 116 | |
---|
[7163] | 117 | virtual const WorldEntity* getWorldEntity() const{ return this->wePtr_; } |
---|
[1818] | 118 | |
---|
[2662] | 119 | const Vector3& getRVWorldPosition() const; |
---|
| 120 | Vector3 getRVOrientedVelocity() const; |
---|
[9526] | 121 | Vector3 getRVVelocity() const; |
---|
[1818] | 122 | |
---|
[2662] | 123 | inline void setRadarObjectShape(Shape shape) |
---|
[7163] | 124 | { |
---|
| 125 | if( this->radarObjectShape_ != shape ) |
---|
| 126 | { |
---|
| 127 | this->radarObjectShape_ = shape; |
---|
| 128 | this->settingsChanged(); |
---|
| 129 | } |
---|
| 130 | } |
---|
[2662] | 131 | inline Shape getRadarObjectShape() const |
---|
| 132 | { return this->radarObjectShape_; } |
---|
[8738] | 133 | |
---|
| 134 | inline void setRadarObjectScale(float scale) |
---|
| 135 | { |
---|
| 136 | if(this->scale_ != scale) |
---|
| 137 | { |
---|
| 138 | this->scale_ = scale; |
---|
| 139 | this->settingsChanged(); |
---|
| 140 | } |
---|
| 141 | } |
---|
| 142 | inline float getRadarObjectScale() const |
---|
| 143 | { return this->scale_; } |
---|
| 144 | |
---|
[7163] | 145 | void settingsChanged(); |
---|
[1818] | 146 | |
---|
[7163] | 147 | |
---|
[3089] | 148 | bool isHumanShip_; |
---|
[3157] | 149 | inline const std::string& getUniqueId() |
---|
[3089] | 150 | { |
---|
| 151 | return this->uniqueId_; |
---|
| 152 | } |
---|
[3101] | 153 | //friend class Map; |
---|
[3089] | 154 | |
---|
[1818] | 155 | private: |
---|
[3182] | 156 | void validate(const WorldEntity* object) const; |
---|
[3064] | 157 | bool bVisibility_; |
---|
[7163] | 158 | bool bInitialized_; |
---|
[3089] | 159 | //Map |
---|
| 160 | std::string uniqueId_; |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | //Radar |
---|
[7163] | 164 | const WorldEntity* wePtr_; |
---|
[10624] | 165 | StrongPtr<Radar> radar_; |
---|
[1818] | 166 | float radarObjectCamouflage_; |
---|
[2662] | 167 | Shape radarObjectShape_; |
---|
[1818] | 168 | std::string radarObjectDescription_; |
---|
| 169 | ColourValue radarObjectColour_; |
---|
[8738] | 170 | float scale_; |
---|
[9348] | 171 | std::string radarName_; |
---|
[1818] | 172 | }; |
---|
| 173 | } |
---|
| 174 | |
---|
| 175 | #endif /* _RadarViewable_H__ */ |
---|