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 moved

Legend:

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

    r1609 r1613  
    4343    {
    4444    public:
     45        enum Shape
     46        {
     47            Square,
     48            Dot,
     49            Triangle
     50        };
     51
     52    public:
    4553        RadarViewable();
    46         virtual ~RadarViewable() { unregisterFromRadar(); }
     54        virtual ~RadarViewable() { }//unregisterFromRadar(); }
    4755
    48         void unregisterFromRadar();
    49 
    50         float getRadarObjectVisibility() const { return this->radarObjectVisibility_; }
    51         void setRadarObjectVisibility(float visibility) { this->radarObjectVisibility_ = visibility; }
    52 
    53         const std::string& getRadarObjectType() const { return this->radarObjectType_; }
    54         void setRadarObjectType(const std::string& type) { this->radarObjectType_ = type; }
     56        float getRadarObjectCamouflage() const { return this->radarObjectCamouflage_; }
     57        void setRadarObjectCamouflage(float camouflage) { this->radarObjectCamouflage_ = camouflage; }
    5558
    5659        const ColourValue& getRadarObjectColour() const { return this->radarObjectColour_; }
    5760        void setRadarObjectColour(const ColourValue& colour) { this->radarObjectColour_ = colour; }
    5861
     62        const std::string& getRadarObjectDescription() const { return this->radarObjectDescription_; }
     63        void setRadarObjectDescription(const std::string& str);
     64
     65        const WorldEntity* getWorldEntity() const { return this->radarObject_; }
     66        const Vector3& getWorldPosition() const { validate(); return this->radarObject_->getWorldPosition(); }
     67        Vector3 getOrientedVelocity() const
     68            { validate(); return this->radarObject_->getOrientation() * this->radarObject_->getVelocity(); }
     69
     70        Shape getRadarObjectType() const { return this->radarObjectType_; }
     71
     72    protected:
     73        WorldEntity* radarObject_;
     74        //void unregisterFromRadar();
     75
    5976    private:
    60         float radarObjectVisibility_;
    61         WorldEntity* radarObject_;
    62         std::string radarObjectType_;
     77        void validate() const { if (!this->radarObject_)
     78        { COUT(1) << "Assertation: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl; assert(0); } }
     79
     80        float radarObjectCamouflage_;
     81        Shape radarObjectType_;
     82        std::string radarObjectDescription_;
    6383        ColourValue radarObjectColour_;
    6484    };
Note: See TracChangeset for help on using the changeset viewer.