Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6293 for code/branches


Ignore:
Timestamp:
Dec 9, 2009, 4:32:41 PM (15 years ago)
Author:
rgrieder
Message:

Fixed HUDNavigation: Aim position is not available anymore (projectile speed unknown) but the rest works again.

Location:
code/branches/presentation2/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.cc

    r6273 r6293  
    3030
    3131#include <string>
     32#include <OgreCamera.h>
    3233#include <OgreOverlayManager.h>
    3334#include <OgreTextAreaOverlayElement.h>
     
    3940#include "core/CoreIncludes.h"
    4041#include "core/XMLPort.h"
     42#include "CameraManager.h"
    4143#include "Scene.h"
    4244#include "Radar.h"
     45#include "graphics/Camera.h"
    4346#include "controllers/HumanController.h"
    4447#include "worldentities/pawns/Pawn.h"
     
    6265        navMarker_->setMaterialName("Orxonox/NavArrows");
    6366
     67/*
    6468        // create aim marker
    6569        aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
     
    7276        setNavMarkerSize(0.05f);
    7377        setAimMarkerSize(0.04f);
     78*/
    7479
    7580        background_->addChild(navMarker_);
    76         background_->addChild(aimMarker_);
     81//        background_->addChild(aimMarker_);
    7782        background_->addChild(navText_);
    7883
     
    8792            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_);
    8893            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_);
    89             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
     94//            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
    9095        }
    9196    }
     
    98103        XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode);
    99104        XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode);
    100         XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);
     105//        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);
    101106    }
    102107
     
    151156        float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3;
    152157
    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();
    157162        // transform to screen coordinates
    158         Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();
     163        Vector3 pos = transform * radar->getFocus()->getRVWorldPosition();
    159164
    160165        bool outOfView;
     
    174179        {
    175180            // object is not in view
    176             aimMarker_->hide();
     181//            aimMarker_->hide();
    177182
    178183            if (!wasOutOfView_)
     
    229234            // object is in view
    230235/*
    231             Vector3 aimpos = transformationMatrix * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
     236            Vector3 aimpos = transform * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),
    232237                    Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity());
    233238*/
     
    243248            navMarker_->setTop((-pos.y + 1.0 - navMarker_->getHeight()) * 0.5);
    244249
     250/*
    245251            aimMarker_->show();
    246 /*
    247252            aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5);
    248253            aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5);
     
    273278        if (this->navMarker_)
    274279            navMarker_->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale);
     280/*
    275281        if (this->aimMarker_)
    276282            aimMarker_->setDimensions(aimMarkerSize_ * xScale, aimMarkerSize_ * yScale);
     283*/
    277284        if (this->navText_)
    278285            navText_->setCharHeight(navText_->getCharHeight() * yScale);
  • code/branches/presentation2/src/modules/overlays/hud/HUDNavigation.h

    r5781 r6293  
    5656        float getNavMarkerSize() const    { return this->navMarkerSize_; }
    5757
     58/*
    5859        void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); }
    5960        float getAimMarkerSize() const    { return this->aimMarkerSize_; }
     61*/
    6062
    6163        void setTextSize(float size);
     
    7173        Ogre::PanelOverlayElement* navMarker_;      //!< the panel used to show the arrow and the target marker
    7274        float navMarkerSize_;                       //!< One paramter size of the navigation marker
     75/*
    7376        Ogre::PanelOverlayElement* aimMarker_;      //!< Panel used to show the aim Marker
    7477        float aimMarkerSize_;                       //!< One paramter size of the aim marker
     78*/
    7579        Ogre::TextAreaOverlayElement* navText_;     //!< Text overlay to display the target distance
    7680        bool wasOutOfView_;                         //!< Performance booster variable: setMaterial is not cheap
  • code/branches/presentation2/src/orxonox/interfaces/RadarViewable.cc

    r6272 r6293  
    163163        if (!object)
    164164        {
    165             COUT(1) << "Assertation: 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;
    166166            assert(0);
    167167        }
Note: See TracChangeset for help on using the changeset viewer.