Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7051


Ignore:
Timestamp:
May 31, 2010, 3:33:14 PM (14 years ago)
Author:
scheusso
Message:

HUDNavigation overlays are coloured now

Location:
code/branches/presentation3/src/modules/overlays/hud
Files:
2 edited

Legend:

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

    r7050 r7051  
    4747#include "worldentities/WorldEntity.h"
    4848#include "core/ConfigValueIncludes.h"
     49#include "tools/TextureGenerator.h"
    4950// #include <boost/bind/bind_template.hpp>
    5051
     
    199200                if ( !it->second.wasOutOfView_ )
    200201                {
    201                     it->second.panel_->setMaterialName ( "Orxonox/NavArrows" );
     202                    it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "arrows.tga", it->first->getRadarObjectColour()) );
    202203                    it->second.wasOutOfView_ = true;
    203204                }
     
    256257                if ( it->second.wasOutOfView_ )
    257258                {
    258                     it->second.panel_->setMaterialName ( "Orxonox/NavTDC" );
     259                  //it->second.panel_->setMaterialName ( "Orxonox/NavTDC" );
     260                    it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "tdc.tga", it->first->getRadarObjectColour()) );
    259261                    it->second.wasOutOfView_ = false;
    260262                }
     
    306308void HUDNavigation::addObject ( RadarViewable* object )
    307309{
     310    if( showObject(object)==false )
     311        return;
    308312
    309313    if ( activeObjectList_.size() >= markerLimit_ )
     
    311315            return;
    312316
    313     // Don't display our own ship
    314     if ( object == dynamic_cast<RadarViewable*> ( this->getOwner() ) )
    315         return;
    316 
    317317    // Object hasn't been added yet (we know that)
    318318    assert ( this->activeObjectList_.find ( object ) == this->activeObjectList_.end() );
     
    327327    Ogre::PanelOverlayElement* panel = static_cast<Ogre::PanelOverlayElement*> ( Ogre::OverlayManager::getSingleton()
    328328                                       .createOverlayElement ( "Panel", "HUDNavigation_navMarker_" + getUniqueNumberString() ) );
    329     panel->setMaterialName ( "Orxonox/NavTDC" );
     329//     panel->setMaterialName ( "Orxonox/NavTDC" );
     330    panel->setMaterialName( TextureGenerator::getMaterialName( "tdc.tga", object->getRadarObjectColour()) );
    330331    panel->setDimensions ( navMarkerSize_ * xScale, navMarkerSize_ * yScale );
     332//     panel->setColour( object->getRadarObjectColour() );
    331333
    332334    Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*> ( Ogre::OverlayManager::getSingleton()
     
    334336    text->setFontName ( this->fontName_ );
    335337    text->setCharHeight ( text->getCharHeight() * yScale );
     338    text->setColour( object->getRadarObjectColour() );
    336339
    337340    panel->hide();
     
    351354void HUDNavigation::removeObject ( RadarViewable* viewable )
    352355{
    353     if ( viewable == dynamic_cast<RadarViewable*> ( this->getOwner() ) )
     356    if( showObject(viewable)==false )
    354357        return;
    355358
     
    386389}
    387390
     391void HUDNavigation::objectChanged(RadarViewable* viewable)
     392{
     393    // TODO: niceification neccessary ;)
     394    removeObject(viewable);
     395    addObject(viewable);
     396}
     397
     398
     399bool HUDNavigation::showObject(RadarViewable* rv)
     400{
     401    if ( rv == dynamic_cast<RadarViewable*> ( this->getOwner() ) )
     402        return false;
     403    assert( rv->getWorldEntity() );
     404    if ( rv->getWorldEntity()->isVisible()==false )
     405        return false;
     406    return true;
     407}
     408
    388409void HUDNavigation::changedOwner()
    389410{
  • code/branches/presentation3/src/modules/overlays/hud/HUDNavigation.h

    r7050 r7051  
    5656    virtual void addObject ( RadarViewable* object );
    5757    virtual void removeObject ( RadarViewable* viewable );
    58     virtual void objectChanged ( RadarViewable* viewable ) {}
     58    virtual void objectChanged ( RadarViewable* viewable );
    5959
    6060    virtual void changedOwner();
     
    7676
    7777    };
     78   
     79    bool showObject( RadarViewable* rv );
    7880
    7981    // XMLPort accessors
Note: See TracChangeset for help on using the changeset viewer.