Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 30, 2009, 2:12:57 PM (15 years ago)
Author:
Naaduun
Message:

=added dynamic libs to orxonox/tools. changed humancontroller to use mouseview

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/map/src/orxonox/objects/RadarViewable.cc

    r2913 r2942  
    3535#include "objects/worldentities/WorldEntity.h"
    3636#include "objects/Radar.h"
     37#include "util/String.h"
     38#include <OgreManualObject.h>
     39#include "overlays/map/Map.h"
     40#include "orxonox/tools/DynamicLines.h"
    3741
    3842namespace orxonox
     
    4751        , MapNode_(NULL)
    4852        , MapEntity_(NULL)
     53        , line_(NULL)
    4954    {
    5055        RegisterRootObject(RadarViewable);
     56
     57        this->uniqueId_=getUniqueNumberString();
     58/*
     59        if(Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr())
     60        {
     61            this->addEntity();
     62        }
     63
     64        */
     65    }
     66
     67
     68    RadarViewable::~RadarViewable()
     69    {
     70        delete MapNode_;
     71        delete MapEntity_;
     72    }
     73
     74    void RadarViewable::addMapEntity()
     75    { //TODO Check shape and add accordantly
     76        if( this->MapNode_ && !this->MapEntity_ && Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr() )
     77        {
     78            COUT(0) << "Adding " << this->uniqueId_ << " to Map.\n";
     79            this->MapEntity_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createEntity( this->uniqueId_, "drone.mesh");
     80            /*this->line_ =  Map::getSingletonPtr()->getMapSceneManagerPtr()->createManualObject(this->uniqueId_ + "_l");
     81            this->line_->begin("Map/line_", Ogre::RenderOperation::OT_LINE_STRIP);
     82            //line_->position(0, -it->getRVWorldPosition().y, 0);
     83            //this->line_->position(0, -20, 0);
     84            this->line_->position(0, 0, -10); //Front Arrow
     85            this->line_->position(0, 0, 0);
     86
     87            this->line_->end(); */
     88            this->line_ = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
     89            this->line_->addPoint( Vector3(0,0,0) );
     90            this->line_->addPoint( Vector3(0,0,0) );
     91
     92            this->MapNode_->attachObject( this->MapEntity_ );
     93            this->MapNode_->attachObject( this->line_ );
     94        }
     95        else
     96        {
     97            COUT(0) << "Unable to load " << this->uniqueId_ << " to Map.\n";
     98        }
     99    }
     100
     101    void RadarViewable::updateMapPosition()
     102    {
     103        if( this->MapNode_ )
     104        {
     105            this->MapNode_->setPosition( this->getRVWorldPosition() );
     106            this->MapNode_->translate( this->getRVOrientedVelocity(), (Ogre::Node::TransformSpace)3 );
     107            this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() );
     108Vector3 v = this->getRVWorldPosition();
     109            this->line_->setPoint(1, Vector3(0,v.y,0) );
     110        }
    51111    }
    52112
Note: See TracChangeset for help on using the changeset viewer.