Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1310


Ignore:
Timestamp:
May 16, 2008, 5:57:05 PM (17 years ago)
Author:
FelixSchulthess
Message:

repositioned hud layout

Location:
code/branches/hud3/src/orxonox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud3/src/orxonox/hud/HUD.cc

    r1302 r1310  
    6565
    6666    energyCounter = static_cast<SmartBarOverlayElement*>(overlayManager.createOverlayElement("SmartBar", "energyCounter"));
    67     energyCounter->show();
     67    //energyCounter->show();
    6868
    6969
     
    133133*/
    134134
    135     energyCounterPanel->setLeft(-50);
    136     energyCounterPanel->setTop(10);
    137     energyCounterPanel->setWidth(100);
    138     energyCounterPanel->setHeight(20);
    139     energyCounterPanel->setHorizontalAlignment(Ogre::GHA_CENTER);
    140     energyCounterPanel->setMetricsMode(Ogre::GMM_PIXELS);
     135    energyCounterPanel->setLeft(0.0);
     136    energyCounterPanel->setTop(0.0);
     137    energyCounterPanel->setWidth(1.0);
     138    energyCounterPanel->setHeight(1.0);
     139    energyCounterPanel->setMetricsMode(Ogre::GMM_RELATIVE);
    141140
    142     energyCounter->initSmartBarOverlayElement(-100,0,200,20,BarOverlayElement::LEFT);
     141    energyCounter->initSmartBarOverlayElement(10,10,200,20,BarOverlayElement::LEFT);
    143142    energyCounter->reset(80);
    144143
    145     radar->initRadarOverlayElement(10,10,200,energyCounterPanel);
     144    radar->initRadarOverlayElement(0.5, 0.8, 0.2, energyCounterPanel);
    146145
    147146
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc

    r1308 r1310  
    4141#include <OgreStringConverter.h>
    4242#include "RadarOverlayElement.h"
     43#include "GraphicsEngine.h"
    4344
    4445namespace orxonox
     
    5657    }
    5758
    58     void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container){
    59         dim_ = dim;
    60         left_ = left;
    61         top_ = top;
    62         count_ = 100;
     59    void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, Real dim, Ogre::OverlayContainer* container){
     60
     61        windowW = GraphicsEngine::getSingleton().getWindowWidth();
     62        windowH = GraphicsEngine::getSingleton().getWindowHeight();
     63        dim_ = dim*windowH;                         //conver relative data to absolute
     64        left_ = left*windowW-dim_/2;                // ...
     65        top_ = top*windowH-dim_/2;                  // ...
     66        count_ = 0;
    6367        container_ = container;
    6468
     
    6973        initialOrth_ = Vector3(0.0, 0.0, 1.0);
    7074        currentOrth_ = initialOrth_;
    71      
     75
    7276        setMetricsMode(Ogre::GMM_PIXELS);
    73         setPosition(left,top);
     77        setMaterialName("Orxonox/Radar");
     78        setPosition(left_, top_);
    7479        setDimensions(dim_,dim_);
    75         setMaterialName("Orxonox/Radar");
    7680
    7781        om = &Ogre::OverlayManager::getSingleton();
     
    9599
    96100    void RadarOverlayElement::update() {
    97         if(count_++ >= 100) {           // for testing purposes
    98                         count_ = 0;
    99                         COUT(3) << "pos:  " << shipPos_ << std::endl;
    100                         COUT(3) << "dir:  " << currentDir_ << std::endl;
    101                         COUT(3) << "orth: " << currentOrth_ << std::endl << std::endl;         
    102         }
    103101        shipPos_ = SpaceShip::instance_s->getPosition();
    104102        currentDir_ = SpaceShip::instance_s->getOrientation()*initialDir_;              // according to beni....
    105103                currentOrth_ = SpaceShip::instance_s->getOrientation()*initialOrth_;
    106                
     104
    107105                radius_ = acos((currentDir_.dotProduct(targetPos_ - shipPos_))/((targetPos_ - shipPos_).length()*currentDir_.length()));
    108106        phi_ = acos((currentOrth_.dotProduct(targetPos_ - shipPos_))/((targetPos_ - shipPos_).length()*currentOrth_.length()));
    109         vec_ = currentDir_.crossProduct(currentOrth_);
    110         if(vec_.dotProduct(targetPos_ - shipPos_) > 0) right_ = true;
     107        if((currentDir_.crossProduct(currentOrth_)).dotProduct(targetPos_ - shipPos_) > 0) right_ = true;
    111108        else right_=false;
    112        
     109
    113110        if (right_){
    114             point->setPosition(sin(phi_)*radius_/3.5*dim_/2+dim_/2+left_-2,-cos(phi_)*radius_/3.5*dim_/2+dim_/2+top_-2);         
     111            point->setPosition(sin(phi_)*radius_/3.5*dim_/2+dim_/2+left_-2,-cos(phi_)*radius_/3.5*dim_/2+dim_/2+top_-2);
    115112        }
    116113        else {
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h

    r1308 r1310  
    4949    Ogre::OverlayContainer* container_;
    5050    Ogre::OverlayManager* om;       //pointer to the one and only overlay manager
    51     Vector3 initialDir_;                //initial direction of ship
    52     Vector3 currentDir_;            //current direction of ship
    53     Vector3 initialOrth_;
     51    Vector3 initialDir_;                // direction of nose
     52    Vector3 currentDir_;
     53    Vector3 initialOrth_;           // direction of normal
    5454    Vector3 currentOrth_;
    5555    Vector3 targetPos_;             //position of target
    5656    Vector3 shipPos_;               //position of ship
    57     Vector3 vec_;                   //vector product dir X ort
    58     double radius_;                  //defines the radius in the radar
    59     double phi_;                   //defines the angle in the radar
    60     float left_, top_;
     57
     58    double radius_;                 //defines the radius on the radar
     59    double phi_;                    //defines the angle on the radar
     60    float left_, top_, dim_;
    6161    bool right_;                    //checks whether the object is on the right side (since cos is not bijective)
    6262    int count_;
    63     int dim_;
     63    int windowW, windowH;
    6464
    6565  public:
     
    6969    virtual void initialise();
    7070    void update();
    71     void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container);
     71    void initRadarOverlayElement(Real left, Real top, Real dim, Ogre::OverlayContainer* container);
    7272    void setMainShipPosition(int dirX, int dirY, int dirZ, int ortX, int ortY, int ortZ);
    7373    int newShip(int X, int Y, int Z);
  • code/branches/hud3/src/orxonox/objects/SpaceShip.cc

    r1308 r1310  
    270270      camName_=camera;
    271271      // change camera attributes here, if you want to ;)
    272     }
    273    
     272      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
     273      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
     274      //camNode_->setOrientation(q1*q2);
     275    }
     276
    274277    void SpaceShip::getFocus(){
    275278      COUT(4) << "requesting focus" << std::endl;
    276279      if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID)
    277280        CameraHandler::getInstance()->requestFocus(cam_);
    278      
    279     }
    280    
     281
     282    }
     283
    281284    void SpaceShip::createCamera(){
    282285//       COUT(4) << "begin camera creation" << std::endl;
  • code/branches/hud3/src/orxonox/objects/SpaceShip.h

    r1302 r1310  
    8888
    8989            Ogre::SceneNode* camNode_;
    90             Camera* cam_; 
     90            Camera* cam_;
    9191            std::string camName_;
    9292
Note: See TracChangeset for help on using the changeset viewer.