Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 20, 2010, 8:30:38 PM (15 years ago)
Author:
scheusso
Message:

merging hudelements into presentation3 and reducing (or increasing) output level of lod debug output

Location:
code/branches/presentation3
Files:
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3

  • code/branches/presentation3/src/orxonox/Radar.cc

    r6417 r6942  
    7777    }
    7878
     79    void Radar::addRadarObject(RadarViewable* rv)
     80    {
     81        assert( this->radarObjects_.find(rv) == this->radarObjects_.end() );
     82        this->radarObjects_.insert(rv);
     83        // iterate through all radarlisteners and notify them
     84        for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
     85        {
     86            (*itListener)->addObject(rv);
     87        }
     88    }
     89   
     90    void Radar::removeRadarObject(RadarViewable* rv)
     91    {
     92        assert( this->radarObjects_.find(rv) != this->radarObjects_.end() );
     93        this->radarObjects_.erase(rv);
     94        // iterate through all radarlisteners and notify them
     95        for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
     96        {
     97            (*itListener)->removeObject(rv);
     98        }
     99    }
     100
    79101    const RadarViewable* Radar::getFocus()
    80102    {
     
    109131        {
    110132            (*itListener)->radarTick(dt);
    111 
    112             for (ObjectList<RadarViewable>::iterator itElement = ObjectList<RadarViewable>::begin(); itElement; ++itElement)
    113             {
    114                 if ((*itElement)->getRadarVisibility())
    115                     if ((*itListener)->getRadarSensitivity() > (*itElement)->getRadarObjectCamouflage())
    116                         (*itListener)->displayObject(*itElement, *itElement == this->focus_);
    117             }
    118133        }
    119134    }
     
    188203        }
    189204    }
     205   
     206    void Radar::radarObjectChanged(RadarViewable* rv)
     207    {
     208        for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
     209        {
     210          (*itListener)->objectChanged(rv);
     211        }
     212    }
    190213}
  • code/branches/presentation3/src/orxonox/Radar.h

    r6417 r6942  
    3838
    3939#include <map>
     40#include <set>
    4041#include <string>
    4142
     
    4849    class _OrxonoxExport Radar : public Tickable
    4950    {
     51        friend class RadarViewable;
    5052    public:
    5153        Radar();
     
    5860
    5961        void listObjects() const;
     62        const std::set<RadarViewable*>& getRadarObjects() const
     63            { return this->radarObjects_; }
    6064
    6165        void releaseFocus();
     
    6670
    6771        void updateFocus();
     72        void addRadarObject(RadarViewable* rv);
     73        void removeRadarObject(RadarViewable* rv);
     74        void radarObjectChanged(RadarViewable* rv);
    6875
    6976        ObjectListIterator<RadarViewable> itFocus_;
    7077        RadarViewable* focus_;
    7178        std::map<std::string, RadarViewable::Shape> objectTypes_;
     79        std::set<RadarViewable*> radarObjects_;
    7280        int objectTypeCounter_;
    7381    };
  • code/branches/presentation3/src/orxonox/controllers/HumanController.cc

    r6417 r6942  
    3535#include "gametypes/Gametype.h"
    3636#include "infos/PlayerInfo.h"
    37 #include "overlays/Map.h"
    3837#include "Radar.h"
    3938#include "Scene.h"
     
    116115    void HumanController::yaw(const Vector2& value)
    117116    {
    118         //Hack to enable mouselook in map
    119         if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() )
    120         {
    121             Map::getSingletonPtr()->rotateYaw(value);
    122             return;
    123         }
    124117        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    125118            HumanController::localController_s->controllableEntity_->rotateYaw(value);
     
    128121    void HumanController::pitch(const Vector2& value)
    129122    {
    130         //Hack to enable mouselook in map
    131         if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() )
    132         {
    133             Map::getSingletonPtr()->rotatePitch(value);
    134             return;
    135         }
    136123        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    137124            HumanController::localController_s->controllableEntity_->rotatePitch(value);
  • code/branches/presentation3/src/orxonox/gamestates/GSGraphics.cc

    r6417 r6942  
    3939#include "core/Game.h"
    4040#include "core/GUIManager.h"
    41 // HACK:
    42 #include "overlays/Map.h"
    4341
    4442namespace orxonox
     
    7371    void GSGraphics::deactivate()
    7472    {
    75         // HACK: (destroys a resource smart pointer)
    76         Map::hackDestroyMap();
     73
    7774    }
    7875
  • code/branches/presentation3/src/orxonox/graphics/Model.cc

    r6926 r6942  
    120120                        setLodLevel(lodInfo->getLodLevel());
    121121                   
    122                     COUT(0) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and scale: "<< scaleFactor << ":" << std::endl;
     122                    COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and scale: "<< scaleFactor << ":" << std::endl;
    123123
    124124#if OGRE_VERSION >= 0x010700
     
    132132                        float factor = scaleFactor*5/lodLevel_;
    133133                       
    134                         COUT(0)<<"LodLevel set with factor: "<<factor<<std::endl;
     134                        COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
    135135
    136136                        distList.push_back(70.0f*factor);
     
    159159                            what = "<0";
    160160                       
    161                         COUT(0)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
     161                        COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
    162162                    }
    163163                }
  • code/branches/presentation3/src/orxonox/interfaces/RadarListener.h

    r5781 r6942  
    4141        virtual ~RadarListener() { }
    4242
    43         virtual void displayObject(RadarViewable* viewable, bool bIsMarked) = 0;
     43        virtual void addObject(RadarViewable* viewable) = 0;
     44        virtual void removeObject(RadarViewable* viewable) = 0;
     45        virtual void objectChanged(RadarViewable* viewable) = 0;
    4446        virtual float getRadarSensitivity() const = 0;
    4547        virtual void radarTick(float dt) = 0;
  • code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc

    r6417 r6942  
    2929#include "RadarViewable.h"
    3030
    31 #include <OgreSceneManager.h>
    32 #include <OgreSceneNode.h>
    33 #include <OgreEntity.h>
    34 
    3531#include "util/StringUtils.h"
    3632#include "core/CoreIncludes.h"
    37 #include "tools/DynamicLines.h"
    3833#include "worldentities/WorldEntity.h"
    3934#include "Radar.h"
    4035#include "Scene.h"
    41 #include "overlays/Map.h"
    4236
    4337namespace orxonox
     
    4640        @brief Constructor.
    4741    */
    48     RadarViewable::RadarViewable()
    49         : MapNode_(NULL)
    50         , MapEntity_(NULL)
    51         , line_(NULL)
    52         , LineNode_(NULL)
    53         , isHumanShip_(false)
     42    RadarViewable::RadarViewable(BaseObject* creator)
     43        : isHumanShip_(false)
    5444        , bVisibility_(true)
     45        , bInitialized_(false)
     46        , creator_(creator)
    5547        , radarObjectCamouflage_(0.0f)
    5648        , radarObjectShape_(Dot)
     
    6052
    6153        this->uniqueId_=getUniqueNumberString();
    62 /*
    63         if(Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr())
    64         {
    65             this->addEntity();
    66         }
    67 
    68         */
     54        this->radar_ = this->creator_->getScene()->getRadar();
     55        this->radar_->addRadarObject(this);
     56        this->bInitialized_ = true;
    6957    }
    7058
     
    7260    RadarViewable::~RadarViewable()
    7361    {
    74         if (this->isHumanShip_ && MapNode_)
    75             MapNode_->removeAllChildren();
    76 
    77         if (MapNode_)
    78             delete MapNode_;
    79 
    80         if (MapEntity_)
    81             delete MapEntity_;
    82 
    83         if (line_)
    84             delete line_;
    85 
    86         if (LineNode_)
    87             delete LineNode_;
     62        if( this->bInitialized_ )
     63            this->radar_->removeRadarObject(this);
    8864    }
    8965
    90     void RadarViewable::addMapEntity()
    91     { //TODO Check shape and add accordantly
    92         if( this->MapNode_ && !this->MapEntity_ && Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr() )
    93         {
    94             COUT(0) << "Adding " << this->uniqueId_ << " to Map.\n";
    95             this->MapEntity_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createEntity( this->uniqueId_, "drone.mesh");
    96             /*this->line_ =  Map::getSingletonPtr()->getMapSceneManagerPtr()->createManualObject(this->uniqueId_ + "_l");
    97             this->line_->begin("Map/line_", Ogre::RenderOperation::OT_LINE_STRIP);
    98             //line_->position(0, -it->getRVWorldPosition().y, 0);
    99             //this->line_->position(0, -20, 0);
    100             this->line_->position(0, 0, -10); //Front Arrow
    101             this->line_->position(0, 0, 0);
    102 
    103             this->line_->end(); */
    104             this->line_ = new Ogre::DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
    105             this->line_->addPoint( Vector3(0,0,0) );
    106             this->line_->addPoint( Vector3(0,0,0) );
    107 
    108             this->MapNode_->attachObject( this->MapEntity_ );
    109 
    110             this->LineNode_ = this->MapNode_->createChildSceneNode();
    111             this->LineNode_->attachObject( this->line_ );
    112         }
    113         else
    114         {
    115             COUT(0) << "Unable to load " << this->uniqueId_ << " to Map.\n";
    116         }
    117     }
    118 
    119     void RadarViewable::updateMapPosition()
    120     {
    121         if( this->MapNode_ )
    122         {
    123             this->MapNode_->setPosition( this->getRVWorldPosition() );
    124             this->MapNode_->translate( this->getRVOrientedVelocity(), static_cast<Ogre::Node::TransformSpace>(3) );
    125             this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() );
    126 //Vector3 v = this->getRVWorldPosition();
    127             //this->line_->setPoint(1, Vector3(0,v.y,0) );
    128             this->line_->setPoint(1, Vector3( 0, static_cast<float>(static_cast<int>( -Map::getSingletonPtr()->movablePlane_->getDistance( this->getRVWorldPosition() ) ) ) ,0 ));
    129             this->line_->update();
    130             if( Map::getSingletonPtr()->playerShipNode_ )
    131                 this->LineNode_->setDirection( Map::getSingletonPtr()->playerShipNode_->getLocalAxes().GetColumn(1) ,Ogre::Node::TS_WORLD,Vector3::UNIT_Y);
    132         }
    133     }
    134 
    135     void RadarViewable::setRadarObjectDescription(const std::string& str)
    136     {
    137         Radar* radar = this->getWorldEntity()->getScene()->getRadar();
    138         if (radar)
    139             this->radarObjectShape_ = radar->addObjectDescription(str);
    140         else
    141         {
    142             CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
    143         }
    144         this->radarObjectDescription_ = str;
    145     }
     66//     void RadarViewable::setRadarObjectDescription(const std::string& str)
     67//     {
     68//         Radar* radar = this->getWorldEntity()->getScene()->getRadar();
     69//         if (radar)
     70//             this->radarObjectShape_ = radar->addObjectDescription(str);
     71//         else
     72//         {
     73//             CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
     74//         }
     75//         this->radarObjectDescription_ = str;
     76//     }
    14677
    14778    const Vector3& RadarViewable::getRVWorldPosition() const
     
    16798        }
    16899    }
     100   
     101    void RadarViewable::settingsChanged()
     102    {
     103        this->radar_->radarObjectChanged(this);
     104    }
    169105}
  • code/branches/presentation3/src/orxonox/interfaces/RadarViewable.h

    r5781 r6942  
    3636
    3737#include "util/Math.h"
    38 #include "util/OgreForwardRefs.h"
    3938#include "core/OrxonoxClass.h"
     39#include "core/SmartPtr.h"
    4040
    4141namespace orxonox
    4242{
     43    class BaseObject;
     44
    4345    /**
    4446    @brief Interface for receiving window events.
     
    5658
    5759    public:
    58         RadarViewable();
     60        RadarViewable(BaseObject* creator);
    5961        virtual ~RadarViewable();
    6062
    6163        inline void setRadarObjectCamouflage(float camouflage)
    62             { this->radarObjectCamouflage_ = camouflage; }
     64            {
     65                if( this->radarObjectCamouflage_ != camouflage )
     66                {
     67                    this->radarObjectCamouflage_ = camouflage;
     68                    this->settingsChanged();
     69                }
     70            }
    6371        inline float getRadarObjectCamouflage() const
    6472            { return this->radarObjectCamouflage_; }
    6573
    6674        inline void setRadarObjectColour(const ColourValue& colour)
    67             { this->radarObjectColour_ = colour; }
     75            {
     76                if(this->radarObjectColour_ != colour)
     77                {
     78                    this->radarObjectColour_ = colour;
     79                    this->settingsChanged();
     80                }
     81            }
    6882        inline const ColourValue& getRadarObjectColour() const
    6983            { return this->radarObjectColour_; }
    7084
    71         void setRadarObjectDescription(const std::string& str);
    72         inline const std::string& getRadarObjectDescription() const
    73             { return this->radarObjectDescription_; }
     85//         void setRadarObjectDescription(const std::string& str);
     86//         inline const std::string& getRadarObjectDescription() const
     87//             { return this->radarObjectDescription_; }
    7488
    7589        inline void setRadarVisibility(bool b)
    76             { this->bVisibility_ = b; }
     90            {
     91                if(b!=this->bVisibility_)
     92                {
     93                    this->bVisibility_ = b;
     94                    this->settingsChanged();
     95                }
     96            }
    7797        inline bool getRadarVisibility() const
    7898            { return this->bVisibility_; }
     
    84104
    85105        inline void setRadarObjectShape(Shape shape)
    86             { this->radarObjectShape_ = shape; }
     106            {
     107                if( this->radarObjectShape_ != shape )
     108                {
     109                    this->radarObjectShape_ = shape;
     110                    this->settingsChanged();
     111                }
     112            }
    87113        inline Shape getRadarObjectShape() const
    88114            { return this->radarObjectShape_; }
     115        void settingsChanged();
    89116
    90 /*
    91         inline void setMapNode(Ogre::SceneNode * node)
    92             { this->MapNode_ = node; }
    93         inline Ogre::SceneNode * getMapNode() const
    94             { return this->MapNode_; }
    95         inline void setMapEntity(Ogre::Entity * ent)
    96             { this->MapEntity_ = ent; }
    97         inline Ogre::Entity * getMapEntity() const
    98             { return this->MapEntity_; }
    99 */
    100         //Used for Map
    101         Ogre::SceneNode * MapNode_;
    102         Ogre::Entity * MapEntity_;
    103         Ogre::DynamicLines* line_;
    104         Ogre::SceneNode * LineNode_;
    105         void addMapEntity();
    106         void updateMapPosition();
     117
    107118        bool isHumanShip_;
    108119        inline const std::string& getUniqueId()
     
    115126        void validate(const WorldEntity* object) const;
    116127        bool bVisibility_;
     128        bool bInitialized_;
    117129        //Map
    118130        std::string uniqueId_;
     131        BaseObject* creator_;
    119132
    120133
    121134        //Radar
     135        SmartPtr<Radar> radar_;
    122136        float radarObjectCamouflage_;
    123137        Shape radarObjectShape_;
  • code/branches/presentation3/src/orxonox/overlays/CMakeLists.txt

    r6746 r6942  
    44  OverlayGroup.cc
    55
    6 COMPILATION_BEGIN OverlayCompilation.cc
     6#COMPILATION_BEGIN OverlayCompilation.cc
    77  InGameConsole.cc
    8   Map.cc
    9 COMPILATION_END
     8#COMPILATION_END
    109)
  • code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.cc

    r6864 r6942  
    5353    CreateFactory(Pawn);
    5454
    55     Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
     55    Pawn::Pawn(BaseObject* creator)
     56        : ControllableEntity(creator)
     57        , RadarViewable(creator)
    5658    {
    5759        RegisterObject(Pawn);
Note: See TracChangeset for help on using the changeset viewer.