Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2008, 3:39:48 PM (16 years ago)
Author:
landauf
Message:
  • AI ships are now displayed with a point with its teamcolour on the radar.
  • It's now possible to assign an arbitrary colour (and even a texture) to a RadarObject. But be aware the system has to create a new material for every colour (not for every object), so please use deterministic colours to reduce the amount of used materials to a bearable number.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/hud/RadarObject.h

    r1505 r1562  
    3030#define _RadarObject_H__
    3131
     32#include <map>
     33
    3234#include <OgrePrerequisites.h>
    3335#include <OgreSceneNode.h>
     
    4042    class _OrxonoxExport RadarObject
    4143    {
    42       private:
    43         Ogre::OverlayManager* om;                               // our one and only overlay manager
    44         Ogre::SceneNode* node_;                                 // node of object
    45         int colour_;
     44      public:
     45        RadarObject(Ogre::OverlayContainer* container, Ogre::SceneNode* node, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1), const std::string& texturename = "white.tga");
     46        ~RadarObject();
    4647
    47       public:
    48         RadarObject(Ogre::OverlayContainer* container, Ogre::SceneNode* node, int colour = 0);
    49         ~RadarObject();
    50         void setColour(int colour);
    51         void resetColour();
     48        void setMaterial(const ColourValue& colour, const std::string& texturename);
     49        inline void setColour(const ColourValue& colour)
     50            { this->setMaterial(colour, this->texturename_); }
     51        inline void setTexture(const std::string& texturename)
     52            { this->setMaterial(this->colour_, texturename); }
     53        inline void resetMaterial()
     54            { this->setMaterial(this->colour_, this->texturename_); }
     55
    5256        Vector3 getPosition();
    5357        Ogre::SceneNode* getNode();
     
    5862        Ogre::PanelOverlayElement* panel_;              // the panel used to show the dot
    5963
    60         static int count;
    61         static const int RED = 0;
    62         static const int YELLOW = 1;
    63         static const int GREEN = 2;
    64         static const int BLUE = 3;
    65         static const int WHITE = 99;            // used if object got nav focus
     64      private:
     65        static std::map<std::string, std::map<ColourValue, std::string> > materials_s;
     66        unsigned static int count_s;
     67        Ogre::SceneNode* node_;                                 // node of object
     68        ColourValue colour_;
     69        std::string texturename_;
    6670  };
    6771}
Note: See TracChangeset for help on using the changeset viewer.