Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Location:
code/branches/map/src/orxonox/objects
Files:
4 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
  • code/branches/map/src/orxonox/objects/RadarViewable.h

    r2913 r2942  
    3737#include "core/OrxonoxClass.h"
    3838
     39#include <string>
    3940#include <OgreSceneNode.h>
    4041#include <OgreEntity.h>
     42#include <OgreManualObject.h>
     43#include "orxonox/tools/DynamicLines.h"
    4144
    4245namespace orxonox
     
    5558        };
    5659
     60
    5761    public:
    5862        RadarViewable();
    59         virtual ~RadarViewable() { }
     63        virtual ~RadarViewable();
    6064
    6165        inline void setRadarObjectCamouflage(float camouflage)
     
    96100        Ogre::SceneNode * MapNode_;
    97101        Ogre::Entity * MapEntity_;
    98 
     102        DynamicLines* line_;
     103        void addMapEntity();
     104        void updateMapPosition();
    99105    private:
    100106        void validate(const WorldEntity* object) const
     
    107113        }
    108114
     115       
     116        std::string uniqueId_;
     117
    109118        float radarObjectCamouflage_;
    110119        Shape radarObjectShape_;
  • code/branches/map/src/orxonox/objects/controllers/HumanController.cc

    r2662 r2942  
    3535#include "objects/worldentities/pawns/Pawn.h"
    3636#include "objects/gametypes/Gametype.h"
     37#include "overlays/map/Map.h"
    3738
    3839namespace orxonox
     
    9293    void HumanController::rotateYaw(const Vector2& value)
    9394    {
     95        //Hack to enable mouselook in map
     96        if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() )
     97        {
     98            Map::getSingletonPtr()->rotateYaw(value);
     99            return;
     100        }
    94101        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    95102            HumanController::localController_s->controllableEntity_->rotateYaw(value);
     
    98105    void HumanController::rotatePitch(const Vector2& value)
    99106    {
     107        //Hack to enable mouselook in map
     108        if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() )
     109        {
     110            Map::getSingletonPtr()->rotatePitch(value);
     111            return;
     112        }
    100113        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    101114            HumanController::localController_s->controllableEntity_->rotatePitch(value);
  • code/branches/map/src/orxonox/objects/controllers/HumanController.h

    r2662 r2942  
    6666            static void killBots(unsigned int amount = 0);
    6767
     68            //friend class, for mouselook
     69            friend class Map;
     70
    6871        private:
    6972            static HumanController* localController_s;
Note: See TracChangeset for help on using the changeset viewer.