- Timestamp:
- May 21, 2008, 8:20:58 PM (17 years ago)
- Location:
- code/branches/hud3/src/orxonox
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/CMakeLists.txt
r1332 r1346 8 8 hud/BarOverlayElement.cc 9 9 hud/RadarOverlayElement.cc 10 hud/RadarObject.cc 10 11 particle/ParticleInterface.cc 11 12 tolua/tolua_bind.cc -
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc
r1343 r1346 26 26 */ 27 27 28 /* local coordinate system of space ship at the beginning:29 30 y31 + z32 | +33 | /34 |/35 x +------O36 */37 38 #include <OgreOverlayManager.h>39 #include <OgreOverlayElement.h>40 #include <OgrePanelOverlayElement.h>41 #include <OgreStringConverter.h>42 28 #include "RadarOverlayElement.h" 43 #include "GraphicsEngine.h"44 29 45 30 namespace orxonox … … 98 83 // iterate through all RadarObjects 99 84 while(ro != NULL){ 85 // calc position on radar... 100 86 ro->radius_ = calcRadius(ro); 101 87 ro->phi_ = calcPhi(ro); 102 88 ro->right_ = calcRight(ro); 89 90 // set size to fit distance... 91 float d = (ro->pos_-shipPos_).length(); 92 if(d<4000) ro->panel_->setDimensions(4,4); 93 else if(d<8000) ro->panel_->setDimensions(3,3); 94 else if(d<12000) ro->panel_->setDimensions(2,2); 95 else ro->panel_->setDimensions(1,1); 96 103 97 if (ro->right_){ 104 98 ro->panel_->setPosition(sin(ro->phi_)*ro->radius_/ … … 115 109 void RadarOverlayElement::addObject(Vector3 pos){ 116 110 if(firstRadarObject_ == NULL){ 117 firstRadarObject_ = new RadarObject(container_); 118 firstRadarObject_->pos_ = pos; 111 firstRadarObject_ = new RadarObject(container_, pos); 119 112 lastRadarObject_ = firstRadarObject_; 120 113 } 121 114 else{ 122 lastRadarObject_->next = new RadarObject(container_); 123 lastRadarObject_->next->pos_ = pos; 115 lastRadarObject_->next = new RadarObject(container_, pos); 124 116 lastRadarObject_ = lastRadarObject_->next; 125 117 } … … 155 147 else return false; 156 148 } 157 158 //////// RadarObject ////////159 160 int RadarObject::count = 0; // initialize static variable161 162 RadarObject::RadarObject(Ogre::OverlayContainer* container){163 container_ = container;164 pos_ = Vector3(0.0, 0.0, 0.0);165 init();166 }167 168 RadarObject::RadarObject(Ogre::OverlayContainer* container, Vector3 pos){169 container_ = container;170 pos_ = pos;171 init();172 }173 174 RadarObject::~RadarObject(){}175 176 void RadarObject::init(){177 next = NULL;178 om = &Ogre::OverlayManager::getSingleton();179 panel_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel",180 "Object"+Ogre::StringConverter::toString(count++)));181 panel_->setMaterialName("Orxonox/RedDot");182 panel_->setDimensions(5,5);183 panel_->setMetricsMode(Ogre::GMM_PIXELS);184 panel_->show();185 container_->addChild(panel_);186 }187 149 } 188 150 -
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h
r1343 r1346 30 30 31 31 #include <string.h> 32 #include <OgreOverlayManager.h> 33 #include <OgreStringConverter.h> 32 34 #include <OgreOverlayElement.h> 33 35 #include <OgrePanelOverlayElement.h> 36 #include <OgrePrerequisites.h> 37 34 38 #include <util/Math.h> 35 39 #include <string.h> 36 40 #include "core/Tickable.h" 37 #include <OgrePrerequisites.h>38 41 #include "objects/SpaceShip.h" 39 42 #include "../OrxonoxPrereqs.h" 43 #include "RadarObject.h" 44 #include "GraphicsEngine.h" 40 45 41 46 namespace orxonox 42 47 { 43 class _OrxonoxExport RadarObject44 {45 private:46 Ogre::OverlayManager* om; // our one and only overlay manager47 void init();48 49 public:50 RadarObject(Ogre::OverlayContainer* container);51 RadarObject(Ogre::OverlayContainer* container, Vector3 pos);52 ~RadarObject();53 54 bool right_;55 Vector3 pos_; // position in space56 Ogre::Real radius_, phi_; // position on radar57 Ogre::OverlayContainer* container_;58 Ogre::PanelOverlayElement* panel_; // the panel used to show the dot59 RadarObject* next; // next pointer of linked list60 61 static int count;62 };63 64 48 class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement 65 49 {
Note: See TracChangeset
for help on using the changeset viewer.