Index: trunk/VUT/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj	(revision 17)
+++ trunk/VUT/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj	(revision 18)
@@ -20,5 +20,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="$(OGRE_PATH)\Samples\Common\include; ..\include; $(OGRE_PATH)\OgreMain\include"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS"
 				MinimalRebuild="TRUE"
@@ -35,10 +35,10 @@
 				Name="VCLinkerTool"
 				IgnoreImportLibrary="TRUE"
-				AdditionalDependencies="OgreMain_d.lib"
+				AdditionalDependencies="OgreMain_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib"
 				OutputFile="$(OutDir)/Plugin_OcclusionCullingSceneManager.dll"
 				Version="0.99"
 				LinkIncremental="2"
 				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				ModuleDefinitionFile="..\misc\OgreOcclusionCullingSceneManager.def"
 				GenerateDebugInformation="TRUE"
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp	(revision 16)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp	(revision 18)
@@ -26,5 +26,5 @@
 #include "OgreOcclusionCullingSceneManager.h"
 #include "OgreRoot.h"
-#include <windows.h>
+//#include <windows.h>
 
 namespace Ogre {
@@ -38,8 +38,7 @@
 		
 		// Register
-        Root::getSingleton().setSceneManager(ST_INTERIOR, occlusionPlugin);
-		//Root::getSingleton().setSceneManager(ST_GENERIC, occlusionPlugin);
-
-		MessageBox( NULL, "myplugin registered", "this is my plugin", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+        Root::getSingleton().setSceneManager(ST_GENERIC, occlusionPlugin);
+		
+		//MessageBox( NULL, "myplugin registered", "this is my plugin", MB_OK | MB_ICONERROR | MB_TASKMODAL);
     }
     extern "C" void dllStopPlugin(void)
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp	(revision 16)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp	(revision 18)
@@ -15,6 +15,7 @@
 	void OcclusionCullingSceneManager::_renderVisibleObjects(void)
 	{
+		//RenderZPass();
 		SceneManager::_renderVisibleObjects();
-		//mDistanceQueue.push(mSceneRoot);
+        //mDistanceQueue.push(mSceneRoot);
 		//Preprocess();
 		//printf("registered my plugin!!\n");
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj	(revision 17)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj	(revision 18)
@@ -21,5 +21,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="$(OGRE_PATH)\Samples\Common\Include, D:\ogrenew\OgreMain\include"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;"
 				PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_DEBUG,WIN32,_STLP_DEBUG"
 				MinimalRebuild="TRUE"
@@ -34,8 +34,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="OGREMain_d.LIB"
+				AdditionalDependencies="OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib"
 				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="$(OGRE_PATH)\OgreMain\Lib\Debug"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/TestCulling.pdb"
@@ -128,4 +128,7 @@
 			Filter="h;hpp;hxx;hm;inl;inc;xsd"
 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\TestCullingApplication.h">
+			</File>
 		</Filter>
 		<Filter
@@ -133,7 +136,4 @@
 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-			<File
-				RelativePath=".\TestCullingApplication.h">
-			</File>
 		</Filter>
 	</Files>
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 16)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 18)
@@ -6,4 +6,20 @@
 */
 
+#include <CEGUI/CEGUIImageset.h>
+#include <CEGUI/CEGUISystem.h>
+#include <CEGUI/CEGUISchemeManager.h>
+#include <CEGUI/CEGUIWindowManager.h>
+#include <CEGUI/CEGUIWindow.h>
+#include <CEGUI/CEGUILogger.h>
+#include <CEGUI/elements/CEGUICombobox.h>
+#include <CEGUI/elements/CEGUIListbox.h>
+#include <CEGUI/elements/CEGUIListboxTextItem.h>
+#include <CEGUI/elements/CEGUIPushButton.h>
+#include <CEGUI/elements/CEGUIScrollbar.h>
+#include <CEGUI/elements/CEGUIStaticImage.h>
+
+#include "OgreCEGUIRenderer.h"
+#include "OgreCEGUIResourceProvider.h"
+
 #include "Ogre.h"
 #include "TestCullingApplication.h"
@@ -11,5 +27,4 @@
 #define WIN32_LEAN_AND_MEAN
 #include "windows.h"
-
 
 void TestCullingApplication::createScene(void)
@@ -22,5 +37,83 @@
 
 	 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
+
+	 // CEGUI setup
+     mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_GENERIC);
+     mGUISystem = new CEGUI::System(mGUIRenderer);
+
+	 // Mouse
+     CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");
+     CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
+	 mGUISystem->setDefaultMouseCursor(
+                (CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
+
+	 CEGUI::MouseCursor::getSingleton().show( );
+     
+	/* CEGUI::Window* sheet = 
+            CEGUI::WindowManager::getSingleton().loadWindowLayout(
+                (CEGUI::utf8*)"ogregui.layout"); 
+
+     mGUISystem->setGUISheet(sheet);*/
 }
+
+
+/* MouseMotionListener callbacks */
+void MouseQueryListener::mouseMoved (MouseEvent *e)
+{
+	// Update CEGUI with the mouse motion
+    CEGUI::System::getSingleton().injectMouseMove(e->getRelX() * mGUIRenderer->getWidth(), e->getRelY() * mGUIRenderer->getHeight());
+}
+
+
+void MouseQueryListener::mousePressed(MouseEvent* e)
+{
+     // Left mouse button down
+     if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+     {
+		 CEGUI::MouseCursor::getSingleton().hide( );
+		 mLMouseDown = true;
+     } // if
+     // Right mouse button down
+     else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+     {
+         CEGUI::MouseCursor::getSingleton().hide( );
+         mRMouseDown = true;
+     } // else if
+} // mousePressed
+
+ 
+void MouseQueryListener::mouseReleased(MouseEvent* e)
+{
+    // Left mouse button up
+    if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+    {
+		CEGUI::MouseCursor::getSingleton().show( );
+        mLMouseDown = false;
+    } // if
+    // Right mouse button up
+    else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+    {
+        CEGUI::MouseCursor::getSingleton().show( );
+        mRMouseDown = false;
+    } // else if
+} // mouseReleased
+
+
+ // This is when the mouse is clicked, held and dragged.
+void MouseQueryListener::mouseDragged (MouseEvent *e)
+ {
+     // If we are dragging the left mouse button.
+     if ( mLMouseDown )
+     {
+		  mShipNode->translate(-e->getRelX() * 200, -e->getRelY() * 200, 0.0);
+     } // if
+
+    // If we are dragging the right mouse button.
+    else if ( mRMouseDown )
+    {
+        mCamera->yaw( -e->getRelX() * mRotateSpeed );
+        mCamera->pitch( -e->getRelY() * mRotateSpeed );
+    } // else if
+} // mouseDragged
 
 
@@ -38,4 +131,2 @@
     return 0;
 }
-
-
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 16)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 18)
@@ -3,6 +3,65 @@
         TestCullingApplication.h
 */
+#include "CEGUIForwardRefs.h"
+#include "ExampleApplication.h"
 
-#include "ExampleApplication.h"
+
+class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
+{
+public:
+
+    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer,
+					   SceneNode* shipNode)
+        : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), mShipNode(shipNode)
+    {
+		// Setup default variables
+        mCurrentObject = NULL;
+        mLMouseDown = false;
+        mRMouseDown = false;
+        mSceneMgr = sceneManager;
+
+        // Reduce move speed
+        mMoveSpeed = 50;
+        mRotateSpeed *= 2;
+
+		// Register this so that we get mouse events.
+        mEventProcessor->addMouseListener( this );
+        mEventProcessor->addMouseMotionListener( this );
+    } // MouseQueryListener
+
+    ~MouseQueryListener( )
+    {
+    }
+
+    bool frameStarted(const FrameEvent &evt)
+    {
+        return ExampleFrameListener::frameStarted( evt );
+    }
+
+   /* MouseListener callbacks. */
+   virtual void mouseClicked(MouseEvent* e) { }
+   virtual void mouseEntered(MouseEvent* e) { }
+   virtual void mouseExited(MouseEvent* e)  { }
+
+   // This is when the mouse button goes DOWN.
+   virtual void mousePressed(MouseEvent* e);
+
+   // This is when the mouse button is let UP.
+   virtual void mouseReleased(MouseEvent* e);
+
+   /* MouseMotionListener callbacks */
+   virtual void mouseMoved (MouseEvent *e);
+   
+   // This is when the mouse is clicked, held and dragged.
+   virtual void mouseDragged (MouseEvent *e);
+
+protected:
+    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
+    SceneManager *mSceneMgr;           // A pointer to the scene manager
+    SceneNode *mCurrentObject;         // The newly created object
+    CEGUI::Renderer *mGUIRenderer;     // cegui renderer
+	SceneNode* mShipNode;
+};
+
 
 class TestCullingFrameListener : public ExampleFrameListener
@@ -56,7 +115,11 @@
 	void createFrameListener(void)
     {
-       mFrameListener= new TestCullingFrameListener(mWindow, mCamera, mShipNode);
-       mRoot->addFrameListener(mFrameListener);
+		mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer, mShipNode);
+		mFrameListener->showDebugOverlay(true);
+		mRoot->addFrameListener(mFrameListener);
     }
+
+	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
+	CEGUI::System *mGUISystem;
 
 private:
@@ -86,6 +149,6 @@
     void chooseSceneManager(void)
     {
-    //    mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
-		mSceneMgr = mRoot->getSceneManager(ST_INTERIOR);
+        mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+		//mSceneMgr = mRoot->getSceneManager(ST_INTERIOR);
     }
 	/*
