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" |
---|
33 | #include <string> |
---|
34 | #include <cassert> |
---|
35 | #include "util/Math.h" |
---|
36 | #include "util/Debug.h" |
---|
37 | #include "core/OrxonoxClass.h" |
---|
38 | |
---|
39 | #include <string> |
---|
40 | #include <OgreSceneNode.h> |
---|
41 | #include <OgreEntity.h> |
---|
42 | #include <OgreManualObject.h> |
---|
43 | #include "orxonox/tools/DynamicLines.h" |
---|
44 | |
---|
45 | namespace orxonox |
---|
46 | { |
---|
47 | /** |
---|
48 | @brief Interface for receiving window events. |
---|
49 | */ |
---|
50 | class _OrxonoxExport RadarViewable : virtual public OrxonoxClass |
---|
51 | { |
---|
52 | public: |
---|
53 | enum Shape |
---|
54 | { |
---|
55 | Square, |
---|
56 | Dot, |
---|
57 | Triangle |
---|
58 | }; |
---|
59 | |
---|
60 | |
---|
61 | public: |
---|
62 | RadarViewable(); |
---|
63 | virtual ~RadarViewable(); |
---|
64 | |
---|
65 | inline void setRadarObjectCamouflage(float camouflage) |
---|
66 | { this->radarObjectCamouflage_ = camouflage; } |
---|
67 | inline float getRadarObjectCamouflage() const |
---|
68 | { return this->radarObjectCamouflage_; } |
---|
69 | |
---|
70 | inline void setRadarObjectColour(const ColourValue& colour) |
---|
71 | { this->radarObjectColour_ = colour; } |
---|
72 | inline const ColourValue& getRadarObjectColour() const |
---|
73 | { return this->radarObjectColour_; } |
---|
74 | |
---|
75 | void setRadarObjectDescription(const std::string& str); |
---|
76 | inline const std::string& getRadarObjectDescription() const |
---|
77 | { return this->radarObjectDescription_; } |
---|
78 | |
---|
79 | inline void setRadarVisibility(bool b) |
---|
80 | { this->bVisibility_ = b; } |
---|
81 | inline bool getRadarVisibility() const |
---|
82 | { return this->bVisibility_; } |
---|
83 | |
---|
84 | virtual const WorldEntity* getWorldEntity() const = 0; |
---|
85 | |
---|
86 | const Vector3& getRVWorldPosition() const; |
---|
87 | Vector3 getRVOrientedVelocity() const; |
---|
88 | |
---|
89 | inline void setRadarObjectShape(Shape shape) |
---|
90 | { this->radarObjectShape_ = shape; } |
---|
91 | inline Shape getRadarObjectShape() const |
---|
92 | { return this->radarObjectShape_; } |
---|
93 | |
---|
94 | /* |
---|
95 | inline void setMapNode(Ogre::SceneNode * node) |
---|
96 | { this->MapNode_ = node; } |
---|
97 | inline Ogre::SceneNode * getMapNode() const |
---|
98 | { return this->MapNode_; } |
---|
99 | inline void setMapEntity(Ogre::Entity * ent) |
---|
100 | { this->MapEntity_ = ent; } |
---|
101 | inline Ogre::Entity * getMapEntity() const |
---|
102 | { return this->MapEntity_; } |
---|
103 | */ |
---|
104 | //Used for Map |
---|
105 | Ogre::SceneNode * MapNode_; |
---|
106 | Ogre::Entity * MapEntity_; |
---|
107 | DynamicLines* line_; |
---|
108 | Ogre::SceneNode * LineNode_; |
---|
109 | void addMapEntity(); |
---|
110 | void updateMapPosition(); |
---|
111 | bool isHumanShip_; |
---|
112 | inline std::string getUniqueId() |
---|
113 | { |
---|
114 | return this->uniqueId_; |
---|
115 | } |
---|
116 | |
---|
117 | private: |
---|
118 | void validate(const WorldEntity* object) const |
---|
119 | { |
---|
120 | if (!object) |
---|
121 | { |
---|
122 | COUT(1) << "Assertation: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl; |
---|
123 | assert(0); |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | bool bVisibility_; |
---|
128 | //Map |
---|
129 | std::string uniqueId_; |
---|
130 | |
---|
131 | |
---|
132 | //Radar |
---|
133 | float radarObjectCamouflage_; |
---|
134 | Shape radarObjectShape_; |
---|
135 | std::string radarObjectDescription_; |
---|
136 | ColourValue radarObjectColour_; |
---|
137 | |
---|
138 | }; |
---|
139 | } |
---|
140 | |
---|
141 | #endif /* _RadarViewable_H__ */ |
---|