| [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" | 
|---|
|  | 38 | #include "core/OrxonoxClass.h" | 
|---|
| [7163] | 39 | #include "core/SmartPtr.h" | 
|---|
| [1818] | 40 |  | 
|---|
|  | 41 | namespace orxonox | 
|---|
|  | 42 | { | 
|---|
| [7163] | 43 | class BaseObject; | 
|---|
|  | 44 |  | 
|---|
| [1818] | 45 | /** | 
|---|
|  | 46 | @brief Interface for receiving window events. | 
|---|
|  | 47 | */ | 
|---|
|  | 48 | class _OrxonoxExport RadarViewable : virtual public OrxonoxClass | 
|---|
|  | 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 |  | 
|---|
| [9272] | 63 | virtual void setRadarName(const std::string& name) | 
|---|
|  | 64 | { | 
|---|
|  | 65 | if (this->radarName_ != name) | 
|---|
|  | 66 | { | 
|---|
|  | 67 | this->radarName_ = name; | 
|---|
|  | 68 | this->settingsChanged(); | 
|---|
|  | 69 | } | 
|---|
|  | 70 | } | 
|---|
|  | 71 | const std::string& getRadarName() const | 
|---|
|  | 72 | { return this->radarName_; } | 
|---|
| [9016] | 73 |  | 
|---|
| [2662] | 74 | inline void setRadarObjectCamouflage(float camouflage) | 
|---|
| [7163] | 75 | { | 
|---|
|  | 76 | if( this->radarObjectCamouflage_ != camouflage ) | 
|---|
|  | 77 | { | 
|---|
|  | 78 | this->radarObjectCamouflage_ = camouflage; | 
|---|
|  | 79 | this->settingsChanged(); | 
|---|
|  | 80 | } | 
|---|
|  | 81 | } | 
|---|
| [2662] | 82 | inline float getRadarObjectCamouflage() const | 
|---|
|  | 83 | { return this->radarObjectCamouflage_; } | 
|---|
| [1818] | 84 |  | 
|---|
| [2662] | 85 | inline void setRadarObjectColour(const ColourValue& colour) | 
|---|
| [7163] | 86 | { | 
|---|
|  | 87 | if(this->radarObjectColour_ != colour) | 
|---|
|  | 88 | { | 
|---|
|  | 89 | this->radarObjectColour_ = colour; | 
|---|
|  | 90 | this->settingsChanged(); | 
|---|
|  | 91 | } | 
|---|
|  | 92 | } | 
|---|
| [2662] | 93 | inline const ColourValue& getRadarObjectColour() const | 
|---|
|  | 94 | { return this->radarObjectColour_; } | 
|---|
| [1818] | 95 |  | 
|---|
| [7163] | 96 | //         void setRadarObjectDescription(const std::string& str); | 
|---|
|  | 97 | //         inline const std::string& getRadarObjectDescription() const | 
|---|
|  | 98 | //             { return this->radarObjectDescription_; } | 
|---|
| [1818] | 99 |  | 
|---|
| [3064] | 100 | inline void setRadarVisibility(bool b) | 
|---|
| [7163] | 101 | { | 
|---|
|  | 102 | if(b!=this->bVisibility_) | 
|---|
|  | 103 | { | 
|---|
|  | 104 | this->bVisibility_ = b; | 
|---|
|  | 105 | this->settingsChanged(); | 
|---|
|  | 106 | } | 
|---|
|  | 107 | } | 
|---|
| [3064] | 108 | inline bool getRadarVisibility() const | 
|---|
|  | 109 | { return this->bVisibility_; } | 
|---|
|  | 110 |  | 
|---|
| [7163] | 111 | virtual const WorldEntity* getWorldEntity() const{ return this->wePtr_; } | 
|---|
| [1818] | 112 |  | 
|---|
| [2662] | 113 | const Vector3& getRVWorldPosition() const; | 
|---|
|  | 114 | Vector3 getRVOrientedVelocity() const; | 
|---|
| [1818] | 115 |  | 
|---|
| [2662] | 116 | inline void setRadarObjectShape(Shape shape) | 
|---|
| [7163] | 117 | { | 
|---|
|  | 118 | if( this->radarObjectShape_ != shape ) | 
|---|
|  | 119 | { | 
|---|
|  | 120 | this->radarObjectShape_ = shape; | 
|---|
|  | 121 | this->settingsChanged(); | 
|---|
|  | 122 | } | 
|---|
|  | 123 | } | 
|---|
| [2662] | 124 | inline Shape getRadarObjectShape() const | 
|---|
|  | 125 | { return this->radarObjectShape_; } | 
|---|
| [8738] | 126 |  | 
|---|
|  | 127 | inline void setRadarObjectScale(float scale) | 
|---|
|  | 128 | { | 
|---|
|  | 129 | if(this->scale_ != scale) | 
|---|
|  | 130 | { | 
|---|
|  | 131 | this->scale_ = scale; | 
|---|
|  | 132 | this->settingsChanged(); | 
|---|
|  | 133 | } | 
|---|
|  | 134 | } | 
|---|
|  | 135 | inline float getRadarObjectScale() const | 
|---|
|  | 136 | { return this->scale_; } | 
|---|
|  | 137 |  | 
|---|
| [7163] | 138 | void settingsChanged(); | 
|---|
| [1818] | 139 |  | 
|---|
| [7163] | 140 |  | 
|---|
| [3089] | 141 | bool isHumanShip_; | 
|---|
| [3157] | 142 | inline const std::string& getUniqueId() | 
|---|
| [3089] | 143 | { | 
|---|
|  | 144 | return this->uniqueId_; | 
|---|
|  | 145 | } | 
|---|
| [3101] | 146 | //friend class Map; | 
|---|
| [3089] | 147 |  | 
|---|
| [1818] | 148 | private: | 
|---|
| [3182] | 149 | void validate(const WorldEntity* object) const; | 
|---|
| [3064] | 150 | bool bVisibility_; | 
|---|
| [7163] | 151 | bool bInitialized_; | 
|---|
| [3089] | 152 | //Map | 
|---|
|  | 153 | std::string uniqueId_; | 
|---|
| [7163] | 154 | BaseObject* creator_; | 
|---|
| [3089] | 155 |  | 
|---|
|  | 156 |  | 
|---|
|  | 157 | //Radar | 
|---|
| [7163] | 158 | const WorldEntity* wePtr_; | 
|---|
|  | 159 | SmartPtr<Radar> radar_; | 
|---|
| [1818] | 160 | float radarObjectCamouflage_; | 
|---|
| [2662] | 161 | Shape radarObjectShape_; | 
|---|
| [1818] | 162 | std::string radarObjectDescription_; | 
|---|
|  | 163 | ColourValue radarObjectColour_; | 
|---|
| [8738] | 164 | float scale_; | 
|---|
| [9272] | 165 | std::string radarName_; | 
|---|
| [1818] | 166 | }; | 
|---|
|  | 167 | } | 
|---|
|  | 168 |  | 
|---|
|  | 169 | #endif /* _RadarViewable_H__ */ | 
|---|