[Orxonox-commit 6485] r11132 - in code/branches/ogre1.9/src: libraries/core orxonox

landauf at orxonox.net landauf at orxonox.net
Sun Mar 6 21:18:13 CET 2016


Author: landauf
Date: 2016-03-06 21:18:13 +0100 (Sun, 06 Mar 2016)
New Revision: 11132

Modified:
   code/branches/ogre1.9/src/libraries/core/CMakeLists.txt
   code/branches/ogre1.9/src/libraries/core/GraphicsManager.cc
   code/branches/ogre1.9/src/libraries/core/GraphicsManager.h
   code/branches/ogre1.9/src/orxonox/Scene.cc
   code/branches/ogre1.9/src/orxonox/Scene.h
Log:
fixed overlays with ogre 1.9.
OverlaySystem must be initialized once after ogre-root and connected as listener to every (?) scene manager

Modified: code/branches/ogre1.9/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/ogre1.9/src/libraries/core/CMakeLists.txt	2016-03-06 15:43:02 UTC (rev 11131)
+++ code/branches/ogre1.9/src/libraries/core/CMakeLists.txt	2016-03-06 20:18:13 UTC (rev 11132)
@@ -99,6 +99,7 @@
     CorePrecompiledHeaders.h
   LINK_LIBRARIES
     ${OGRE_LIBRARY}
+    ${OGRE_OVERLAY_LIBRARY}
     ${Boost_FILESYSTEM_LIBRARY}
     ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
     ${Boost_THREAD_LIBRARY}

Modified: code/branches/ogre1.9/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/ogre1.9/src/libraries/core/GraphicsManager.cc	2016-03-06 15:43:02 UTC (rev 11131)
+++ code/branches/ogre1.9/src/libraries/core/GraphicsManager.cc	2016-03-06 20:18:13 UTC (rev 11132)
@@ -44,6 +44,9 @@
 #include <OgreTextureManager.h>
 #include <OgreViewport.h>
 #include <OgreWindowEventUtilities.h>
+#if OGRE_VERSION >= 0x010900
+#   include <Overlay/OgreOverlaySystem.h>
+#endif
 
 #include "SpecialConfig.h"
 #include "util/Clock.h"
@@ -114,6 +117,12 @@
         // Ogre setup procedure (creating Ogre::Root)
         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");
         // Load resources
@@ -154,6 +163,9 @@
         Loader::getInstance().unload(resources_.get());
         Loader::getInstance().unload(extResources_.get());
 
+#if OGRE_VERSION >= 0x010900
+        safeObjectDelete(&overlaySystem_);
+#endif
         safeObjectDelete(&ogreRoot_);
         safeObjectDelete(&ogreLogger_);
         safeObjectDelete(&ogreWindowEventListener_);

Modified: code/branches/ogre1.9/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/ogre1.9/src/libraries/core/GraphicsManager.h	2016-03-06 15:43:02 UTC (rev 11131)
+++ code/branches/ogre1.9/src/libraries/core/GraphicsManager.h	2016-03-06 20:18:13 UTC (rev 11132)
@@ -51,6 +51,7 @@
 #include <OgreLog.h>
 
 #include "util/DestructionHelper.h"
+#include "util/OgreForwardRefs.h"
 #include "util/Singleton.h"
 #include "config/Configurable.h"
 
@@ -78,8 +79,9 @@
 
         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();
 
 // tolua_begin
@@ -128,6 +130,7 @@
         Ogre::Root*              ogreRoot_;                //!< Ogre's root
         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
         float                    lastFrameEndTime_;        //!< Time stamp of the end of the last frame

Modified: code/branches/ogre1.9/src/orxonox/Scene.cc
===================================================================
--- code/branches/ogre1.9/src/orxonox/Scene.cc	2016-03-06 15:43:02 UTC (rev 11131)
+++ code/branches/ogre1.9/src/orxonox/Scene.cc	2016-03-06 20:18:13 UTC (rev 11132)
@@ -93,8 +93,7 @@
             this->renderQueueListener_ = new RenderQueueListener();
             this->sceneManager_->addRenderQueueListener(this->renderQueueListener_);//add our own renderQueueListener
 #if OGRE_VERSION >= 0x010900
-            this->overlaySystem_ = new Ogre::OverlaySystem();
-            this->sceneManager_->addRenderQueueListener(this->overlaySystem_);
+            this->sceneManager_->addRenderQueueListener(GraphicsManager::getInstance().getOverlaySystem());
 #endif
 
             this->radar_ = new Radar();
@@ -141,8 +140,7 @@
             if (GameMode::showsGraphics())
             {
 #if OGRE_VERSION >= 0x010900
-                this->sceneManager_->removeRenderQueueListener(this->overlaySystem_);
-                delete this->overlaySystem_;
+                this->sceneManager_->removeRenderQueueListener(GraphicsManager::getInstance().getOverlaySystem());
 #endif
                 this->sceneManager_->removeRenderQueueListener(this->renderQueueListener_);
                 delete this->renderQueueListener_;

Modified: code/branches/ogre1.9/src/orxonox/Scene.h
===================================================================
--- code/branches/ogre1.9/src/orxonox/Scene.h	2016-03-06 15:43:02 UTC (rev 11131)
+++ code/branches/ogre1.9/src/orxonox/Scene.h	2016-03-06 20:18:13 UTC (rev 11132)
@@ -110,7 +110,6 @@
             Ogre::SceneManager*      sceneManager_; //!< This is a pointer to the Ogre SceneManager we're using to render the Scene
             Ogre::SceneNode*         rootSceneNode_; //!< This is a pointer to the root node of the Scene tree
             RenderQueueListener*     renderQueueListener_; //!< this is a pointer to the RenderQueueListener we're using for this Scene
-            Ogre::OverlaySystem*     overlaySystem_;
 
             std::string              skybox_; //!< This string holds information about the skybox we're using
             ColourValue              ambientLight_; //!< This variable holds the color value for the ambient light in our scene, usually black in space




More information about the Orxonox-commit mailing list