Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2008, 12:05:12 AM (16 years ago)
Author:
rgrieder
Message:
  • Radar now working like before
  • but more of a svn save..

There is class called Radar which takes care of the focus and all objects that can be displayed on a Radar.
The actual visual implementation is in HUDRadar.
To make a object radar viewable, simply implement RadarViewable and set the WorldEntitiy pointer in the constructor (assertation will fail otherwise!).
You can also set a camouflage value between 0 and 1 that tells how good a radar can see an object.
The HUDRadar (or another one) on the other side has a sensitivity between 0 and 1. So only if the sensitivity is higher than the camouflage value, the object gets displayed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/Radar.h

    r1609 r1613  
    3838
    3939#include <string>
     40#include "core/Iterator.h"
    4041#include "core/OrxonoxClass.h"
    4142#include "objects/Tickable.h"
     43#include "RadarViewable.h"
    4244
    4345namespace orxonox
    4446{
    45     class _OrxonoxExport RadarListener : public OrxonoxClass
     47    class _OrxonoxExport RadarListener : virtual public OrxonoxClass
    4648    {
    4749    public:
     
    4951        virtual ~RadarListener() { }
    5052
    51         virtual void displayObject(RadarViewable* viewable) = 0;
     53        virtual void displayObject(RadarViewable* viewable, bool bIsMarked) = 0;
     54        virtual void hideMarker() = 0;
    5255        virtual float getRadarSensitivity() = 0;
     56        virtual void radarTick(float dt) = 0;
    5357    };
    5458
     
    6973        ~Radar();
    7074
    71         void unregisterObject(RadarViewable* object);
    72 
    73         void tick(float dt);
     75        //void unregisterObject(RadarViewable* object);
     76        const RadarViewable* getFocus();
     77        RadarViewable::Shape addObjectDescription(const std::string name);
    7478
    7579        static Radar& getInstance();
    7680        static Radar* getInstancePtr() { return instance_s; }
    7781
     82        static void cycleNavigationFocus();
     83        static void releaseNavigationFocus();
     84
    7885    private:
    7986        Radar(Radar& instance);
     87        void tick(float dt);
     88
     89        void releaseFocus();
     90        void updateFocus();
     91        void cycleFocus();
     92
     93        Iterator<RadarViewable> itFocus_;
     94        RadarViewable* focus_;
     95        std::map<std::string, RadarViewable::Shape> objectTypes_;
     96        int objectTypeCounter_;
    8097
    8198        static Radar* instance_s;
Note: See TracChangeset for help on using the changeset viewer.