Index: /code/branches/hud/src/orxonox/CMakeLists.txt
===================================================================
--- /code/branches/hud/src/orxonox/CMakeLists.txt	(revision 1608)
+++ /code/branches/hud/src/orxonox/CMakeLists.txt	(revision 1609)
@@ -3,4 +3,5 @@
   Main.cc
   Orxonox.cc
+  Radar.cc
   Settings.cc
 
@@ -18,4 +19,5 @@
   overlays/hud/HUDText.cc
   overlays/hud/RadarObject.cc
+  overlays/hud/RadarViewable.cc
 
   tolua/tolua_bind.cc
Index: /code/branches/hud/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- /code/branches/hud/src/orxonox/OrxonoxPrereqs.h	(revision 1608)
+++ /code/branches/hud/src/orxonox/OrxonoxPrereqs.h	(revision 1609)
@@ -76,4 +76,8 @@
   class Orxonox;
 
+  class RadarViewable;
+  class Radar;
+  class RadarListener;
+
   // objects
   class Ambient;
Index: /code/branches/hud/src/orxonox/Radar.cc
===================================================================
--- /code/branches/hud/src/orxonox/Radar.cc	(revision 1609)
+++ /code/branches/hud/src/orxonox/Radar.cc	(revision 1609)
@@ -0,0 +1,85 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief
+*/
+
+#include "OrxonoxStableHeaders.h"
+#include "Radar.h"
+#include "objects/WorldEntity.h"
+#include "overlays/hud/RadarViewable.h"
+
+#include "core/CoreIncludes.h"
+//#include "core/ConfigValueIncludes.h"
+
+namespace orxonox
+{
+    RadarListener::RadarListener()
+    {
+        RegisterRootObject(RadarListener);
+    }
+
+
+    Radar* Radar::instance_s = 0;
+
+    Radar::Radar()
+    {
+        assert(instance_s == 0);
+        instance_s = this;
+    }
+
+    Radar::~Radar()
+    {
+        instance_s = 0;
+    }
+
+    Radar& Radar::getInstance()
+    {
+        assert(instance_s);
+        return *instance_s;
+    }
+
+    void Radar::unregisterObject(RadarViewable* object)
+    {
+        // TODO: check for focus
+    }
+
+    void Radar::tick(float dt)
+    {
+        for (Iterator<RadarListener> itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
+        {
+            for (Iterator<RadarViewable> itElement = ObjectList<RadarViewable>::begin(); itElement; ++itElement)
+            {
+                if ((*itListener)->getRadarSensitivity() > (*itElement)->getRadarObjectVisibility())
+                    (*itListener)->displayObject(*itElement);
+            }
+        }
+    }
+}
Index: /code/branches/hud/src/orxonox/Radar.h
===================================================================
--- /code/branches/hud/src/orxonox/Radar.h	(revision 1609)
+++ /code/branches/hud/src/orxonox/Radar.h	(revision 1609)
@@ -0,0 +1,84 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief
+*/
+
+#ifndef _Radar_H__
+#define _Radar_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "core/OrxonoxClass.h"
+#include "objects/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport RadarListener : public OrxonoxClass
+    {
+    public:
+        RadarListener();
+        virtual ~RadarListener() { }
+
+        virtual void displayObject(RadarViewable* viewable) = 0;
+        virtual float getRadarSensitivity() = 0;
+    };
+
+    /**
+    @brief This class merely ensures that no one can inherit from Radar.
+    */
+    class _OrxonoxExport RadarBase
+    {
+    private:
+        friend class Radar;
+        RadarBase() { }
+    };
+ 
+    class _OrxonoxExport Radar : public Tickable, private virtual RadarBase
+    {
+    public:
+        Radar();
+        ~Radar();
+
+        void unregisterObject(RadarViewable* object);
+
+        void tick(float dt);
+
+        static Radar& getInstance();
+        static Radar* getInstancePtr() { return instance_s; }
+
+    private:
+        Radar(Radar& instance);
+
+        static Radar* instance_s;
+    };
+}
+#endif /* _Radar_H__ */
Index: /code/branches/hud/src/orxonox/objects/WorldEntity.h
===================================================================
--- /code/branches/hud/src/orxonox/objects/WorldEntity.h	(revision 1608)
+++ /code/branches/hud/src/orxonox/objects/WorldEntity.h	(revision 1609)
@@ -73,4 +73,6 @@
             inline const Vector3& getPosition() const
                 { return this->node_->getPosition(); }
+            inline const Vector3& getWorldPosition() const
+                { return this->node_->getWorldPosition(); }
 
             inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
@@ -100,4 +102,6 @@
             inline const Ogre::Quaternion& getOrientation()
               { return this->node_->getOrientation(); }
+            inline const Ogre::Quaternion& getWorldOrientation()
+              { return this->node_->getWorldOrientation(); }
             inline void setOrientation(const Ogre::Quaternion& quat)
               { this->node_->setOrientation(quat); }
Index: /code/branches/hud/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/OverlayGroup.cc	(revision 1608)
+++ /code/branches/hud/src/orxonox/overlays/OverlayGroup.cc	(revision 1609)
@@ -70,6 +70,6 @@
     BaseObject::XMLPort(xmlElement, mode);
 
+    XMLPortParam(OverlayGroup, "scale", scale, getScale, xmlElement, mode);
     XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode, false, true);
-    XMLPortParam(OverlayGroup, "scale", scale, getScale, xmlElement, mode);
   }
 
Index: /code/branches/hud/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUDBar.cc	(revision 1608)
+++ /code/branches/hud/src/orxonox/overlays/hud/HUDBar.cc	(revision 1609)
@@ -79,5 +79,5 @@
             // create background
             this->background_ = static_cast<PanelOverlayElement*>(
-                    OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background"));
+                    OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background_" + getUniqueNumberStr()));
             this->background_->setMaterialName("Orxonox/BarBackground");
             this->overlay_->add2D(this->background_);
@@ -93,5 +93,5 @@
 
             // create bar
-            this->bar_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "Bar"));
+            this->bar_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "Bar" + getUniqueNumberStr()));
             this->bar_->setMaterialName(materialname);
             this->background_->addChild(bar_);
Index: /code/branches/hud/src/orxonox/overlays/hud/HUDRadar.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUDRadar.cc	(revision 1608)
+++ /code/branches/hud/src/orxonox/overlays/hud/HUDRadar.cc	(revision 1609)
@@ -32,14 +32,16 @@
 #include <assert.h>
 #include <OgreOverlayManager.h>
+#include <OgreMaterialManager.h>
 
 #include "core/ConsoleCommand.h"
-#include "util/Math.h"
 #include "objects/SpaceShip.h"
 #include "objects/WorldEntity.h"
-#include "RadarObject.h"
+#include "RadarViewable.h"
 
 namespace orxonox
 {
     CreateFactory(HUDRadar);
+    CreateFactory(RadarColour);
+    CreateFactory(RadarShape);
 
     HUDRadar* HUDRadar::instance_s = 0;
@@ -62,4 +64,9 @@
             if (this->background_)
                 OverlayManager::getSingleton().destroyOverlayElement(this->background_);
+            while (this->radarDots_.size() > 0)
+            {
+                OverlayManager::getSingleton().destroyOverlayElement(this->radarDots_[this->radarDots_.size() - 1]);
+                this->radarDots_.pop_back();
+            }
         }
 
@@ -70,4 +77,6 @@
     {
         OrxonoxOverlay::XMLPort(xmlElement, mode);
+
+        XMLPortObject(HUDRadar, RadarColour, "shapes", addShape, getShape, xmlElement, mode, false, true);
 
         if (mode == XMLPort::LoadObject)
@@ -77,5 +86,18 @@
             overlay_->add2D(background_);
 
-            WorldEntity* object;
+            // create an array of all possible materials
+            unsigned int iMaterial = 0;
+            for (std::map<unsigned int, RadarShape*>::const_iterator itShape = shapes_.begin(); itShape != shapes_.end(); ++itShape)
+            {
+                Ogre::MaterialPtr originalMaterial = (Ogre::MaterialPtr)(Ogre::MaterialManager::getSingleton().getByName((*itShape).second->getAttribute()));
+                for (std::map<unsigned int, RadarColour*>::const_iterator itColour = colours_.begin(); itColour != colours_.end(); ++itColour)
+                {
+                    Ogre::MaterialPtr newMaterial = originalMaterial->clone((*itShape).second->getAttribute() + convertToString(iMaterial++));
+                    newMaterial->getTechnique(0)->getPass(0)->setAmbient((*itColour).second->getAttribute()); 
+                    materialNames_[(*itShape).first + ((*itColour).first << 8)] = newMaterial->getName();
+                }
+            }
+
+            /*WorldEntity* object;
             object = new WorldEntity();
             object->setPosition(2000.0, 0.0, 0.0);
@@ -89,7 +111,42 @@
             object = new WorldEntity();
             object->setPosition(10000.0,16000.0,0.0);
-            addRadarObject(object);
-        }
-
+            addRadarObject(object);*/
+        }
+    }
+
+    void HUDRadar::addColour(RadarColour* colour)
+    {
+        this->colours_[colour->getIndex()] = colour;
+    }
+
+    RadarColour* HUDRadar::getColour(unsigned int index) const
+    {
+        if (index < this->colours_.size())
+        {
+            std::map<unsigned int, RadarColour*>::const_iterator it = colours_.begin();
+            for (unsigned int i = 0; i != index; ++it, ++i)
+                ;
+            return (*it).second;
+        }
+        else
+            return 0;
+    }
+
+    void HUDRadar::addShape(RadarShape* shape)
+    {
+        this->shapes_[shape->getIndex()] = shape;
+    }
+
+    RadarShape* HUDRadar::getShape(unsigned int index) const
+    {
+        if (index < this->shapes_.size())
+        {
+            std::map<unsigned int, RadarShape*>::const_iterator it = shapes_.begin();
+            for (unsigned int i = 0; i != index; ++it, ++i)
+                ;
+            return (*it).second;
+        }
+        else
+            return 0;
     }
 
@@ -97,15 +154,34 @@
     {
         // iterate through all RadarObjects
-        for(std::list<RadarObject*>::iterator it = getRadarObjects().begin(); it!= getRadarObjects().end(); it++)
-        {
-            // calc position on radar...
-            // set size to fit distance...
-            float size = 1.0/(((*it)->getPosition() - SpaceShip::getLocalShip()->getPosition()).length());
-            size = clamp(size * 100.0f, 0.02f, 0.12f);
-            (*it)->getPanel()->setDimensions(size, size);
-
-            Vector2 coord = get2DViewcoordinates(SpaceShip::getLocalShip()->getPosition(), SpaceShip::getLocalShip()->getDir(), SpaceShip::getLocalShip()->getOrth(), (*it)->getPosition());
-            coord *= Ogre::Math::PI / 3.5; // small adjustment to make it fit the texture
-            (*it)->getPanel()->setPosition((1.0 + coord.x) * 0.5, (1.0 - coord.y) * 0.5);
+        unsigned int i = 0;
+        for (Iterator<RadarViewable> it = ObjectList<RadarViewable>::start(); it; ++it, ++i)
+        {
+            if ((*it)->isVisibleOnRadar())
+            {
+                WorldEntity* object = (*it)->getWorldEntity();
+                // Just to be sure that we actually have a WorldEntity
+                // We could do a dynamic_cast, but that's a lot slower
+                assert(object);
+
+                // set size to fit distance...
+                float size = 1.0/((object->getWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length());
+                size = clamp(size * 100.0f, 0.02f, 0.12f);
+                if (i == radarDots_.size())
+                {
+                    // we have to create a new panel
+                    radarDots_.push_back(static_cast<Ogre::PanelOverlayElement*>(
+                        Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarDot" + convertToString(i))));
+                }
+                radarDots_[i]->setDimensions(size, size);
+
+                // calc position on radar...
+                Vector2 coord = get2DViewcoordinates(SpaceShip::getLocalShip()->getPosition(), SpaceShip::getLocalShip()->getDir(), SpaceShip::getLocalShip()->getOrth(), object->getWorldPosition());
+                coord *= Ogre::Math::PI / 3.5; // small adjustment to make it fit the texture
+                radarDots_[i]->setPosition((1.0 + coord.x) * 0.5, (1.0 - coord.y) * 0.5);
+
+                // apply the right material
+                RadarPoint description = (*it)->getDescription();
+                radarDots_[i]->setMaterialName(materialNames_[description.shape_ + (description.colour_ << 8)]);
+            }
         }
     }
@@ -113,32 +189,10 @@
     void HUDRadar::listObjects()
     {
-        int i = 0;
         COUT(3) << "List of RadarObjects:\n";
         // iterate through all Radar Objects
-        for(std::list<RadarObject*>::const_iterator it = getRadarObjects().begin(); it != getRadarObjects().end(); ++it)
-        {
-            COUT(3) << i++ << ": " << (*it)->getPosition() << std::endl;
-        }
-    }
-
-    void HUDRadar::addRadarObject(WorldEntity* object, const ColourValue& colour)
-    {
-        RadarObject* obj = new RadarObject(overlay_, object, colour);
-        roSet_.insert(roSet_.end(), obj);
-    }
-
-    void HUDRadar::removeRadarObject(WorldEntity* object)
-    {
-        for(std::list<RadarObject*>::iterator it=roSet_.begin(); it!=roSet_.end(); ++it)
-        {
-            if ((*it)->getObject() == object)
-            {
-                /*if (this->nav_ && this->nav_->getFocus() == (*it))
-                    this->nav_->releaseFocus();*/
-
-                delete (*it);
-                roSet_.erase(it);
-                return;
-            }
+        unsigned int i = 0;
+        for (Iterator<RadarViewable> it = ObjectList<RadarViewable>::start(); it; ++it, ++i)
+        {
+            COUT(3) << i++ << ": " << (*it)->getWorldEntity()->getWorldPosition() << std::endl;
         }
     }
Index: /code/branches/hud/src/orxonox/overlays/hud/HUDRadar.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/HUDRadar.h	(revision 1608)
+++ /code/branches/hud/src/orxonox/overlays/hud/HUDRadar.h	(revision 1609)
@@ -36,8 +36,61 @@
 #include "overlays/OrxonoxOverlay.h"
 #include "objects/Tickable.h"
+#include "core/BaseObject.h"
+#include "util/Math.h"
+#include "core/Debug.h"
+#include "Radar.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport HUDRadar : public OrxonoxOverlay, public Tickable
+    template <class T, int Dummy>
+    class _OrxonoxExport RadarAttribute : public BaseObject
+    {
+      public:
+        RadarAttribute();
+        ~RadarAttribute() { }
+
+        void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+        void loadAttribute(Element& xmlElement, XMLPort::Mode mode);
+
+        void setAttribute(const T& attribute) { this->attribute_ = attribute; }
+        const T& getAttribute() const { return this->attribute_; }
+
+        void setIndex(unsigned int index); 
+        unsigned int getIndex() { return this->index_; }
+
+      private:
+        unsigned int index_;
+        T attribute_;
+    };
+
+    template <class T, int Dummy>
+    void RadarAttribute<T, Dummy>::setIndex(unsigned int index)
+    {
+        if (index > 0xFF)
+        {
+            COUT(1) << "Shape index was larger than 255 while parsing a RadarAttribute. "
+              << "Using random number!!!" << std::endl;
+            this->index_ = rand() & 0xFF;
+        }
+        else
+            this->index_ = index;
+    }
+
+    typedef RadarAttribute<std::string, 1> RadarShape;
+
+    template <>
+    RadarShape::RadarAttribute() : index_(0)
+        { RegisterObject(RadarShape); }
+
+    template <>
+    void RadarShape::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        BaseObject::XMLPort(xmlElement, mode);
+        XMLPortParam(RadarShape, "shape", setAttribute, getAttribute, xmlElement, mode);
+        XMLPortParam(RadarShape, "index", setIndex, getIndex, xmlElement, mode);
+    }
+
+
+    class _OrxonoxExport HUDRadar : public OrxonoxOverlay, public Tickable, public RadarListener
     {
       public:
@@ -47,23 +100,21 @@
         void XMLPort(Element& xmlElement, XMLPort::Mode mode);
 
+        void addShape(RadarShape* shape);
+        RadarShape* getShape(unsigned int index) const;
+
         void tick(float dt);
 
         void listObjects();
 
-        inline std::list<RadarObject*>& getRadarObjects()
-            { return this->roSet_; }
+      private:
+        void addColour(RadarColour* colour);
+        RadarColour* getColour(unsigned int index) const;
 
-        void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
-        void removeRadarObject(WorldEntity* object);
+        std::map<unsigned int, std::string> materialNames_;
+        std::map<unsigned int, RadarColour*> colours_;
+        std::map<unsigned int, RadarShape*> shapes_;
 
-        static HUDRadar& getInstance();
-
-      private:
-        HUDRadar(HUDRadar& instance);
-
-        std::list<RadarObject*> roSet_;
         Ogre::PanelOverlayElement* background_;
-
-        static HUDRadar* instance_s;
+        std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarDots_;
     };
 }
Index: de/branches/hud/src/orxonox/overlays/hud/OverlayElementFactories.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/OverlayElementFactories.h	(revision 1608)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Yuning Chai
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-#ifndef _OverlayElementFactories_H__
-#define _OverlayElementFactories_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <OgrePrerequisites.h>
-#include <OgreOverlayElement.h>
-#include <OgreOverlayElementFactory.h>
-
-#include "RadarOverlayElement.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport RadarOverlayElementFactory : public Ogre::OverlayElementFactory{
-      public:
-        Ogre::OverlayElement* createOverlayElement(const Ogre::String& instanceName){
-            return new RadarOverlayElement(instanceName);
-        }
-        const Ogre::String& getTypeName(void) const{
-            static Ogre::String name = "Radar";
-            return name;
-        }
-    };
-}
-
-#endif /* _OverlayElementFactories_H__ */
Index: /code/branches/hud/src/orxonox/overlays/hud/RadarViewable.cc
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/RadarViewable.cc	(revision 1609)
+++ /code/branches/hud/src/orxonox/overlays/hud/RadarViewable.cc	(revision 1609)
@@ -0,0 +1,56 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "RadarViewable.h"
+#include "core/Debug.h"
+#include "Radar.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor.
+    */
+    RadarViewable::RadarViewable()
+        : radarObjectVisibility_(1.0f)
+        , radarObject_(0)
+    {
+        RegisterRootObject(RadarViewable);
+    }
+
+    void RadarViewable::unregisterFromRadar()
+    {
+        Radar* radar = Radar::getInstancePtr();
+        if (radar)
+            radar->unregisterObject(this);
+        else
+        {
+            CCOUT(2) << "Attempting to unregister an object to the radar, but the radar is non existent." << std::endl;
+        }
+    }
+}
Index: /code/branches/hud/src/orxonox/overlays/hud/RadarViewable.h
===================================================================
--- /code/branches/hud/src/orxonox/overlays/hud/RadarViewable.h	(revision 1609)
+++ /code/branches/hud/src/orxonox/overlays/hud/RadarViewable.h	(revision 1609)
@@ -0,0 +1,67 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _RadarViewable_H__
+#define _RadarViewable_H__
+
+#include "OrxonoxPrereqs.h"
+#include <string>
+#include "core/OrxonoxClass.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    /**
+    @brief Interface for receiving window events.
+    */
+    class _OrxonoxExport RadarViewable : virtual public OrxonoxClass
+    {
+    public:
+        RadarViewable();
+        virtual ~RadarViewable() { unregisterFromRadar(); }
+
+        void unregisterFromRadar();
+
+        float getRadarObjectVisibility() const { return this->radarObjectVisibility_; }
+        void setRadarObjectVisibility(float visibility) { this->radarObjectVisibility_ = visibility; }
+
+        const std::string& getRadarObjectType() const { return this->radarObjectType_; }
+        void setRadarObjectType(const std::string& type) { this->radarObjectType_ = type; }
+
+        const ColourValue& getRadarObjectColour() const { return this->radarObjectColour_; }
+        void setRadarObjectColour(const ColourValue& colour) { this->radarObjectColour_ = colour; }
+
+    private:
+        float radarObjectVisibility_;
+        WorldEntity* radarObject_;
+        std::string radarObjectType_;
+        ColourValue radarObjectColour_;
+    };
+}
+
+#endif /* _RadarViewable_H__ */
Index: /code/branches/hud/src/orxonox/tools/TextureGenerator.cc
===================================================================
--- /code/branches/hud/src/orxonox/tools/TextureGenerator.cc	(revision 1609)
+++ /code/branches/hud/src/orxonox/tools/TextureGenerator.cc	(revision 1609)
@@ -0,0 +1,87 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Reto Grieder
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the Settings class.
+*/
+
+#include "OrxonoxStableHeaders.h"
+#include "TextureGenerator.h"
+#include <OgreMaterialManager.h>
+#include <OgreTechnique.h>
+#include "util/Convert.h"
+
+namespace std
+{
+    template <>
+    bool less<orxonox::ColourValue>::operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const
+    {
+        if (__x.r == __y.r)
+        {
+            if (__x.g == __y.g)
+            {
+                if (__x.b == __y.b)
+                {
+                    return __x.a < __y.a;
+                }
+                return __x.b < __y.b;
+            }
+            return __x.g < __y.g;
+        }
+        return __x.r < __y.r;
+    }
+}
+
+namespace orxonox
+{
+    std::map<std::string, std::map<ColourValue, std::string> > TextureGenerator::materials_s;
+    unsigned int TextureGenerator::materialCount_s = 0;
+
+    /*static*/ const std::string& TextureGenerator::getMaterialName(std::string textureName, const ColourValue& colour)
+    {
+        std::map<ColourValue, std::string>& colourMap = materials_s[textureName];
+        std::map<ColourValue, std::string>::const_iterator it = colourMap.find(colour);
+
+        if (it == colourMap.end())
+        {
+            std::string materialName = textureName + "_Material_" + convertToString(materialCount_s++);
+            Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialName, "General");
+            material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
+            Ogre::TextureUnitState* textureUnitState = material->getTechnique(0)->getPass(0)->createTextureUnitState();
+            textureUnitState->setTextureName(textureName);
+            textureUnitState->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour);
+            colourMap[colour] = materialName;
+            return colourMap[colour];
+        }
+        else
+        {
+            return (*it).second;
+        }
+    }
+}
Index: /code/branches/hud/src/orxonox/tools/TextureGenerator.h
===================================================================
--- /code/branches/hud/src/orxonox/tools/TextureGenerator.h	(revision 1609)
+++ /code/branches/hud/src/orxonox/tools/TextureGenerator.h	(revision 1609)
@@ -0,0 +1,59 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Reto Grieder
+ *
+ */
+
+/**
+    @file
+    @brief
+*/
+
+#ifndef _TextureGenerator_H__
+#define _TextureGenerator_H__
+
+#include "OrxonoxPrereqs.h"
+#include <string>
+#include <map>
+#include "util/Math.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport TextureGenerator
+    {
+    public:
+        static const std::string& getMaterialName(std::string textureName, const ColourValue& colour);
+
+    private:
+        TextureGenerator();
+        TextureGenerator(const TextureGenerator&);
+        ~TextureGenerator();
+
+        static std::map<std::string, std::map<ColourValue, std::string> > materials_s;
+        static unsigned int materialCount_s;
+    };
+}
+
+#endif /* _TextureGenerator_H__ */
Index: /code/branches/hud/src/util/Math.cc
===================================================================
--- /code/branches/hud/src/util/Math.cc	(revision 1608)
+++ /code/branches/hud/src/util/Math.cc	(revision 1609)
@@ -30,4 +30,5 @@
 
 #include "Math.h"
+#include "Convert.h"
 
 /**
@@ -123,2 +124,13 @@
     return (targetposition + targetvelocity * time);
 }
+
+unsigned long getUniqueNumber()
+{
+    static unsigned long aNumber = 135;
+    return aNumber++;
+}
+
+std::string getUniqueNumberStr()
+{
+    return convertToString(getUniqueNumber());
+}
Index: /code/branches/hud/src/util/Math.h
===================================================================
--- /code/branches/hud/src/util/Math.h	(revision 1608)
+++ /code/branches/hud/src/util/Math.h	(revision 1609)
@@ -33,4 +33,5 @@
 
 #include <ostream>
+#include <string>
 
 #include <OgreMath.h>
@@ -163,4 +164,7 @@
 }
 
+_UtilExport unsigned long getUniqueNumber();
+_UtilExport std::string getUniqueNumberStr();
+
 class _UtilExport IntVector2
 {
Index: /code/branches/hud/src/util/UtilPrereqs.h
===================================================================
--- /code/branches/hud/src/util/UtilPrereqs.h	(revision 1608)
+++ /code/branches/hud/src/util/UtilPrereqs.h	(revision 1609)
@@ -61,5 +61,4 @@
 //-----------------------------------------------------------------------
 class ArgReader;
-class Convert;
 class MultiTypePrimitive;
 class MultiTypeString;
Index: /code/branches/hud/visual_studio/vc8/orxonox.vcproj
===================================================================
--- /code/branches/hud/visual_studio/vc8/orxonox.vcproj	(revision 1608)
+++ /code/branches/hud/visual_studio/vc8/orxonox.vcproj	(revision 1609)
@@ -185,4 +185,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\orxonox\Radar.cc"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\orxonox\Settings.cc"
 				>
@@ -393,4 +397,8 @@
 				<File
 					RelativePath="..\..\src\orxonox\tools\ParticleInterface.cc"
+					>
+				</File>
+				<File
+					RelativePath="..\..\src\orxonox\tools\TextureGenerator.cc"
 					>
 				</File>
@@ -480,4 +488,8 @@
 					<File
 						RelativePath="..\..\src\orxonox\overlays\hud\RadarObject.cc"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\overlays\hud\RadarViewable.cc"
 						>
 					</File>
@@ -507,4 +519,8 @@
 			</File>
 			<File
+				RelativePath="..\..\src\orxonox\Radar.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\orxonox\Settings.h"
 				>
@@ -622,4 +638,8 @@
 				</File>
 				<File
+					RelativePath="..\..\src\orxonox\tools\TextureGenerator.h"
+					>
+				</File>
+				<File
 					RelativePath="..\..\src\orxonox\tools\Timer.h"
 					>
@@ -686,4 +706,8 @@
 					<File
 						RelativePath="..\..\src\orxonox\overlays\hud\RadarObject.h"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\orxonox\overlays\hud\RadarViewable.h"
 						>
 					</File>
