Index: code/branches/cegui0.8_ogre1.9/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/libraries/core/CMakeLists.txt	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/libraries/core/CMakeLists.txt	(revision 11795)
@@ -95,4 +95,5 @@
   LINK_LIBRARIES
     ${OGRE_LIBRARY}
+    ${OGRE_OVERLAY_LIBRARY}
     ${Boost_FILESYSTEM_LIBRARY}
     ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
Index: code/branches/cegui0.8_ogre1.9/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/libraries/core/GUIManager.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/libraries/core/GUIManager.cc	(revision 11795)
@@ -482,4 +482,7 @@
         assert(guiSystem_);
         this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectTimePulse, arg::_1, time.getDeltaTime()));
+#if CEGUI_VERSION >= 0x000800
+        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectTimePulse, arg::_1, time.getDeltaTime()));
+#endif
     }
 
@@ -664,5 +667,5 @@
             this->setBackgroundImage("");
         else
-            this->setBackgroundImage("set: " + imageSet + " image: " + imageName);
+            this->setBackgroundImage(imageSet + "/" + imageName);
     }
 
@@ -846,5 +849,5 @@
     bool GUIManager::protectedCeguiContextCall(FunctionType function)
     {
-        return this->protectedCall(function, this->guiSystem_->getDefaultGUIContext());
+        return this->protectedCall(function, &this->guiSystem_->getDefaultGUIContext());
     }
 #endif
Index: code/branches/cegui0.8_ogre1.9/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/libraries/core/GraphicsManager.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/libraries/core/GraphicsManager.cc	(revision 11795)
@@ -45,4 +45,7 @@
 #include <OgreViewport.h>
 #include <OgreWindowEventUtilities.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlaySystem.h>
+#endif
 
 #include "SpecialConfig.h"
@@ -115,4 +118,10 @@
         this->loadOgreRoot();
 
+#if OGRE_VERSION >= 0x010900
+        this->overlaySystem_ = new Ogre::OverlaySystem();
+#else
+        this->overlaySystem_ = nullptr;
+#endif
+
         // At first, add the root paths of the data directories as resource locations
         Ogre::ResourceGroupManager::getSingleton().addResourceLocation(ConfigurablePaths::getDataPathString(), "FileSystem");
@@ -155,4 +164,7 @@
         Loader::getInstance().unload(extResources_.get());
 
+#if OGRE_VERSION >= 0x010900
+        safeObjectDelete(&overlaySystem_);
+#endif
         safeObjectDelete(&ogreRoot_);
         safeObjectDelete(&ogreLogger_);
Index: code/branches/cegui0.8_ogre1.9/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/libraries/core/GraphicsManager.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/libraries/core/GraphicsManager.h	(revision 11795)
@@ -52,4 +52,5 @@
 
 #include "util/DestructionHelper.h"
+#include "util/OgreForwardRefs.h"
 #include "util/Singleton.h"
 #include "config/Configurable.h"
@@ -79,6 +80,7 @@
         void postUpdate(const Clock& time);
 
-        Ogre::Viewport* getViewport()         { return this->viewport_; }
-        Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; }
+        Ogre::Viewport* getViewport()           { return this->viewport_; }
+        Ogre::RenderWindow* getRenderWindow()   { return this->renderWindow_; }
+        Ogre::OverlaySystem* getOverlaySystem() { return this->overlaySystem_; }
         size_t getRenderWindowHandle();
 
@@ -129,4 +131,5 @@
         Ogre::RenderWindow*      renderWindow_;            //!< the one and only render window
         Ogre::Viewport*          viewport_;                //!< default full size viewport
+        Ogre::OverlaySystem*     overlaySystem_;
         GlowMaterialListener*    glowMaterialListener_;    //!< Material Listener for the 'Glow' compositor
         float                    lastFrameStartTime_;      //!< Time stamp of the beginning of the last frame
Index: code/branches/cegui0.8_ogre1.9/src/libraries/util/DisplayStringConversions.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/libraries/util/DisplayStringConversions.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/libraries/util/DisplayStringConversions.h	(revision 11795)
@@ -37,5 +37,10 @@
 
 #include "UtilPrereqs.h"
-#include <OgreOverlayElement.h>
+#include <OgrePrerequisites.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayElement.h>
+#else
+#   include <OgreOverlayElement.h>
+#endif
 
 #if OGRE_UNICODE_SUPPORT
Index: code/branches/cegui0.8_ogre1.9/src/libraries/util/OgreForwardRefs.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/libraries/util/OgreForwardRefs.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/libraries/util/OgreForwardRefs.h	(revision 11795)
@@ -67,5 +67,4 @@
     class Factory;
     class Font;
-    class FontPtr;
     class FontManager;
     struct FrameEvent;
@@ -73,5 +72,4 @@
     class Frustum;
     class GpuProgram;
-    class GpuProgramPtr;
     class GpuProgramManager;
     class GpuProgramUsage;
@@ -82,5 +80,4 @@
     class HardwarePixelBufferSharedPtr;
     class HighLevelGpuProgram;
-    class HighLevelGpuProgramPtr;
     class HighLevelGpuProgramManager;
     class HighLevelGpuProgramFactory;
@@ -96,5 +93,4 @@
     class ManualObject;
     class Material;
-    class MaterialPtr;
     class MaterialManager;
     class MaterialScriptCompiler;
@@ -104,5 +100,4 @@
     class MemoryManager;
     class Mesh;
-    class MeshPtr;
     class MeshSerializer;
     class MeshSerializerImpl;
@@ -120,4 +115,5 @@
     class OverlayElementFactory;
     class OverlayManager;
+    class OverlaySystem;
     class Particle;
     class ParticleAffector;
@@ -179,5 +175,4 @@
     class SimpleSpline;
     class Skeleton;
-    class SkeletonPtr;
     class SkeletonInstance;
     class SkeletonManager;
@@ -195,5 +190,4 @@
     class TextureUnitState;
     class Texture;
-    class TexturePtr;
     class TextureFont;
     class TextureManager;
Index: code/branches/cegui0.8_ogre1.9/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/designtools/ScreenshotManager.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/designtools/ScreenshotManager.cc	(revision 11795)
@@ -101,5 +101,5 @@
         }
         if(!this->tempTexture_.isNull())
-            this->tempTexture_.freeMethod();
+            this->tempTexture_.setNull();
     }
     
Index: code/branches/cegui0.8_ogre1.9/src/modules/hover/FlagHUD.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/hover/FlagHUD.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/hover/FlagHUD.cc	(revision 11795)
@@ -32,7 +32,11 @@
 #include "FlagHUD.h"
 
-#include <OgreOverlayManager.h>
-#include <OgreMaterialManager.h>
-#include <OgrePanelOverlayElement.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 
 #include "util/StringUtils.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/objects/Planet.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/objects/Planet.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/objects/Planet.cc	(revision 11795)
@@ -31,5 +31,4 @@
 #include <OgreEntity.h>
 #include <OgreBillboardSet.h>
-#include <OgreProgressiveMesh.h>
 
 #include "core/CoreIncludes.h"
@@ -47,7 +46,8 @@
      * @brief Constructor
      */
-    Planet::Planet(Context* context) : MovableEntity(context)
+    Planet::Planet(Context* context) : Model(context)
     {
         RegisterObject(Planet);
+        this->setLodEnabled(false);
         this->registerVariables();
     }
@@ -58,6 +58,4 @@
     Planet::~Planet()
     {
-        if (this->isInitialized() && this->mesh_.getEntity())
-            this->detachOgreObject(this->mesh_.getEntity());
     }
 
@@ -87,62 +85,17 @@
     }
 
-    void Planet::changedMesh()
+    void Planet::changedAtmosphere()
     {
         if( GameMode::showsGraphics() )
         {
-            if (this->mesh_.getEntity())
-                this->detachOgreObject(this->mesh_.getEntity());
-
-            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
-
-            if (this->mesh_.getEntity())
+            if (this->getMesh().getEntity())
             {
-                this->attachOgreObject(this->mesh_.getEntity());
-                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
-                this->mesh_.setVisible(this->isVisible());
-
-                float scaleFactor = this->getScale();
-
-#if OGRE_VERSION >= 0x010800
-                Ogre::ProgressiveMesh::LodValueList distList;
-#elif OGRE_VERSION >= 0x010700
-                Ogre::Mesh::LodValueList distList;
-#else
-                Ogre::Mesh::LodDistanceList distList;
-#endif
-
-                distList.push_back(10.0f*scaleFactor);
-                distList.push_back(19.0f*scaleFactor);
-                distList.push_back(27.0f*scaleFactor);
-                distList.push_back(34.0f*scaleFactor);
-                distList.push_back(40.0f*scaleFactor);
-                distList.push_back(45.0f*scaleFactor);
-                distList.push_back(49.0f*scaleFactor);
-                distList.push_back(52.0f*scaleFactor);
-                distList.push_back(54.0f*scaleFactor);
-                distList.push_back(55.0f*scaleFactor);
-
-                float reductionValue = 0.2f;
-
-#if OGRE_VERSION >= 0x010800
-                Ogre::ProgressiveMesh::generateLodLevels(this->mesh_.getEntity()->getMesh().get(), distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL,
-                    reductionValue);
-#else
-                this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
-#endif
-                billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
+                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
 
                 this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
-                this->setCastShadows(true);
-                this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
-                this->mesh_.setCastShadows(true);
+                this->billboard_.getBillboardSet()->setRenderQueueGroup(this->getMesh().getEntity()->getRenderQueueGroup());
             }
         }
-    }
-
-    void Planet::changedShadows()
-    {
-        this->mesh_.setCastShadows(this->bCastShadows_);
     }
 
@@ -154,16 +107,11 @@
         XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);
         XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);
-        XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
-        XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     }
 
     void Planet::registerVariables()
     {
-        registerVariable(this->atmosphere_, VariableDirection::ToClient);
+        registerVariable(this->atmosphere_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedAtmosphere));
         registerVariable(this->atmosphereSize, VariableDirection::ToClient);
         registerVariable(this->imageSize, VariableDirection::ToClient);
-        // Note: the meshSrc should be synchronised after atmosphere and other values, because the meshSrc callback setts the atmosphere billboards
-        registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
-        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
     }
 
@@ -171,9 +119,6 @@
     {
         SUPER(Planet, changedVisibility);
-        if (this->isInitialized())
-        {
-            this->mesh_.setVisible(this->isVisible());
-            this->billboard_.setVisible(this->isVisible());
-        }
+
+        this->billboard_.setVisible(this->isVisible());
     }
 }
Index: code/branches/cegui0.8_ogre1.9/src/modules/objects/Planet.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/objects/Planet.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/objects/Planet.h	(revision 11795)
@@ -40,10 +40,10 @@
 #include <string>
 #include "tools/BillboardSet.h"
-#include "tools/Mesh.h"
-#include "worldentities/MovableEntity.h"
+#include "tools/interfaces/Tickable.h"
+#include "graphics/Model.h"
 
 namespace orxonox
 {
-    class _ObjectsExport Planet : public MovableEntity
+    class _ObjectsExport Planet : public Model, public Tickable
     {
         public:
@@ -58,20 +58,4 @@
             virtual void changedVisibility() override;
 
-            inline void setMeshSource(const std::string& meshname)
-                { this->meshSrc_ = meshname; this->changedMesh(); }
-
-            inline const std::string& getMeshSource() const
-                { return this->meshSrc_; }
-
-            inline void setCastShadows(bool bCastShadows)
-                { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
-
-            inline bool getCastShadows() const
-                { return this->bCastShadows_; }
-
-            inline const std::string& getMesh() const{
-                return this->meshSrc_;
-            }
-
             inline void setAtmosphereSize(float size){
                 this->atmosphereSize = size;
@@ -84,4 +68,5 @@
             inline void setAtmosphere(const std::string& atmosphere){
                 this->atmosphere_ = atmosphere;
+                this->changedAtmosphere();
             }
 
@@ -103,14 +88,10 @@
             void registerVariables();
 
-            void changedMesh();
-            void changedShadows();
+            void changedAtmosphere();
 
-            std::string meshSrc_;
             std::string atmosphere_;
-            Mesh mesh_;
             float atmosphereSize;
             float imageSize;
             BillboardSet billboard_;
-            bool bCastShadows_;
 
     };
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/FadeoutText.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/FadeoutText.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/FadeoutText.cc	(revision 11795)
@@ -29,5 +29,9 @@
 #include "FadeoutText.h"
 
-#include <OgreTextAreaOverlayElement.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreTextAreaOverlayElement.h>
+#else
+#   include <OgreTextAreaOverlayElement.h>
+#endif
 #include "util/Math.h"
 #include "core/CoreIncludes.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/OverlayText.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/OverlayText.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/OverlayText.cc	(revision 11795)
@@ -29,7 +29,13 @@
 #include "OverlayText.h"
 
-#include <OgreOverlayManager.h>
-#include <OgrePanelOverlayElement.h>
-#include <OgreTextAreaOverlayElement.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#   include <Overlay/OgreTextAreaOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#   include <OgreTextAreaOverlayElement.h>
+#endif
 
 #include "util/StringUtils.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/ChatOverlay.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/ChatOverlay.cc	(revision 11795)
@@ -30,5 +30,10 @@
 
 #include <string>
-#include <OgreTextAreaOverlayElement.h>
+
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreTextAreaOverlayElement.h>
+#else
+#   include <OgreTextAreaOverlayElement.h>
+#endif
 
 #include "util/Convert.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/ChatOverlay.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/ChatOverlay.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/ChatOverlay.h	(revision 11795)
@@ -33,5 +33,11 @@
 
 #include <list>
-#include <OgreOverlayElement.h>
+
+#include <OgrePrerequisites.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayElement.h>
+#else
+#   include <OgreOverlayElement.h>
+#endif
 
 #include "chat/ChatListener.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDBar.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDBar.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDBar.cc	(revision 11795)
@@ -32,9 +32,15 @@
 #include "HUDBar.h"
 
-#include <OgreOverlayManager.h>
 #include <OgreMaterialManager.h>
 #include <OgreTechnique.h>
 #include <OgrePass.h>
-#include <OgrePanelOverlayElement.h>
+
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 
 #include "util/Convert.h"
@@ -248,3 +254,13 @@
         return this->icon_->getMaterialName();
     }
+
+    void HUDBar::setIconPosition(Vector2 position)
+    {
+        this->icon_->setPosition(position.x, position.y);
+    }
+
+    void HUDBar::setIconDimensions(Vector2 dimensions)
+    {
+        this->icon_->setDimensions(dimensions.x, dimensions.y);
+    }
 }
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDBar.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDBar.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDBar.h	(revision 11795)
@@ -37,5 +37,4 @@
 #include <map>
 #include <vector>
-#include <OgrePanelOverlayElement.h>
 
 #include "util/Math.h"
@@ -122,8 +121,6 @@
             { return this->currentColour_; }
 
-        inline void setIconPosition(Vector2 position)
-            { this->icon_->setPosition(position.x, position.y); }
-        inline void setIconDimensions(Vector2 dimensions)
-            { this->icon_->setDimensions(dimensions.x, dimensions.y); }
+        void setIconPosition(Vector2 position);
+        void setIconDimensions(Vector2 dimensions);
 
     protected:
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDNavigation.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDNavigation.cc	(revision 11795)
@@ -32,8 +32,16 @@
 
 #include <OgreCamera.h>
-#include <OgreFontManager.h>
-#include <OgreOverlayManager.h>
-#include <OgreTextAreaOverlayElement.h>
-#include <OgrePanelOverlayElement.h>
+
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreFontManager.h>
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgreTextAreaOverlayElement.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreFontManager.h>
+#   include <OgreOverlayManager.h>
+#   include <OgreTextAreaOverlayElement.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 
 #include <typeinfo>
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDRadar.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDRadar.cc	(revision 11795)
@@ -31,6 +31,11 @@
 #include "HUDRadar.h"
 
-#include <OgreOverlayManager.h>
-#include <OgrePanelOverlayElement.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 
 #include "util/Math.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.cc	(revision 11795)
@@ -28,4 +28,12 @@
 
 #include "HUDWeapon.h"
+
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 
 #include "core/CoreIncludes.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeapon.h	(revision 11795)
@@ -35,7 +35,4 @@
 #include <vector>
 #include <string>
-
-#include <OgreOverlayManager.h>
-#include <OgrePanelOverlayElement.h> 
 
 #include "overlays/OrxonoxOverlay.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeaponMode.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeaponMode.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeaponMode.cc	(revision 11795)
@@ -28,4 +28,12 @@
 
 #include "HUDWeaponMode.h"
+
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 
 #include "util/Convert.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeaponMode.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeaponMode.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/hud/HUDWeaponMode.h	(revision 11795)
@@ -36,7 +36,4 @@
 #include <vector>
 #include <string>
-
-#include <OgreOverlayManager.h>
-#include <OgrePanelOverlayElement.h> 
 
 #include "overlays/OrxonoxOverlay.h"
Index: code/branches/cegui0.8_ogre1.9/src/modules/overlays/stats/Stats.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/modules/overlays/stats/Stats.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/modules/overlays/stats/Stats.cc	(revision 11795)
@@ -30,6 +30,12 @@
 
 #include <string>
-#include <OgreOverlayManager.h>
-#include <OgreBorderPanelOverlayElement.h>
+
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgreBorderPanelOverlayElement.h>
+#else
+#   include <OgreOverlayManager.h>
+#   include <OgreBorderPanelOverlayElement.h>
+#endif
 
 #include "util/StringUtils.h"
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/CMakeLists.txt	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/CMakeLists.txt	(revision 11795)
@@ -71,4 +71,5 @@
   LINK_LIBRARIES
     ${OGRE_LIBRARY}
+    ${OGRE_OVERLAY_LIBRARY}
     ${CEGUI}
     ${LUA5.1_LIBRARY}
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/RenderQueueListener.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/RenderQueueListener.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/RenderQueueListener.cc	(revision 11795)
@@ -83,4 +83,7 @@
             renderSystem->setStencilBufferParams(Ogre::CMPF_ALWAYS_PASS,
                 STENCIL_VALUE_FOR_GLOW, STENCIL_FULL_MASK, 
+#if OGRE_VERSION >= 0x010900
+                STENCIL_FULL_MASK,
+#endif
                 Ogre::SOP_KEEP,Ogre::SOP_KEEP,Ogre::SOP_REPLACE,false);       
         } 
@@ -91,4 +94,7 @@
             renderSystem->setStencilBufferParams(Ogre::CMPF_NOT_EQUAL,
                 STENCIL_VALUE_FOR_GLOW, STENCIL_FULL_MASK, 
+#if OGRE_VERSION >= 0x010900
+                STENCIL_FULL_MASK,
+#endif
                 Ogre::SOP_KEEP,Ogre::SOP_KEEP,Ogre::SOP_REPLACE,false);       
         }
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/Scene.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/Scene.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/Scene.cc	(revision 11795)
@@ -40,4 +40,7 @@
 #include <OgreSceneManagerEnumerator.h>
 #include <OgreSceneNode.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlaySystem.h>
+#endif
 
 #include <BulletCollision/BroadphaseCollision/btAxisSweep3.h>
@@ -90,4 +93,7 @@
             this->renderQueueListener_ = new RenderQueueListener();
             this->sceneManager_->addRenderQueueListener(this->renderQueueListener_);//add our own renderQueueListener
+#if OGRE_VERSION >= 0x010900
+            this->sceneManager_->addRenderQueueListener(GraphicsManager::getInstance().getOverlaySystem());
+#endif
 
             this->radar_ = new Radar();
@@ -134,4 +140,7 @@
             if (GameMode::showsGraphics())
             {
+#if OGRE_VERSION >= 0x010900
+                this->sceneManager_->removeRenderQueueListener(GraphicsManager::getInstance().getOverlaySystem());
+#endif
                 this->sceneManager_->removeRenderQueueListener(this->renderQueueListener_);
                 delete this->renderQueueListener_;
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/chat/ChatInputHandler.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/chat/ChatInputHandler.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/chat/ChatInputHandler.cc	(revision 11795)
@@ -131,15 +131,32 @@
     /* GET WINDOW POINTERS */
 #if CEGUI_VERSION >= 0x000800
-    input = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox/input" );
-    inputonly = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox-inputonly/input" );
-    CEGUI::Window *history = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox/history" );
+    //input = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "ChatBox/input" );
+    //const CEGUI::Window* root = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild("MenuRootWindow");
+    //std::cout << "Count: " << root->getChildCount() << std::endl;
+    //for (int i = 0; i < root->getChildCount(); ++i) {
+    //	std::cout << "Child: " << root->getChildAtIdx(i)->getName() << std::endl;
+    //}
+    for (auto iterator = CEGUI::WindowManager::getSingleton().getIterator(); !iterator.isAtEnd(); iterator++) {
+    	CEGUI::Window* currentWindow = iterator.getCurrentValue();
+    	if (currentWindow->getName().compare("ChatBox") == 0) {
+    		input = currentWindow->getChild("frame")->getChild("input");
+    		CEGUI::Window* history = currentWindow->getChild("frame")->getChild("history");
+    		lb_history = dynamic_cast<CEGUI::Listbox*>(history);
+    	} else if (currentWindow->getName().compare("ChatBox-inputonly") == 0) {
+    		inputonly = currentWindow->getChild("input");
+    	}
+    }
+
+    //input = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "ChatBox" )->getChild("frame")->getChild("input");
+    //inputonly = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox-inputonly/input" );
+    //CEGUI::Window *history = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox/history" );
 #else
     input = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/input" );
     inputonly = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox-inputonly/input" );
     CEGUI::Window *history = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/history" );
-#endif
 
     /* cast it to a listbox */
     lb_history = dynamic_cast<CEGUI::Listbox*>(history);
+#endif
 
     /* assert wee */
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/controllers/NewHumanController.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/controllers/NewHumanController.cc	(revision 11795)
@@ -397,5 +397,10 @@
                 try
                 {
-                    wePtr = orxonox_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny()));
+#if OGRE_VERSION >= 0x010900
+                    const Ogre::Any& any = itr->movable->getUserObjectBindings().getUserAny();
+#else
+                    const Ogre::Any& any = itr->movable->getUserAny();
+#endif
+                    wePtr = orxonox_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(any));
                 }
                 catch (...)
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/AnimatedModel.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/AnimatedModel.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/AnimatedModel.cc	(revision 11795)
@@ -49,6 +49,6 @@
     AnimatedModel::~AnimatedModel()
     {
-        if (this->isInitialized() && this->mesh_.getEntity())
-            this->detachOgreObject(this->mesh_.getEntity());
+        if (this->isInitialized() && this->getMesh().getEntity())
+            this->detachOgreObject(this->getMesh().getEntity());
     }
 
@@ -66,15 +66,15 @@
         if (GameMode::showsGraphics())
         {
-            if (this->mesh_.getEntity())
-                this->detachOgreObject(this->mesh_.getEntity());
+            if (this->getMesh().getEntity())
+                this->detachOgreObject(this->getMesh().getEntity());
 
-            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+            this->getMesh().setMeshSource(this->getScene()->getSceneManager(), this->getMeshSource());
 
-            if (this->mesh_.getEntity())
+            if (this->getMesh().getEntity())
             {
-                this->attachOgreObject(this->mesh_.getEntity());
-                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+                this->attachOgreObject(this->getMesh().getEntity());
+                this->getMesh().getEntity()->setCastShadows(this->getCastShadows());
                 this->setAnimationState(this->bAnimLoop_, this->bAnimEnabled_, this->anims_);
-                this->mesh_.setVisible(this->isVisible());
+                this->getMesh().setVisible(this->isVisible());
             }
         }
@@ -89,7 +89,7 @@
         if(state!="")
         {
-        if(this->mesh_.getEntity()->getAnimationState(state))
+        if(this->getMesh().getEntity()->getAnimationState(state))
         {
-        Ogre::AnimationState* as = this->mesh_.getEntity()->getAnimationState(state);
+        Ogre::AnimationState* as = this->getMesh().getEntity()->getAnimationState(state);
         as->setLoop(loop);
         as->setEnabled(enabled);
@@ -109,9 +109,9 @@
     void AnimatedModel::tick(float dt)
     {
-        if(this->mesh_.getEntity()->getAnimationState(anims_))
+        if(this->getMesh().getEntity()->getAnimationState(anims_))
         {
 // Test to change Material at runtime!
 
-//            Ogre::MaterialPtr mat = this->mesh_.getEntity()->getSubEntity(0)->getMaterial();
+//            Ogre::MaterialPtr mat = this->getMesh().getEntity()->getSubEntity(0)->getMaterial();
 //            mat->setDiffuse(0.4, 0.3, 0.1, 0.1);
 //            mat->setAmbient(0.3, 0.7, 0.8);
@@ -121,5 +121,5 @@
 //            mat->setSceneBlending(sbt);
 
-            Ogre::AnimationState* as = this->mesh_.getEntity()->getAnimationState(anims_);
+            Ogre::AnimationState* as = this->getMesh().getEntity()->getAnimationState(anims_);
             as->addTime(dt);
     }
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Camera.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Camera.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Camera.cc	(revision 11795)
@@ -62,5 +62,10 @@
 
         this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
-        static_cast<Ogre::MovableObject*>(this->camera_)->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
+        Ogre::MovableObject* movable = static_cast<Ogre::MovableObject*>(this->camera_);
+#if OGRE_VERSION >= 0x010900
+        movable->getUserObjectBindings().setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
+#else
+        movable->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
+#endif
         this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
         this->attachNode(this->cameraNode_);
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Model.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Model.cc	(revision 11795)
@@ -30,5 +30,10 @@
 
 #include <OgreEntity.h>
-#include <OgreProgressiveMesh.h>
+#if OGRE_VERSION >= 0x010900
+#   include <OgreProgressiveMeshGenerator.h>
+#   include <OgreDistanceLodStrategy.h>
+#else
+#   include <OgreProgressiveMesh.h>
+#endif
 
 #include "core/CoreIncludes.h"
@@ -203,19 +208,9 @@
             {
                 float volume = this->mesh_.getEntity()->getBoundingBox().volume();
-/*
-                float scaleFactor = 1;
-
-                BaseObject* creatorPtr = this;
-
-                while(creatorPtr!=nullptr&&orxonox_cast<WorldEntity*>(creatorPtr))
-                {
-                    scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
-                    creatorPtr = creatorPtr->getCreator();
-                }
-                orxout() << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
-*/
                 orxout(verbose, context::lod) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << endl;
 
-#if OGRE_VERSION >= 0x010800
+#if OGRE_VERSION >= 0x010900
+                Ogre::LodConfig::LodLevelList distList;
+#elif OGRE_VERSION >= 0x010800
                 Ogre::ProgressiveMesh::LodValueList distList;
 #elif OGRE_VERSION >= 0x010700
@@ -227,19 +222,18 @@
                 if( lodLevel_>0 )
                 {
-//                    float factor = scaleFactor*5/lodLevel_;
                     float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_;
 
                     orxout(verbose, context::lod) << "LodLevel set with factor: " << factor << endl;
 
-                    distList.push_back(70.0f*factor);
-                    distList.push_back(140.0f*factor);
-                    distList.push_back(170.0f*factor);
-                    distList.push_back(200.0f*factor);
-                    distList.push_back(230.0f*factor);
-                    distList.push_back(250.0f*factor);
-                    distList.push_back(270.0f*factor);
-                    distList.push_back(290.0f*factor);
-                    distList.push_back(310.0f*factor);
-                    distList.push_back(330.0f*factor);
+                    addLodDistanceToList(distList, 70.0f*factor);
+                    addLodDistanceToList(distList, 140.0f*factor);
+                    addLodDistanceToList(distList, 170.0f*factor);
+                    addLodDistanceToList(distList, 200.0f*factor);
+                    addLodDistanceToList(distList, 230.0f*factor);
+                    addLodDistanceToList(distList, 250.0f*factor);
+                    addLodDistanceToList(distList, 270.0f*factor);
+                    addLodDistanceToList(distList, 290.0f*factor);
+                    addLodDistanceToList(distList, 310.0f*factor);
+                    addLodDistanceToList(distList, 330.0f*factor);
                     while(distList.size()>this->numLodLevels_)
                         distList.pop_back();
@@ -247,5 +241,13 @@
 
                     //Generiert LOD-Levels
-#if OGRE_VERSION >= 0x010800
+#if OGRE_VERSION >= 0x010900
+                    Ogre::LodConfig config;
+                    config.mesh = this->mesh_.getEntity()->getMesh();
+                    config.levels = distList;
+                    config.strategy = Ogre::DistanceLodSphereStrategy::getSingletonPtr();
+
+                    Ogre::ProgressiveMeshGenerator generator;
+                    generator.generateLodLevels(config);
+#elif OGRE_VERSION >= 0x010800
                     Ogre::ProgressiveMesh::generateLodLevels(this->mesh_.getEntity()->getMesh().get(), distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL,
                         this->lodReductionRate_);
@@ -270,3 +272,13 @@
 #endif
     }
+
+    template <class T>
+    void Model::addLodDistanceToList(T& list, float distance)
+    {
+#if OGRE_VERSION >= 0x010900
+        list.push_back({distance, Ogre::LodLevel::VRM_COLLAPSE_COST, this->lodReductionRate_, 0, false});
+#else
+        list.push_back(distance);
+#endif
+    }
 }
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Model.h	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/graphics/Model.h	(revision 11795)
@@ -89,4 +89,11 @@
 
         protected:
+            inline Mesh& getMesh()
+                { return this->mesh_; }
+
+            inline void setLodEnabled(bool bLodEnabled)
+                { this->bLodEnabled_ = bLodEnabled; }
+
+        private:
             /**
             @brief
@@ -108,4 +115,7 @@
             //LoD
             void enableLod();
+
+            template <class T>
+            void addLodDistanceToList(T& list, float distance);
 
             inline void setLodLevel(float lodLevel)
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/overlays/InGameConsole.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/overlays/InGameConsole.cc	(revision 11795)
@@ -32,12 +32,24 @@
 #include <algorithm>
 #include <string>
-#include <OgreOverlay.h>
-#include <OgreOverlayElement.h>
-#include <OgreOverlayManager.h>
-#include <OgreOverlayContainer.h>
-#include <OgreBorderPanelOverlayElement.h>
-#include <OgreTextAreaOverlayElement.h>
-#include <OgreFontManager.h>
-#include <OgreFont.h>
+#include <OgrePrerequisites.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlay.h>
+#   include <Overlay/OgreOverlayElement.h>
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgreOverlayContainer.h>
+#   include <Overlay/OgreBorderPanelOverlayElement.h>
+#   include <Overlay/OgreTextAreaOverlayElement.h>
+#   include <Overlay/OgreFontManager.h>
+#   include <Overlay/OgreFont.h>
+#else
+#   include <OgreOverlay.h>
+#   include <OgreOverlayElement.h>
+#   include <OgreOverlayManager.h>
+#   include <OgreOverlayContainer.h>
+#   include <OgreBorderPanelOverlayElement.h>
+#   include <OgreTextAreaOverlayElement.h>
+#   include <OgreFontManager.h>
+#   include <OgreFont.h>
+#endif
 
 #include "util/Clock.h"
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 11795)
@@ -35,7 +35,13 @@
 
 #include <cmath>
-#include <OgreOverlay.h>
-#include <OgreOverlayManager.h>
-#include <OgrePanelOverlayElement.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlay.h>
+#   include <Overlay/OgreOverlayManager.h>
+#   include <Overlay/OgrePanelOverlayElement.h>
+#else
+#   include <OgreOverlay.h>
+#   include <OgreOverlayManager.h>
+#   include <OgrePanelOverlayElement.h>
+#endif
 #include <OgreRenderWindow.h>
 #include <OgreMaterialManager.h>
Index: code/branches/cegui0.8_ogre1.9/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/cegui0.8_ogre1.9/src/orxonox/worldentities/WorldEntity.cc	(revision 11787)
+++ code/branches/cegui0.8_ogre1.9/src/orxonox/worldentities/WorldEntity.cc	(revision 11795)
@@ -548,5 +548,9 @@
     {
         this->node_->attachObject(object);
+#if OGRE_VERSION >= 0x010900
+        object->getUserObjectBindings().setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
+#else
         object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
+#endif
     }
 
@@ -563,5 +567,9 @@
     void WorldEntity::detachOgreObject(Ogre::MovableObject* object)
     {
+#if OGRE_VERSION >= 0x010900
+        object->getUserObjectBindings().setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(nullptr)));
+#else
         object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(nullptr)));
+#endif
         this->node_->detachObject(object);
     }
