Changeset 6293 for code/branches
- Timestamp:
- Dec 9, 2009, 4:32:41 PM (15 years ago)
- Location:
- code/branches/presentation2/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc
r6273 r6293 30 30 31 31 #include <string> 32 #include <OgreCamera.h> 32 33 #include <OgreOverlayManager.h> 33 34 #include <OgreTextAreaOverlayElement.h> … … 39 40 #include "core/CoreIncludes.h" 40 41 #include "core/XMLPort.h" 42 #include "CameraManager.h" 41 43 #include "Scene.h" 42 44 #include "Radar.h" 45 #include "graphics/Camera.h" 43 46 #include "controllers/HumanController.h" 44 47 #include "worldentities/pawns/Pawn.h" … … 62 65 navMarker_->setMaterialName("Orxonox/NavArrows"); 63 66 67 /* 64 68 // create aim marker 65 69 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() … … 72 76 setNavMarkerSize(0.05f); 73 77 setAimMarkerSize(0.04f); 78 */ 74 79 75 80 background_->addChild(navMarker_); 76 background_->addChild(aimMarker_);81 // background_->addChild(aimMarker_); 77 82 background_->addChild(navText_); 78 83 … … 87 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_); 88 93 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_); 89 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);94 // Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_); 90 95 } 91 96 } … … 98 103 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode); 99 104 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode); 100 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);105 // XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode); 101 106 } 102 107 … … 151 156 float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3; 152 157 153 /* 154 Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_;155 Matrix4 transformationMatrix = navCam->getProjectionMatrix() * navCam->getViewMatrix();156 */ 158 orxonox::Camera* cam = CameraManager::getInstance().getActiveCamera(); 159 if (!cam) 160 return; 161 const Matrix4& transform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 157 162 // transform to screen coordinates 158 Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();163 Vector3 pos = transform * radar->getFocus()->getRVWorldPosition(); 159 164 160 165 bool outOfView; … … 174 179 { 175 180 // object is not in view 176 aimMarker_->hide();181 // aimMarker_->hide(); 177 182 178 183 if (!wasOutOfView_) … … 229 234 // object is in view 230 235 /* 231 Vector3 aimpos = transform ationMatrix* getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),236 Vector3 aimpos = transform * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(), 232 237 Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity()); 233 238 */ … … 243 248 navMarker_->setTop((-pos.y + 1.0 - navMarker_->getHeight()) * 0.5); 244 249 250 /* 245 251 aimMarker_->show(); 246 /*247 252 aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5); 248 253 aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5); … … 273 278 if (this->navMarker_) 274 279 navMarker_->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale); 280 /* 275 281 if (this->aimMarker_) 276 282 aimMarker_->setDimensions(aimMarkerSize_ * xScale, aimMarkerSize_ * yScale); 283 */ 277 284 if (this->navText_) 278 285 navText_->setCharHeight(navText_->getCharHeight() * yScale); -
code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.h
r5781 r6293 56 56 float getNavMarkerSize() const { return this->navMarkerSize_; } 57 57 58 /* 58 59 void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); } 59 60 float getAimMarkerSize() const { return this->aimMarkerSize_; } 61 */ 60 62 61 63 void setTextSize(float size); … … 71 73 Ogre::PanelOverlayElement* navMarker_; //!< the panel used to show the arrow and the target marker 72 74 float navMarkerSize_; //!< One paramter size of the navigation marker 75 /* 73 76 Ogre::PanelOverlayElement* aimMarker_; //!< Panel used to show the aim Marker 74 77 float aimMarkerSize_; //!< One paramter size of the aim marker 78 */ 75 79 Ogre::TextAreaOverlayElement* navText_; //!< Text overlay to display the target distance 76 80 bool wasOutOfView_; //!< Performance booster variable: setMaterial is not cheap -
code/branches/presentation2/src/orxonox/interfaces/RadarViewable.cc
r6272 r6293 163 163 if (!object) 164 164 { 165 COUT(1) << "Assert ation: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl;165 COUT(1) << "Assertion: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl; 166 166 assert(0); 167 167 }
Note: See TracChangeset
for help on using the changeset viewer.