Changeset 1502 for code/trunk/src/orxonox/hud/RadarOverlayElement.h
- Timestamp:
- Jun 1, 2008, 3:54:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/hud/RadarOverlayElement.h
r1407 r1502 1 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * 4 * 5 * License notice: 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Author: 22 * Yuning Chai 23 * Co-authors: 24 * ... 25 * 26 */ 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 * Yuning Chai 24 * Co-authors: 25 * Felix Schulthess 26 * 27 */ 27 28 28 #ifndef _R ADAR_H__29 #define _R ADAR_H__29 #ifndef _RadarOverlayElement_H__ 30 #define _RadarOverlayElement_H__ 30 31 31 #include <string.h> 32 #include <OgreOverlayManager.h> 33 #include <OgreStringConverter.h> 34 #include <OgreOverlayElement.h> 32 #include "OrxonoxPrereqs.h" 33 34 #include <OgrePrerequisites.h> 35 35 #include <OgrePanelOverlayElement.h> 36 #include <OgrePrerequisites.h> 37 38 #include <util/Math.h> 39 #include <string.h> 40 #include "core/Tickable.h" 41 #include "core/ConsoleCommand.h" 42 #include "objects/SpaceShip.h" 43 #include "../OrxonoxPrereqs.h" 44 #include "RadarObject.h" 45 #include "GraphicsEngine.h" 36 #include "util/Math.h" 46 37 47 38 namespace orxonox … … 49 40 class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement 50 41 { 51 private: 52 Ogre::OverlayManager* om; // our one and only overlay manager 53 Ogre::OverlayContainer* container_; // pointer to the container we're in 54 Vector3 initialDir_; // direction of nose 55 Vector3 currentDir_; 56 Vector3 initialOrth_; // direction of normal 57 Vector3 currentOrth_; 58 Vector3 shipPos_; // position of ship 59 Ogre::Plane plane; // plane perpendicular to dir 42 private: 43 Ogre::OverlayManager* om; // our one and only overlay manager 44 Ogre::OverlayContainer* container_; // pointer to the container we're in 45 Vector3 currentDir_; 46 Vector3 currentOrth_; 47 Vector3 shipPos_; // position of ship 60 48 61 62 63 int windowW_, windowH_;// absolute window dimensions49 Ogre::Real leftRel_, topRel_, dimRel_; // relative position/dimension 50 int left_, top_, dim_; // absolute position/dimension 51 int windowW_, windowH_; // absolute window dimensions 64 52 65 public: 66 RadarOverlayElement(const Ogre::String& name); 67 ~RadarOverlayElement(); 68 void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container); 69 void resize(); 70 void update(); 71 void updateNavMarker(); 72 void addObject(Vector3 pos); 73 void listObjects(); 74 float getDist2Focus(); 75 float calcRadius(RadarObject* obj); 76 float calcPhi(RadarObject* obj); 77 bool calcRight(RadarObject* obj); 53 public: 54 RadarOverlayElement(const Ogre::String& name); 55 ~RadarOverlayElement(); 56 void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container); 57 void resize(); 58 void update(); 59 void listObjects(); 78 60 79 Ogre::PanelOverlayElement* navMarker_; // marker to help navigating 80 RadarObject* firstRadarObject_; // start of linked list 81 RadarObject* lastRadarObject_; // end of linked list 82 RadarObject* focus_; // object that is focussed 83 84 static RadarOverlayElement* instance_s; 85 static void cycleFocus(); 86 }; 61 static float calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj); 62 static float calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj); 63 static bool calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj); 64 }; 87 65 } 88 66 89 #endif 67 #endif /* _RadarOverlayElement_H__ */
Note: See TracChangeset
for help on using the changeset viewer.