Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 20, 2008, 1:38:30 PM (17 years ago)
Author:
FelixSchulthess
Message:

edited radar to support multiple radar objects, wip though

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h~

    r1295 r1335  
    3232#include <OgreOverlayElement.h>
    3333#include <OgrePanelOverlayElement.h>
    34 #include <math.h>
    3534#include <util/Math.h>
    3635#include <string.h>
    37 #include <Tickable.h>
     36#include "core/Tickable.h"
    3837#include <OgrePrerequisites.h>
     38#include "objects/SpaceShip.h"
    3939#include "../OrxonoxPrereqs.h"
    4040
    4141namespace orxonox
    4242{
     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        };
    4361
    44   class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement, public Tickable
    45   {
    46   private:
    47    
    48     PanelOverlayElement* point[100];
    49    
    50     Vector3 initialDir;         //initial direction
    51     int dirX_, dirY_, dirZ_;    //flying direction
    52     int ortX_, ortY_, ortZ_;    //orthogonal direction
    53     int dX_, dY_, dZ_;          //distance between main ship and the object
    54     int vecX_, vecY_, vecZ_;    //vector product dir X ort
    55     double alpha_;              //defines the radius in the radar
    56     double beta_;               //defines the angle in the radar
    57     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
    6078
    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}
    7588
    7689#endif
Note: See TracChangeset for help on using the changeset viewer.