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 | virtual const WorldEntity* getWorldEntity() const = 0; |
---|
80 | |
---|
81 | const Vector3& getRVWorldPosition() const; |
---|
82 | Vector3 getRVOrientedVelocity() const; |
---|
83 | |
---|
84 | inline void setRadarObjectShape(Shape shape) |
---|
85 | { this->radarObjectShape_ = shape; } |
---|
86 | inline Shape getRadarObjectShape() const |
---|
87 | { return this->radarObjectShape_; } |
---|
88 | |
---|
89 | /* |
---|
90 | inline void setMapNode(Ogre::SceneNode * node) |
---|
91 | { this->MapNode_ = node; } |
---|
92 | inline Ogre::SceneNode * getMapNode() const |
---|
93 | { return this->MapNode_; } |
---|
94 | inline void setMapEntity(Ogre::Entity * ent) |
---|
95 | { this->MapEntity_ = ent; } |
---|
96 | inline Ogre::Entity * getMapEntity() const |
---|
97 | { return this->MapEntity_; } |
---|
98 | */ |
---|
99 | //Used for Map |
---|
100 | Ogre::SceneNode * MapNode_; |
---|
101 | Ogre::Entity * MapEntity_; |
---|
102 | DynamicLines* line_; |
---|
103 | Ogre::SceneNode * LineNode_; |
---|
104 | void addMapEntity(); |
---|
105 | void updateMapPosition(); |
---|
106 | bool isHumanShip_; |
---|
107 | inline std::string getUniqueId() |
---|
108 | { |
---|
109 | return this->uniqueId_; |
---|
110 | } |
---|
111 | |
---|
112 | private: |
---|
113 | void validate(const WorldEntity* object) const |
---|
114 | { |
---|
115 | if (!object) |
---|
116 | { |
---|
117 | COUT(1) << "Assertation: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl; |
---|
118 | assert(0); |
---|
119 | } |
---|
120 | } |
---|
121 | |
---|
122 | //Map |
---|
123 | std::string uniqueId_; |
---|
124 | |
---|
125 | |
---|
126 | //Radar |
---|
127 | float radarObjectCamouflage_; |
---|
128 | Shape radarObjectShape_; |
---|
129 | std::string radarObjectDescription_; |
---|
130 | ColourValue radarObjectColour_; |
---|
131 | |
---|
132 | }; |
---|
133 | } |
---|
134 | |
---|
135 | #endif /* _RadarViewable_H__ */ |
---|