- Timestamp:
- May 20, 2008, 1:38:30 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h~
r1295 r1335 32 32 #include <OgreOverlayElement.h> 33 33 #include <OgrePanelOverlayElement.h> 34 #include <math.h>35 34 #include <util/Math.h> 36 35 #include <string.h> 37 #include <Tickable.h>36 #include "core/Tickable.h" 38 37 #include <OgrePrerequisites.h> 38 #include "objects/SpaceShip.h" 39 39 #include "../OrxonoxPrereqs.h" 40 40 41 41 namespace orxonox 42 42 { 43 class _OrxonoxExport RadarObject 44 { 45 private: 46 Ogre::OverlayManager* om; // our one and only overlay manager 47 48 public: 49 RadarObject(Ogre::OverlayContainer* container); 50 RadarObject(Ogre::OverlayContainer* container, Vector3 pos); 51 ~RadarObject(); 52 53 Vector3 pos_; // position in space 54 Ogre::Real radius_, phi_; // position on radar 55 bool right_; 56 Ogre::OverlayContainer* container_; 57 Ogre::PanelOverlayElement* panel_; // the panel used to show the dot 58 59 static int count; 60 }; 43 61 44 class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement, public Tickable45 {46 private:47 48 PanelOverlayElement* point[100];49 50 Vector3 initialDir; //initial direction51 int dirX_, dirY_, dirZ_; //flying direction52 int ortX_, ortY_, ortZ_; //orthogonal direction53 int dX_, dY_, dZ_; //distance between main ship and the object54 int vecX_, vecY_, vecZ_; //vector product dir X ort55 double alpha_; //defines the radius in the radar 56 double beta_; //defines the angle in the radar57 bool right_; //checks whether the object is on the right side (since cos is not bijective)58 59 // static int ID = 0; 62 class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement 63 { 64 private: 65 Ogre::OverlayManager* om; // our one and only overlay manager 66 Ogre::OverlayContainer* container_; 67 Vector3 initialDir_; // direction of nose 68 Vector3 currentDir_; 69 Vector3 initialOrth_; // direction of normal 70 Vector3 currentOrth_; 71 Vector3 shipPos_; // position of ship 72 73 RadarObject* tomato_; 74 75 Ogre::Real leftRel_, topRel_, dimRel_; // relative position/dimension 76 int left_, top_, dim_; // absolute position/dimension 77 int windowW_, windowH_; // absolute window dimensions 60 78 61 public: 62 63 RadarOverlayElement(const Ogre::String& name); 64 virtual ~RadarOverlayElement(); 65 virtual void initialise(); 66 67 void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container); 68 void setMainShipPosition(int dirX, int dirY, int dirZ, int ortX, int ortY, int ortZ); 69 void tick(float dt); 70 int newShip(int X, int Y, int Z); 71 72 void resetShip(int shipID, int Y, int Z); 73 }; 74 } 79 public: 80 RadarOverlayElement(const Ogre::String& name); 81 ~RadarOverlayElement(); 82 void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container); 83 void resize(); 84 void update(); 85 void addObject(Vector3 pos); 86 }; 87 } 75 88 76 89 #endif
Note: See TracChangeset
for help on using the changeset viewer.