Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2008, 1:49:54 PM (16 years ago)
Author:
rgrieder
Message:
  • reverted the HUD changes to ease up back merge from network branch

@everyone: please commit to the network branch from now on if it concerns the presentation.
Oli has also created a folder for the presentation files.
@fabian: you are excluded

Location:
code/trunk/src/orxonox
Files:
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/CMakeLists.txt

    r1393 r1407  
    99  hud/RadarOverlayElement.cc
    1010  hud/RadarObject.cc
    11   hud/Navigation.cc
    1211  particle/ParticleInterface.cc
    1312  tolua/tolua_bind.cc
  • code/trunk/src/orxonox/Orxonox.cc

    r1387 r1407  
    180180  {
    181181    // keep in mind: the order of deletion is very important!
    182 //    if (this->orxonoxHUD_)
    183 //      delete this->orxonoxHUD_;
     182    if (this->orxonoxHUD_)
     183      delete this->orxonoxHUD_;
    184184    Loader::close();
    185185    InputManager::destroy();
     
    348348    // Load the HUD
    349349    COUT(3) << "Orxonox: Loading HUD..." << std::endl;
    350     orxonoxHUD_ = &HUD::getSingleton();
     350    orxonoxHUD_ = new HUD(1);
    351351
    352352    COUT(3) << "Orxonox: Loading Console..." << std::endl;
     
    487487//      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
    488488      if (eventTimes[3].back() - eventTimes[3].front() != 0)
    489         HUD::setFPS(50000.0f/(eventTimes[3].back() - eventTimes[3].front()));
     489//        orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front())));
    490490
    491491      // Iterate through all Tickables and call their tick(dt) function
  • code/trunk/src/orxonox/hud/BarOverlayElement.cc

    r1392 r1407  
    2727
    2828#include <OgreOverlayManager.h>
     29#include <OgreOverlayElement.h>
     30#include <OgrePanelOverlayElement.h>
    2931#include "GraphicsEngine.h"
    3032#include "BarOverlayElement.h"
     
    3436  using namespace Ogre;
    3537
    36     BarOverlayElement::BarOverlayElement(const String& name):PanelOverlayElement(name){
     38    BarOverlayElement::BarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){
    3739        name_ = name;
    3840    }
     
    4042    BarOverlayElement::~BarOverlayElement(){}
    4143
    42     void BarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, OverlayContainer* container){
     44    void BarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container){
    4345        // init some values...
    4446        container_ = container;
    45         om = &OverlayManager::getSingleton();
     47        om = &Ogre::OverlayManager::getSingleton();
    4648        value_ = 0;
    4749        color_ = 2;
     
    5153        topRel_ = topRel;
    5254        dimRel_ = dimRel;
    53 
     55       
    5456        // create background...
    5557        background_ = static_cast<OverlayContainer*>(om->createOverlayElement("Panel", name_+"container"));
    5658        background_->show();
    5759        container_->addChild(background_);
    58         background_->setMetricsMode(GMM_PIXELS);
     60        background_->setMetricsMode(Ogre::GMM_PIXELS);
    5961        background_->setMaterialName("Orxonox/BarBackground");
    6062
     
    6365
    6466        show();
    65         setMetricsMode(GMM_PIXELS);
     67        setMetricsMode(Ogre::GMM_PIXELS);
    6668        setMaterialName("Orxonox/Green");
    6769        background_->addChild(this);
  • code/trunk/src/orxonox/hud/BarOverlayElement.h

    r1392 r1407  
    3030#define _BAR_H__
    3131
     32#include <OgreOverlayManager.h>
     33#include <OgreOverlayElement.h>
     34#include <OgrePanelOverlayElement.h>
    3235
    33 #include <OgrePanelOverlayElement.h>
    3436#include <OgrePrerequisites.h>
    3537#include "../OrxonoxPrereqs.h"
     38
     39
    3640
    3741namespace orxonox
  • code/trunk/src/orxonox/hud/HUD.cc

    r1400 r1407  
    2626*/
    2727
    28 #include <string.h>
     28
    2929#include "OrxonoxStableHeaders.h"
    3030#include <OgreOverlay.h>
    3131#include <OgreOverlayContainer.h>
    3232#include <OgreOverlayManager.h>
     33#include <OgreSceneNode.h>
     34#include <OgreEntity.h>
    3335#include <OgreStringConverter.h>
    34 
    3536#include "core/Debug.h"
    36 #include "core/ConsoleCommand.h"
    3737#include "objects/SpaceShip.h"
     38#include "HUD.h"
    3839#include "BarOverlayElement.h"
    3940#include "RadarOverlayElement.h"
    4041#include "OverlayElementFactories.h"
    41 #include "HUD.h"
    4242
    4343namespace orxonox
    4444{
    45     ConsoleCommandShortcut(HUD, cycleNavigationFocus, AccessLevel::User);
    46 
    4745    using namespace Ogre;
    4846
    49     HUD::HUD(){
     47    HUD::HUD(int zoom){
    5048        om = &Ogre::OverlayManager::getSingleton();
    51         firstRadarObject = NULL;
    52         lastRadarObject = NULL;
    5349
    5450                // create Factories
     
    6056        orxonoxHUD = om->create("Orxonox/HUD");
    6157        container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container"));
    62 
    63         // creating text to display fps
    64         fpsText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "fpsText"));
    65         fpsText->show();
    66         fpsText->setMetricsMode(Ogre::GMM_PIXELS);
    67         fpsText->setDimensions(0.001, 0.001);
    68         fpsText->setPosition(10, 10);
    69         fpsText->setFontName("Console");
    70         fpsText->setCharHeight(20);
    71         fpsText->setCaption("init");
     58        // test
     59        test = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "test123"));
     60        test->show();
     61        test->setMetricsMode(Ogre::GMM_RELATIVE);
     62        test->setDimensions(0.8, 0.8);
     63        test->setPosition(0.02, 0.02);
     64        test->setFontName("Console");
     65        test->setCaption("init");
    7266
    7367        // create energy bar
     
    8175        radar->show();
    8276
    83         // create Navigation
    84         nav = new Navigation(container);
    85 
    8677                // set up screen-wide container
    8778        container->show();
     
    9485        container->setHeight(1.0);
    9586        container->setMetricsMode(Ogre::GMM_RELATIVE);
    96         container->addChild(fpsText);
    97 
     87        container->addChild(test);
    9888        energyBar->init(0.01, 0.94, 0.4, container);
    9989        energyBar->setValue(1);
    100 
    10190        speedoBar->init(0.01, 0.90, 0.4, container);
    102 
    10391        radar->init(0.5, 0.9, 0.2, container);
    104         addRadarObject(Vector3(2000.0, 0.0, 0.0));
    105         addRadarObject(Vector3(0.0, 2000.0, 0.0));
    106         addRadarObject(Vector3(0.0, 0.0, 2000.0));
    107     }
    108 
    109     HUD::~HUD(){
    110         //todo: clean up objects
     92        radar->addObject(Vector3(1500.0, 0.0, 100.0));
     93        radar->addObject(Vector3(0.0, 4000.0, 0.0));
     94        radar->addObject(Vector3(0.0, 0.0, 6800.0));
     95        RadarOverlayElement::cycleFocus();
    11196    }
    11297
    11398    void HUD::tick(float dt)
    11499    {
     100        int d = radar->getDist2Focus()/10;
     101        if(d) test->setCaption("Distance: " + Ogre::StringConverter::toString(d));
     102        else test->setCaption("");
     103
    115104        energyBar->resize();
    116105
     
    122111        radar->resize();
    123112        radar->update();
    124 
    125         nav->update();
    126113    }
    127114
    128     void HUD::addRadarObject(Vector3 pos){
    129         // check if this is the first RadarObject to create
    130         if(firstRadarObject == NULL){
    131             firstRadarObject = new RadarObject(container, pos);
    132             lastRadarObject = firstRadarObject;
    133         }
    134         else{ // if not, append to list
    135             lastRadarObject->next = new RadarObject(container, pos);
    136             lastRadarObject = lastRadarObject->next;
    137         }
    138     }
    139 
    140     RadarObject* HUD::getFirstRadarObject(){
    141         return firstRadarObject;
    142     }
    143 
    144     /*static*/HUD& HUD::getSingleton(){
    145         static HUD theInstance;
    146         return theInstance;
    147     }
    148 
    149     /*static*/void HUD::setFPS(float fps){
    150         HUD::getSingleton().fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
    151     }
    152 
    153     /*static*/void HUD::setEnergy(float value){
    154         HUD::getSingleton().energyBar->setValue(value);
    155     }
    156 
    157     /*static*/void HUD::cycleNavigationFocus(){
    158         HUD::getSingleton().nav->cycleFocus();
     115    HUD::~HUD(void){
    159116    }
    160117}
  • code/trunk/src/orxonox/hud/HUD.h

    r1394 r1407  
    3030#define _HUD_H__
    3131
     32#include <string.h>
     33#include <OgreOverlayElement.h>
     34#include <OgreTextAreaOverlayElement.h>
    3235#include <OgrePrerequisites.h>
    33 #include <OgreTextAreaOverlayElement.h>
     36
    3437#include "OrxonoxPrereqs.h"
    3538#include "core/Tickable.h"
    3639#include "BarOverlayElement.h"
    3740#include "RadarOverlayElement.h"
    38 #include "Navigation.h"
    39 #include "RadarObject.h"
    4041
    4142
     
    4546    {
    4647        private:
    47             HUD();
    48             HUD(HUD& instance);
    49             ~HUD();
    5048            Ogre::OverlayManager* om;
    5149            Ogre::Overlay* orxonoxHUD;
    5250            Ogre::OverlayContainer* container;
    53             Ogre::TextAreaOverlayElement* fpsText;
     51            Ogre::TextAreaOverlayElement* test;
    5452            BarOverlayElement* energyBar;
    5553            BarOverlayElement* speedoBar;
    5654            RadarOverlayElement* radar;
    57             RadarObject* firstRadarObject;
    58             RadarObject* lastRadarObject;
    59             Navigation* nav;
    6055
    6156        public:
     57            HUD(int zoom);
     58            ~HUD();
    6259            virtual void tick(float);
    63             void addRadarObject(Vector3 pos);
    64             RadarObject* getFirstRadarObject();
    6560
    66             static HUD* instance_s;
    67             static HUD& getSingleton();
    68             static void setFPS(float fps);
    69             static void setEnergy(float value);
    70             static void cycleNavigationFocus();
    7161    };
    7262}
  • code/trunk/src/orxonox/hud/RadarObject.cc

    r1393 r1407  
    2626*/
    2727
    28 #include <string.h>
    29 #include <OgreOverlayManager.h>
    30 #include <OgrePanelOverlayElement.h>
    31 #include <OgreStringConverter.h>
    32 #include <util/Math.h>
    3328#include "RadarObject.h"
    3429
     
    3934        int RadarObject::count = 0;             // initialize static variable
    4035
    41         RadarObject::RadarObject(OverlayContainer* container){
     36        RadarObject::RadarObject(Ogre::OverlayContainer* container){
    4237                container_ = container;
    4338                pos_ = Vector3(0.0, 0.0, 0.0);
     
    4540        }
    4641
    47         RadarObject::RadarObject(OverlayContainer* container, Vector3 pos){
     42        RadarObject::RadarObject(Ogre::OverlayContainer* container, Vector3 pos){
    4843                container_ = container;
    4944                pos_ = pos;
     
    5550        void RadarObject::init(){
    5651            next = NULL;
    57                 om = &OverlayManager::getSingleton();
     52                om = &Ogre::OverlayManager::getSingleton();
    5853                panel_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel",
    59                         "Object"+StringConverter::toString(count)));
     54                        "Object"+Ogre::StringConverter::toString(count)));
    6055                panel_->setMaterialName("Orxonox/RedDot");
    6156                panel_->setDimensions(3,3);
     
    6762        }
    6863}
     64
     65/* my local clipboard...
     66COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
     67COUT(3) << firstRadarObject_->radius_ << "  " << firstRadarObject_->phi_ << std::endl;
     68COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
     69*/
  • code/trunk/src/orxonox/hud/RadarObject.h

    r1400 r1407  
    2828#ifndef _RADAR2_H__
    2929#define _RADAR2_H__
     30
     31#include <string.h>
    3032#include <OgrePrerequisites.h>
     33#include <OgreOverlayManager.h>
     34#include <OgreOverlayElement.h>
     35#include <OgrePanelOverlayElement.h>
     36#include <OgreStringConverter.h>
     37
     38#include <util/Math.h>
    3139#include "../OrxonoxPrereqs.h"
    3240
     
    4755            int index_;                             // index number of object
    4856                Vector3 pos_;                                                   // position in space
     57                        Ogre::Real radius_, phi_;                               // position on radar
    4958                        Ogre::OverlayContainer* container_;
    5059                        Ogre::PanelOverlayElement* panel_;              // the panel used to show the dot
  • code/trunk/src/orxonox/hud/RadarOverlayElement.cc

    r1400 r1407  
    2222*      Yuning Chai
    2323*   Co-authors:
    24 *      Felix Schulthess
     24*      ...
    2525*
    2626*/
    27 #include <string.h>
    28 
    29 
    30 #include <string.h>
    31 #include <OgreOverlayManager.h>
    32 #include <OgreStringConverter.h>
    33 #include <OgrePanelOverlayElement.h>
    34 
    35 #include "GraphicsEngine.h"
    36 #include "core/Tickable.h"
    37 #include "core/ConsoleCommand.h"
    38 #include "objects/SpaceShip.h"
    39 #include "HUD.h"
     27
    4028#include "RadarOverlayElement.h"
    4129
    4230namespace orxonox
    4331{
     32    ConsoleCommandShortcut(RadarOverlayElement, cycleFocus, AccessLevel::User);
    4433
    4534    using namespace Ogre;
    4635
    47     RadarOverlayElement::RadarOverlayElement(const String& name):PanelOverlayElement(name){
     36    RadarOverlayElement* RadarOverlayElement::instance_s = NULL;
     37
     38    RadarOverlayElement::RadarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){
     39        RadarOverlayElement::instance_s = this;
    4840    }
    4941
     
    5143    }
    5244
    53     void RadarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, OverlayContainer* container){
     45    void RadarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container){
    5446        // some initial data
    55                 om = &OverlayManager::getSingleton();
     47                om = &Ogre::OverlayManager::getSingleton();
    5648        dimRel_ = dimRel;
    5749        leftRel_ = leftRel;
    5850        topRel_ = topRel;
    5951        container_ = container;
    60 
    61         setMetricsMode(GMM_PIXELS);
     52        firstRadarObject_ = NULL;
     53        lastRadarObject_ = NULL;
     54        focus_ = NULL;
     55
     56        // create nav marker ...
     57        navMarker_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel", "NavMarker"));
     58        navMarker_->setMetricsMode(Ogre::GMM_PIXELS);
     59        navMarker_->setMaterialName("Orxonox/NavMarker");
     60        navMarker_->setDimensions(16,16);
     61        navMarker_->setPosition(0,386);
     62        navMarker_->hide();
     63        container_->addChild(navMarker_);
     64
     65        // these have to fit the data in the level
     66        shipPos_ = Vector3(0.0, 0.0, 0.0);
     67        initialDir_ = Vector3(1.0, 0.0, 0.0);
     68        currentDir_ = initialDir_;
     69        initialOrth_ = Vector3(0.0, 0.0, 1.0);
     70        currentOrth_ = initialOrth_;
     71        plane = Plane(currentDir_, shipPos_);
     72
     73        setMetricsMode(Ogre::GMM_PIXELS);
    6274        setMaterialName("Orxonox/Radar");
    6375        resize();
     
    7890
    7991    void RadarOverlayElement::update() {
    80         shipPos_ = SpaceShip::getLocalShip()->getPosition();
    81         currentDir_ = SpaceShip::getLocalShip()->getDir();
    82                 currentOrth_ = SpaceShip::getLocalShip()->getOrth();
    83         RadarObject* ro = HUD::getSingleton().getFirstRadarObject();
     92        shipPos_ = SpaceShip::instance_s->getPosition();
     93        currentDir_ = SpaceShip::instance_s->getOrientation()*initialDir_;              // according to beni....
     94                currentOrth_ = SpaceShip::instance_s->getOrientation()*initialOrth_;
     95        plane = Plane(currentDir_, shipPos_);
     96
     97        RadarObject* ro = firstRadarObject_;
    8498        // iterate through all RadarObjects
    8599                while(ro != NULL){
    86100                    // calc position on radar...
    87             float radius = calcRadius(shipPos_, currentDir_, currentOrth_, ro);
    88             float phi = calcPhi(shipPos_, currentDir_, currentOrth_, ro);
    89             bool right = calcRight(shipPos_, currentDir_, currentOrth_, ro);
     101            ro->radius_ = calcRadius(ro);
     102            ro->phi_ = calcPhi(ro);
     103            ro->right_ = calcRight(ro);
    90104
    91105            // set size to fit distance...
     
    96110            else ro->panel_->setDimensions(1,1);
    97111
    98             if (right){
    99                 ro->panel_->setPosition(sin(phi)*radius/
    100                     3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
     112            if (ro->right_){
     113                ro->panel_->setPosition(sin(ro->phi_)*ro->radius_/
     114                    3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
    101115            }
    102116            else {
    103                 ro->panel_->setPosition(-sin(phi)*radius/
    104                     3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
     117                ro->panel_->setPosition(-sin(ro->phi_)*ro->radius_/
     118                    3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
    105119            }
    106120            ro = ro->next;
    107121                }
    108     }
     122                updateNavMarker();
     123    }
     124
     125    void RadarOverlayElement::updateNavMarker(){
     126        if(focus_ == NULL) return;
     127        // from the angle we find out where to draw the marker
     128        // and which of the four arrows to take
     129        float r1 = atan((float)(windowW_)/(float)(windowH_));
     130        float phi = focus_->phi_;
     131        if(focus_->right_){
     132            if(phi<r1){
     133                navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, 0);
     134                navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
     135            }
     136            else if(phi>3.14-r1){
     137                navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, windowH_-16);
     138                navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
     139            }
     140            else {
     141                navMarker_->setPosition(windowW_-16, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
     142                navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
     143            }
     144        }
     145        else{
     146            if(phi<r1) {
     147                navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, 0);
     148                navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
     149            }
     150            else if(phi>3.14-r1) {
     151                navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, windowH_-16);
     152                navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
     153            }
     154            else {
     155                navMarker_->setPosition(0, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
     156                navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
     157            }
     158        }
     159    }
     160
     161    void RadarOverlayElement::addObject(Vector3 pos){
     162        if(firstRadarObject_ == NULL){
     163            firstRadarObject_ = new RadarObject(container_, pos);
     164            lastRadarObject_ = firstRadarObject_;
     165        }
     166        else{
     167            lastRadarObject_->next = new RadarObject(container_, pos);
     168            lastRadarObject_ = lastRadarObject_->next;
     169        }
     170        }
    109171
    110172        void RadarOverlayElement::listObjects(){
    111173            int i = 0;
    112             RadarObject* ro = HUD::getSingleton().getFirstRadarObject();
     174            RadarObject* ro = firstRadarObject_;
    113175            COUT(3) << "List of RadarObjects:\n";
    114176            // iterate through all Radar Objects
     
    119181        }
    120182
    121         float RadarOverlayElement::calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
    122             return(acos((dir.dotProduct(obj->pos_ - pos))/
    123                         ((obj->pos_ - pos).length()*dir.length())));
    124         }
    125 
    126         float RadarOverlayElement::calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
     183        float RadarOverlayElement::getDist2Focus(){
     184            if(focus_ == NULL) return(0.0);
     185            return((focus_->pos_-shipPos_).length());
     186        }
     187
     188        float RadarOverlayElement::calcRadius(RadarObject* obj){
     189            return(acos((currentDir_.dotProduct(obj->pos_ - shipPos_))/
     190                        ((obj->pos_ - shipPos_).length()*currentDir_.length())));
     191        }
     192
     193        float RadarOverlayElement::calcPhi(RadarObject* obj){
    127194            // project difference vector on our plane...
    128             Vector3 proj = Plane(dir, pos).projectVector(obj->pos_ - pos);
     195            Ogre::Vector3 proj = plane.projectVector(obj->pos_ - shipPos_);
    129196            // ...and find out the angle
    130             return(acos((orth.dotProduct(proj))/
    131             (orth.length()*proj.length())));
    132         }
    133 
    134         bool RadarOverlayElement::calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
    135             if((dir.crossProduct(orth)).dotProduct(obj->pos_ - pos) > 0)
     197            return(acos((currentOrth_.dotProduct(proj))/
     198            (currentOrth_.length()*proj.length())));
     199        }
     200
     201        bool RadarOverlayElement::calcRight(RadarObject* obj){
     202            if((currentDir_.crossProduct(currentOrth_)).dotProduct(obj->pos_ - shipPos_) > 0)
    136203                return true;
    137204        else return false;
    138205        }
     206
     207        /*static*/void RadarOverlayElement::cycleFocus(){
     208            if(RadarOverlayElement::instance_s == NULL) return;
     209
     210            if(RadarOverlayElement::instance_s->focus_ == NULL){
     211            RadarOverlayElement::instance_s->focus_ = RadarOverlayElement::instance_s->firstRadarObject_;
     212            }
     213        else{
     214            RadarOverlayElement::instance_s->focus_->panel_->setMaterialName("Orxonox/RedDot");
     215            RadarOverlayElement::instance_s->focus_ = RadarOverlayElement::instance_s->focus_->next;
     216        }
     217
     218        if(RadarOverlayElement::instance_s->focus_ == NULL){
     219            RadarOverlayElement::instance_s->navMarker_->hide();
     220        }
     221        else{
     222            RadarOverlayElement::instance_s->navMarker_->show();
     223            RadarOverlayElement::instance_s->focus_->panel_->setMaterialName("Orxonox/WhiteDot");
     224        }
     225        }
    139226}
     227
     228/* my local clipboard...
     229COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
     230COUT(3) << firstRadarObject_->radius_ << "  " << firstRadarObject_->phi_ << std::endl;
     231COUT(3) << "WWWWWWWWWWWWWWWWWWWWWWWWWWWW\n";
     232*/
  • code/trunk/src/orxonox/hud/RadarOverlayElement.h

    r1400 r1407  
    2929#define _RADAR_H__
    3030
     31#include <string.h>
     32#include <OgreOverlayManager.h>
     33#include <OgreStringConverter.h>
     34#include <OgreOverlayElement.h>
     35#include <OgrePanelOverlayElement.h>
     36#include <OgrePrerequisites.h>
     37
    3138#include <util/Math.h>
    32 #include <OgrePrerequisites.h>
     39#include <string.h>
     40#include "core/Tickable.h"
     41#include "core/ConsoleCommand.h"
     42#include "objects/SpaceShip.h"
    3343#include "../OrxonoxPrereqs.h"
    3444#include "RadarObject.h"
     45#include "GraphicsEngine.h"
    3546
    3647namespace orxonox
     
    4152            Ogre::OverlayManager* om;               // our one and only overlay manager
    4253            Ogre::OverlayContainer* container_;     // pointer to the container we're in
     54            Vector3 initialDir_;                        // direction of nose
    4355            Vector3 currentDir_;
     56            Vector3 initialOrth_;                   // direction of normal
    4457            Vector3 currentOrth_;
    4558            Vector3 shipPos_;                       // position of ship
     59            Ogre::Plane plane;                      // plane perpendicular to dir
    4660
    4761            Ogre::Real leftRel_, topRel_, dimRel_;  // relative position/dimension
     
    5569                        void resize();
    5670            void update();
     71            void updateNavMarker();
     72            void addObject(Vector3 pos);
    5773            void listObjects();
     74            float getDist2Focus();
     75            float calcRadius(RadarObject* obj);
     76            float calcPhi(RadarObject* obj);
     77            bool calcRight(RadarObject* obj);
    5878
    59             static float calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
    60             static float calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
    61             static bool calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
     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();
    6286        };
    6387}
  • code/trunk/src/orxonox/objects/Camera.h

    r1399 r1407  
    5050        void setTargetNode(Ogre::SceneNode* obj);
    5151
    52         Ogre::Camera* cam_;
    53 
    5452        void tick(float dt);
    5553        void update();
     
    6563        Ogre::SceneNode* cameraNode_;
    6664        Ogre::Vector3 oldPos;
     65        Ogre::Camera* cam_;
    6766        bool bHasFocus_;
    6867    };
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1401 r1407  
    6969      return NULL;
    7070    }
    71 
     71   
    7272    SpaceShip::SpaceShip() :
    7373      //testvector_(0,0,0),
     
    112112        this->setConfigValues();
    113113
    114         initialDir_ = Vector3(1.0, 0.0, 0.0);
    115         currentDir_ = initialDir_;
    116         initialOrth_ = Vector3(0.0, 0.0, 1.0);
    117         currentOrth_ = initialOrth_;
    118114
    119115        this->setRotationAxis(1, 0, 0);
     
    241237        CameraHandler::getInstance()->requestFocus(cam_);
    242238
    243     }
    244 
    245     Camera* SpaceShip::getCamera(){
    246         return cam_;
    247239    }
    248240
     
    399391    }
    400392
    401     Vector3 SpaceShip::getDir() {
    402         return currentDir_;
    403     }
    404 
    405     Vector3 SpaceShip::getOrth(){
    406         return currentOrth_;
     393    Vector3 SpaceShip::getSPosition() {
     394        return SpaceShip::getLocalShip()->getPosition();
     395    }
     396
     397    Quaternion SpaceShip::getSOrientation() {
     398        return SpaceShip::getLocalShip()->getOrientation();
    407399    }
    408400
     
    411403    void SpaceShip::tick(float dt)
    412404    {
    413         currentDir_ = getOrientation()*initialDir_;
    414                 currentOrth_ = getOrientation()*initialOrth_;
    415 
    416405        if (this->cam_)
    417406            this->cam_->tick(dt);
     
    433422        if (this->bLMousePressed_ && this->timeToReload_ <= 0)
    434423        {
    435 
     424         
    436425            Projectile *p = new Projectile(this);
    437 
     426           
    438427            p->setBacksync(true);
    439428            this->timeToReload_ = this->reloadTime_;
  • code/trunk/src/orxonox/objects/SpaceShip.h

    r1400 r1407  
    4444    {
    4545        public:
    46 
     46         
    4747            static SpaceShip *getLocalShip();
    48 
     48           
    4949            SpaceShip();
    5050            ~SpaceShip();
     
    6464            void setTransDamp(float value);
    6565            void setRotDamp(float value);
     66
    6667            void getFocus();
    67 
    6868            static SpaceShip* instance_s;
     69            static Vector3 getSPosition();
     70            static Quaternion getSOrientation();
    6971            static std::string whereAmI();
    7072            static void setMaxSpeedTest(float value)
     
    7880
    7981            float getMaxSpeed();
    80             Vector3 getDir();
    81             Vector3 getOrth();
    82             Camera* getCamera();
    8382
    8483        private:
     
    8685
    8786            Vector3 testvector_;
    88             Vector3 initialDir_;
    89             Vector3 currentDir_;
    90             Vector3 initialOrth_;
    91             Vector3 currentOrth_;
    9287            bool bInvertYAxis_;
    9388            bool setMouseEventCallback_;
Note: See TracChangeset for help on using the changeset viewer.