Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1254


Ignore:
Timestamp:
May 11, 2008, 2:34:01 PM (16 years ago)
Author:
FelixSchulthess
Message:

chais new hud

Location:
code/branches/hud2/src/orxonox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud2/src/orxonox/CMakeLists.txt

    r1099 r1254  
    66  hud/HUD.cc
    77  hud/BarOverlayElement.cc
     8  hud/RadarOverlayElement.cc
    89  particle/ParticleInterface.cc
    910  tools/BillboardSet.cc
  • code/branches/hud2/src/orxonox/OrxonoxPlatform.h

    r975 r1254  
    175175//For apple, we always have a custom config.h file
    176176#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    177 #  include "config.h"
     177//#  include "config.h"
    178178#endif
    179179
  • code/branches/hud2/src/orxonox/hud/BarOverlayElement.h

    r1099 r1254  
    4444  {
    4545  private:
     46   
    4647    int percentage_;
    4748    int dir_;   
     
    5051    int width_;
    5152    int height_;
    52        
     53
    5354    static Ogre::String& typeName_s;
    54        
     55
    5556  public:
    5657
     
    7576
    7677  };
    77  
     78
    7879 
    7980  class _OrxonoxExport SmartBarOverlayElement : public BarOverlayElement
     
    8990      void initSmartBarOverlayElement(Ogre::Real left, Ogre::Real top, Ogre::Real width, Ogre::Real height, int dir);
    9091      void reset(int percentage);
     92     
    9193  };
    92 
    93  
    9494}
    9595
  • code/branches/hud2/src/orxonox/hud/HUD.cc

    r1099 r1254  
    3333#include <OgreSceneNode.h>
    3434#include <OgreEntity.h>
     35#include "core/Debug.h"
    3536
    3637#include "HUD.h"
    3738#include "BarOverlayElement.h"
     39#include "RadarOverlayElement.h"
    3840#include "OverlayElementFactories.h"
    3941// ugly hack
     
    5557    overlayManager.addOverlayElementFactory(smartBarOverlayElementFactory);
    5658   
     59    RadarOverlayElementFactory *radarOverlayElementFactory = new RadarOverlayElementFactory();
     60    overlayManager.addOverlayElementFactory(radarOverlayElementFactory);
     61   
    5762    Ogre::Overlay* orxonoxOverlay = overlayManager.create("Orxonox/HUD");
    5863
     
    6267    energyCounter->show();
    6368   
     69   
     70    radar = static_cast<RadarOverlayElement*>(overlayManager.createOverlayElement("Radar", "radar"));
     71    radar->show();
     72
     73   
     74/*    TextAreaOverlayElement* test = static_cast<TextAreaOverlayElement*>(overlayManager.createOverlayElement("TextArea", "test"));
     75   
     76    int dirX, dirY, dirZ;      //flying direction
     77    int ortX, ortY, ortZ;      //orthogonal direction
     78    int dX, dY, dZ;            //distance between main ship and the object
     79    int vecX, vecY, vecZ;      //vector product dir X ort
     80    double alpha;              //defines the radius in the radar
     81    double beta;               //defines the angle in the radar
     82    bool right;                //checks whether the object is on the right side (since cos is not bijective)
     83   
     84    dirX = 1;
     85    dirY = 0;
     86    dirZ = 0;
     87   
     88    ortX = 0;
     89    ortY = 0;
     90    ortZ = 1;
     91   
     92    dX = -2;
     93    dY = 2;
     94    dZ = 0;
     95   
     96    alpha = acos((dirX*dX+dirY*dY+dirZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(dirX,2)+pow(dirY,2)+pow(dirZ,2))));
     97    beta = acos((ortX*dX+ortY*dY+ortZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(ortX,2)+pow(ortY,2)+pow(ortZ,2))));
     98    vecX = dirY*ortZ - dirZ*ortY;
     99    vecY = dirZ*ortX - dirX*ortZ;
     100    vecZ = dirX*ortY - dirY*ortX;
     101   
     102    if((vecX*dX+vecY*dY+vecZ*dZ)>0){right=true;}
     103    else right=false;
     104   
     105    test->setCaption("hell");
     106    test->setPosition(10,10);
     107    test->setDimensions(20,20);
     108    test->show();
     109    test->setMetricsMode(Ogre::GMM_PIXELS);     
     110    energyCounterPanel->addChild(test);
     111   
     112    COUT(0)<<alpha<<" "<<beta<<" "<<right<<std::endl;
     113*/
     114   
    64115    energyCounterPanel->addChild(energyCounter);
     116    energyCounterPanel->addChild(radar);
    65117    energyCounterPanel->show();
    66 
     118   
    67119    orxonoxOverlay->add2D(energyCounterPanel);
    68120    orxonoxOverlay->show();
    69121
     122   
     123   
    70124    // important: don't use SceneManager to create the node! but register the creator scene manager.
    71125/*    ogreNode_ = new Ogre::SceneNode(Orxonox::getSingleton()->getSceneManager(), "hudNoedely");
     
    88142    energyCounter->initSmartBarOverlayElement(-100,0,200,20,BarOverlayElement::LEFT);
    89143    energyCounter->reset(80);
     144   
     145    radar->initRadarOverlayElement(10,10,200,energyCounterPanel);
    90146
    91147   
  • code/branches/hud2/src/orxonox/hud/HUD.h

    r1099 r1254  
    3939#include "core/Tickable.h"
    4040#include "BarOverlayElement.h"
     41#include "RadarOverlayElement.h"
    4142
    4243
     
    5455
    5556    SmartBarOverlayElement* energyCounter;
     57   
     58    RadarOverlayElement* radar;
    5659//    Ogre::SceneNode* ogreNode_;
    5760  };
    5861}       
    5962
    60 
    6163#endif
  • code/branches/hud2/src/orxonox/hud/OverlayElementFactories.h

    r1099 r1254  
    4040
    4141  class _OrxonoxExport BarOverlayElementFactory : public Ogre::OverlayElementFactory{
    42   public:
     42    public:
    4343    Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
    4444      return new BarOverlayElement(instanceName);
     
    5353  class _OrxonoxExport SmartBarOverlayElementFactory : public Ogre::OverlayElementFactory{
    5454    public:
     55    Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
     56      return new SmartBarOverlayElement(instanceName);
     57    }
     58    const Ogre::String& getTypeName(void) const{
     59      static Ogre::String name = "SmartBar";
     60      return name;
     61    }
     62  };
     63
     64  class _OrxonoxExport RadarOverlayElementFactory : public Ogre::OverlayElementFactory{
     65    public:
    5566      Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
    56         return new SmartBarOverlayElement(instanceName);
     67        return new RadarOverlayElement(instanceName);
    5768      }
    5869      const Ogre::String& getTypeName(void) const{
    59         static Ogre::String name = "SmartBar";
     70        static Ogre::String name = "Radar";
    6071        return name;
    6172      }
    6273  };
    63 
    6474}
    6575
  • code/branches/hud2/src/orxonox/hud/RadarOverlayElement.cc

    r1221 r1254  
    2828#include <OgreOverlayManager.h>
    2929#include <OgreOverlayElement.h>
     30#include <OgrePanelOverlayElement.h>
     31
    3032#include <OgreStringConverter.h>
    3133#include <math.h>
     
    4749  }
    4850 
    49   void RadarOverlayElement::initRadarOverlayElement(){
     51  void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container){
     52   
    5053    int dirX, dirY, dirZ;      //flying direction
    5154    int ortX, ortY, ortZ;      //orthogonal direction
     
    6871    dZ = 0;
    6972   
    70     alpha = acos(((double)(dirX*dX+dirY*dY+dirZ*dZ))/(sqrt((double)(pow(dX,2)+pow(dY,2)+pow(dZ,2)))+sqrt((double)(pow(dirX,2)+pow(dirY,2)+pow(dirZ,2)))));
    71     beta = acos(((double)(ortX*dX+ortY*dY+ortZ*dZ))/(sqrt((double)(pow(dX,2)+pow(dY,2)+pow(dZ,2)))+sqrt((double)(pow(ortX,2)+pow(ortY,2)+pow(ortZ,2)))));
     73    alpha = acos((dirX*dX+dirY*dY+dirZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(dirX,2)+pow(dirY,2)+pow(dirZ,2))));
     74    beta = acos((ortX*dX+ortY*dY+ortZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(ortX,2)+pow(ortY,2)+pow(ortZ,2))));
    7275    vecX = dirY*ortZ - dirZ*ortY;
    7376    vecY = dirZ*ortX - dirX*ortZ;
     
    7679    if((vecX*dX+vecY*dY+vecZ*dZ)>0){right=true;}
    7780    else right=false;
     81   
     82    setMetricsMode(Ogre::GMM_PIXELS);
     83    setPosition(left,top);
     84    setDimensions(dim,dim);
     85    setMaterialName("Orxonox/MapBackGround");
     86   
     87    Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
    7888
     89    PanelOverlayElement* point = static_cast<PanelOverlayElement*>(overlayManager.createOverlayElement("Panel", "point"));
     90    point->show();
     91   
     92    container->addChild(point);
     93   
     94    if (right){
     95      point->setPosition(sin(beta)*alpha/3.14*dim/2+dim/2,-cos(beta)*alpha/3.14*dim/2+dim/2);
     96      point->setMaterialName("Orxonox/Red");
     97      point->setDimensions(5,5);
     98      point->setMetricsMode(Ogre::GMM_PIXELS);
     99    }
     100 
     101    else {
     102      point->setPosition(-sin(beta)*alpha/3.14*dim/2+dim/2,-cos(beta)*alpha/3.14*dim/2+dim/2);
     103      point->setMaterialName("Orxonox/Red");
     104      point->setDimensions(5,5);
     105      point->setMetricsMode(Ogre::GMM_PIXELS);
     106    }
    79107
     108   
     109
     110   
     111  } 
    80112}
    81113
    82114
     115
  • code/branches/hud2/src/orxonox/hud/RadarOverlayElement.h

    r1218 r1254  
    3232#include <string.h>
    3333#include <OgreOverlayElement.h>
     34#include <OgrePanelOverlayElement.h>
     35
    3436#include <OgrePrerequisites.h>
    3537#include "../OrxonoxPrereqs.h"
     
    5052    virtual void initialise();
    5153
    52 
     54    void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container);
    5355  };
    5456}       
Note: See TracChangeset for help on using the changeset viewer.