Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1295


Ignore:
Timestamp:
May 15, 2008, 7:59:37 PM (16 years ago)
Author:
FelixSchulthess
Message:

trying to make it tickable

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

Legend:

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

    r1292 r1295  
    3939#include <OgreOverlayElement.h>
    4040#include <OgrePanelOverlayElement.h>
    41 
    4241#include <OgreStringConverter.h>
    43 #include <math.h>
    44 #include <string.h>
    45 
    4642#include "RadarOverlayElement.h"
    4743
     
    5147  using namespace Ogre;
    5248
    53   RadarOverlayElement::RadarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){}
     49  RadarOverlayElement::RadarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){
     50    initialDir = Vector3(0.0, 0.0, 1.0);
     51  }
    5452
    5553  RadarOverlayElement::~RadarOverlayElement(){}
     
    6159  void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container){
    6260
    63 
     61    dirX_ = 0;  // direction of travel
     62    dirY_ = 0;
     63    dirZ_ = 1;
    6464   
    65     dirX_ = 1;
    66     dirY_ = 0;
    67     dirZ_ = 0;
     65    ortX_ = 0;  // normal of ship
     66    ortY_ = 1;
     67    ortZ_ = 0;
    6868   
    69     ortX_ = 0;
    70     ortY_ = 0;
    71     ortZ_ = 1;
    72    
    73     dX_ = 0;
     69    dX_ = 37;
    7470    dY_ = 0;
    75     dZ_ = -1;
     71    dZ_ = 0;
    7672   
    7773    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))));
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc~

    r1292 r1295  
    2626*/
    2727
     28/*      local coordinate system of space ship:
     29
     30                        y
     31                        +   z
     32                        |  +
     33                        | /
     34                        |/
     35               x +------O
     36*/
     37
    2838#include <OgreOverlayManager.h>
    2939#include <OgreOverlayElement.h>
    3040#include <OgrePanelOverlayElement.h>
    31 
    3241#include <OgreStringConverter.h>
    33 #include <math.h>
    34 #include <string.h>
    35 
    3642#include "RadarOverlayElement.h"
    3743
     
    4147  using namespace Ogre;
    4248
    43   RadarOverlayElement::RadarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){}
     49  RadarOverlayElement::RadarOverlayElement(const String& name):Ogre::PanelOverlayElement(name){
     50    initialDir = Vector3(0.0, 0.0, 1.0);
     51  }
    4452
    4553  RadarOverlayElement::~RadarOverlayElement(){}
     
    5159  void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container){
    5260
    53 
     61    dirX_ = 0;  // direction of travel
     62    dirY_ = 0;
     63    dirZ_ = 1;
    5464   
    55     dirX_ = 1;
    56     dirY_ = 0;
    57     dirZ_ = 0;
     65    ortX_ = 0;  // normal of ship
     66    ortY_ = 1;
     67    ortZ_ = 0;
    5868   
    59     ortX_ = 0;
    60     ortY_ = 0;
    61     ortZ_ = 1;
    62    
    63     dX_ = 0;
     69    dX_ = 37;
    6470    dY_ = 0;
    65     dZ_ = -1;
     71    dZ_ = 0;
    6672   
    6773    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))));
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h

    r1292 r1295  
    3232#include <OgreOverlayElement.h>
    3333#include <OgrePanelOverlayElement.h>
    34 
     34#include <math.h>
     35#include <util/Math.h>
     36#include <string.h>
     37#include "core/Tickable.h"
    3538#include <OgrePrerequisites.h>
    3639#include "../OrxonoxPrereqs.h"
     
    3942{
    4043
    41   class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement
     44  class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement, public Tickable
    4245  {
    4346  private:
     
    4548    PanelOverlayElement* point[100];
    4649   
    47     int dirX_, dirY_, dirZ_;      //flying direction
    48     int ortX_, ortY_, ortZ_;      //orthogonal direction
    49     int dX_, dY_, dZ_;            //distance between main ship and the object
    50     int vecX_, vecY_, vecZ_;      //vector product dir X ort
     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
    5155    double alpha_;              //defines the radius in the radar
    5256    double beta_;               //defines the angle in the radar
    5357    bool right_;                //checks whether the object is on the right side (since cos is not bijective)
    5458   
    55     //static int ID = 0;
     59//    static int ID = 0;
    5660
    5761  public:
     
    6367    void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container);
    6468    void setMainShipPosition(int dirX, int dirY, int dirZ, int ortX, int ortY, int ortZ);
    65    
     69    void tick(float dt);
    6670    int newShip(int X, int Y, int Z);
    6771   
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h~

    r1292 r1295  
    2626*/
    2727
    28 /*      local coordinate system of space ship:
    29 
    30                         y
    31                         +   z
    32                         |  +
    33                         | /
    34                         |/
    35                x +------O
    36 */
    37 
    3828#ifndef _RADAR_H__
    3929#define _RADAR_H__
     
    4232#include <OgreOverlayElement.h>
    4333#include <OgrePanelOverlayElement.h>
    44 
     34#include <math.h>
     35#include <util/Math.h>
     36#include <string.h>
     37#include <Tickable.h>
    4538#include <OgrePrerequisites.h>
    4639#include "../OrxonoxPrereqs.h"
     
    4942{
    5043
    51   class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement
     44  class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement, public Tickable
    5245  {
    5346  private:
     
    5548    PanelOverlayElement* point[100];
    5649   
    57     int dirX_, dirY_, dirZ_;      //flying direction
    58     int ortX_, ortY_, ortZ_;      //orthogonal direction
    59     int dX_, dY_, dZ_;            //distance between main ship and the object
    60     int vecX_, vecY_, vecZ_;      //vector product dir X ort
     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
    6155    double alpha_;              //defines the radius in the radar
    6256    double beta_;               //defines the angle in the radar
    6357    bool right_;                //checks whether the object is on the right side (since cos is not bijective)
    6458   
    65     //static int ID = 0;
     59//    static int ID = 0;
    6660
    6761  public:
     
    7367    void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container);
    7468    void setMainShipPosition(int dirX, int dirY, int dirZ, int ortX, int ortY, int ortZ);
    75    
     69    void tick(float dt);
    7670    int newShip(int X, int Y, int Z);
    7771   
  • code/branches/hud3/src/orxonox/objects/SpaceShip.cc

    r1292 r1295  
    437437    }
    438438
     439    Vector3 SpaceShip::getSPosition() {
     440        return SpaceShip::instance_s->getPosition();
     441    }
     442
     443    Quaternion SpaceShip::getSOrientation() {
     444        return SpaceShip::instance_s->getOrientation();
     445    }
     446
    439447    void SpaceShip::tick(float dt)
    440448    {
  • code/branches/hud3/src/orxonox/objects/SpaceShip.h

    r1292 r1295  
    3333#include <OgrePrerequisites.h>
    3434
     35#include "util/Math.h"
    3536#include "core/InputInterfaces.h"
    3637#include "Camera.h"
     
    6465            void getFocus();
    6566
     67            static Vector3 getSPosition();
     68            static Quaternion getSOrientation();
    6669            static std::string whereAmI();
    6770            static void setMaxSpeedTest(float value)
Note: See TracChangeset for help on using the changeset viewer.