From ef1364878fc98876726759911a18b97ee5b6965e Mon Sep 17 00:00:00 2001
From: Marc Zinnschlag <marc@zpages.de>
Date: Mon, 10 Mar 2014 18:35:49 +0100
Subject: [PATCH] moved test cube from SceneWidget to WorldspaceWidget

---
 apps/opencs/view/render/scenewidget.cpp      | 10 +++++-----
 apps/opencs/view/render/scenewidget.hpp      |  2 ++
 apps/opencs/view/render/worldspacewidget.cpp | 11 ++++++++++-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp
index 31d5d0318..7b790fd58 100644
--- a/apps/opencs/view/render/scenewidget.cpp
+++ b/apps/opencs/view/render/scenewidget.cpp
@@ -45,11 +45,6 @@ namespace CSVRender
 
         mCamera = mSceneMgr->createCamera("foo");
 
-        Ogre::Entity* ent = mSceneMgr->createEntity("cube", Ogre::SceneManager::PT_CUBE);
-        ent->setMaterialName("BaseWhite");
-
-        mSceneMgr->getRootSceneNode()->attachObject(ent);
-
         mCamera->setPosition(300,300,300);
         mCamera->lookAt(0,0,0);
         mCamera->setNearClipDistance(0.1);
@@ -118,6 +113,11 @@ namespace CSVRender
         }
     }
 
+    Ogre::SceneManager *SceneWidget::getSceneManager()
+    {
+        return mSceneMgr;
+    }
+
     void SceneWidget::paintEvent(QPaintEvent* e)
     {
         if (!mWindow)
diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp
index ad68897ac..05b06b287 100644
--- a/apps/opencs/view/render/scenewidget.hpp
+++ b/apps/opencs/view/render/scenewidget.hpp
@@ -34,6 +34,8 @@ namespace CSVRender
             void setNavigation (Navigation *navigation);
             ///< \attention The ownership of \a navigation is not transferred to *this.
 
+            Ogre::SceneManager *getSceneManager();
+
         private:
             void paintEvent(QPaintEvent* e);
             void resizeEvent(QResizeEvent* e);
diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp
index dcd152bb3..9959c5a67 100644
--- a/apps/opencs/view/render/worldspacewidget.cpp
+++ b/apps/opencs/view/render/worldspacewidget.cpp
@@ -1,11 +1,20 @@
 
 #include "worldspacewidget.hpp"
 
+#include <OgreSceneNode.h>
+#include <OgreSceneManager.h>
+#include <OgreEntity.h>
+
 #include "../world/scenetoolmode.hpp"
 
 CSVRender::WorldspaceWidget::WorldspaceWidget (QWidget *parent)
 : SceneWidget (parent)
-{}
+{
+    Ogre::Entity* ent = getSceneManager()->createEntity("cube", Ogre::SceneManager::PT_CUBE);
+    ent->setMaterialName("BaseWhite");
+
+    getSceneManager()->getRootSceneNode()->attachObject(ent);
+}
 
 void CSVRender::WorldspaceWidget::selectNavigationMode (const std::string& mode)
 {