Index: trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingDotSceneManager.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingDotSceneManager.h	(revision 33)
+++ trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingDotSceneManager.h	(revision 33)
@@ -0,0 +1,47 @@
+#ifndef _OcclusionCullingDotSceneManager_H__
+#define _OcclusionCullingDotSceneManager_H__
+
+#include "OgreSceneNode.h"
+#include "DotSceneManager.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+
+#include "OgrePrerequisites.h"
+
+using namespace std;
+
+namespace Ogre {
+	
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingDotSceneManager: public DotSceneManager
+	{
+	public:
+		OcclusionCullingDotSceneManager();
+		~OcclusionCullingDotSceneManager();
+	
+		void _renderVisibleObjects(void);
+		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+		void _updateSceneGraph(Camera* cam);
+
+		/** Sets the given option for the SceneManager
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		virtual bool setOption( const String &, const void * );
+		/** Gets the given option for the Scene Manager.
+	        @remarks
+		    See setOption
+		*/
+		virtual bool getOption( const String &, void * );
+
+		bool getOptionValues( const String & key, StringVector &refValueList );
+		bool getOptionKeys( StringVector &refKeys );
+
+	protected:
+		OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser;
+	};
+
+}
+#endif // OcclusionCullingDotSceneManager_H
Index: trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h	(revision 33)
@@ -20,5 +20,5 @@
 	public:
 		OcclusionCullingSceneManager();
-		//~OcclusionCullingSceneManager();
+		~OcclusionCullingSceneManager();
 	
 		/** Overriden from SceneManager. Renders the scene with the specified algorithm
@@ -49,5 +49,5 @@
 
 	protected:
-		OcclusionCullingSceneTraverser mSceneTraverser;
+		OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser;
 	
 	};
Index: trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneTraverser.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneTraverser.h	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneTraverser.h	(revision 33)
@@ -39,18 +39,29 @@
 	{
 	public:
-		OcclusionCullingSceneTraverser();
+		/** Construction taking the current scene manager and the current rendersystem as argument
+		@param sm current scene manager
+		@param rsys current render system 
+		*/
+		OcclusionCullingSceneTraverser(SceneManager *sm, RenderSystem *rsys);
 		~OcclusionCullingSceneTraverser();
 	
 		enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES};
 		
-		/** Overriden from SceneManager. Renders the scene with the specified algorithm
-		/**
-			The algorithm is one of
+		/** Renders the scene with the specified algorithm
+			@comment 
+			The algorithm type can be set with the parameter "Algorithm" and setOption.
+
+			The algorithm is one of:
 			RENDER_CULL_FRUSTUM: renders the scene with view frustum culling only
 			RENDER_STOP_AND_WAIT: renders the scene with the hierarchical stop and wait algorithm
 			RENDER_COHERENT: renders the scene with the coherent hierarchical algorithm
+			
+			@param cam current camera
+			@param root root of hierarchy 
 		*/
+		void renderScene( Camera *cam, SceneNode *root );
+	
 		
-		/** Sets the given option for the SceneTraverser
+		/** Sets the given option for the scene traverser.
 			       @remarks
 			Options are:
@@ -58,23 +69,30 @@
 		*/
 		bool setOption( const String &, const void * );
-		/** Gets the given option for the SceneTraverser.
+		/** Gets the given option for the scene traverser.
 	        @remarks
 		    See setOption
 		*/
 		bool getOption( const String &, void * );
-
-		/** Renders current scene 
-		@param cam current camera
-		@param root root of hierarchy */
-		void renderScene(  Camera *cam, SceneNode *root );
-
-		/** Sets the scene manager */
+		bool getOptionKeys( StringVector &refKeys );
+		
+		/** Sets pointer to the current scene manager.
+		@param the scene manager */
 		void setSceneManager( SceneManager *sm );
-		/** Sets the render system */
+		
+		/** Sets pointer to the current render system 
+		@param the rendersystem */
 		void setRenderSystem( RenderSystem *rsys );
-
+		
+		/** Doing some necessary preprocessing.
+		@comment e.g., initialises occlusion queries */
 		void preprocess( void );
 
+		/** Sets the current number of scene nodes in the scene.
+		@param num number of scene nodes
+		*/
+		void setNumSceneNodes(int num );
+
 	protected:
+		/** query mode (= without color) or RENDER_MODE */
 		enum {MODE_QUERY, MODE_RENDER};
 		/** returns true if node is leaf of the hierarchy */
Index: trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h	(revision 33)
+++ trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneManager.h	(revision 33)
@@ -0,0 +1,52 @@
+#ifndef _OcclusionCullingTerrainSceneManager_H__
+#define _OcclusionCullingTerrainSceneManager_H__
+
+#include <OgreSceneNode.h>
+#include <OgreOctreeSceneManager.h>
+#include <OgreTerrainSceneManager.h>
+#include <OgreOctreeSceneQuery.h>
+#include <OgreOctreeNode.h>
+#include <OgreOctreeCamera.h>
+
+#include "OgrePrerequisites.h"
+#include "OgreOcclusionCullingSceneTraverser.h"
+//#include "OgreSolidHalfBoundingBox.h"
+
+using namespace std;
+
+namespace Ogre {
+	
+	/**
+		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
+	*/
+	class OcclusionCullingTerrainSceneManager: public TerrainSceneManager
+	{
+	public:
+		OcclusionCullingTerrainSceneManager();
+		~OcclusionCullingTerrainSceneManager();
+	
+		void _renderVisibleObjects(void);
+		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+		void _updateSceneGraph(Camera* cam);
+
+		/** Sets the given option for the SceneManager
+			       @remarks
+			Options are:
+			"Algorithm", int *;			
+		*/
+		virtual bool setOption( const String &, const void * );
+		/** Gets the given option for the Scene Manager.
+	        @remarks
+		    See setOption
+		*/
+		virtual bool getOption( const String &, void * );
+
+		bool getOptionValues( const String & key, StringVector &refValueList );
+		bool getOptionKeys( StringVector &refKeys );
+
+	protected:
+		OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser;
+	};
+
+}
+#endif // OcclusionCullingTerrainSceneManager_H
Index: trunk/VUT/OcclusionCullingSceneManager/include/OgreTerrainOcclusionCullingSceneManager.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/include/OgreTerrainOcclusionCullingSceneManager.h	(revision 32)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#ifndef _TerrainOcclusionCullingSceneManager_H__
-#define _TerrainOcclusionCullingSceneManager_H__
-
-#include "OgreSceneNode.h"
-#include "OgreTerrainSceneManager.h"
-//#include "OgreOcclusionCullingSceneManager.h"
-#include "OgrePrerequisites.h"
-//#include "OgreSolidHalfBoundingBox.h"
-
-using namespace std;
-
-namespace Ogre {
-	
-	/**
-		Class which implements a scene mangager which uses occlusion queries for culling occluded objects
-	*/
-	class TerrainOcclusionCullingSceneManager: public TerrainSceneManager
-	{
-	public:
-		TerrainOcclusionCullingSceneManager();
-		//~OcclusionCullingSceneManager();
-	
-	/*	void _renderVisibleObjects(void);
-		void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
-		void _updateSceneGraph(Camera* cam);
-*/
-		/** Sets the given option for the SceneManager
-			       @remarks
-			Options are:
-			"Algorithm", int *;			
-		*/
-//		virtual bool setOption( const String &, const void * );
-		/** Gets the given option for the Scene Manager.
-	        @remarks
-		    See setOption
-		*/
-/*		virtual bool getOption( const String &, void * );
-
-		bool getOptionValues( const String & key, StringVector &refValueList );
-		bool getOptionKeys( StringVector &refKeys );*/
-
-	};
-
-}
-#endif // TERRAINOCCLUSIONCULLINGSCENEMANAGER_H
Index: trunk/VUT/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/scripts/Plugin_OcclusionCullingSceneManager.vcproj	(revision 33)
@@ -20,5 +20,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&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"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&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;OGRE_COHERENT_OCCLUSION_CULLING"
 				MinimalRebuild="TRUE"
@@ -35,15 +35,15 @@
 				Name="VCLinkerTool"
 				IgnoreImportLibrary="TRUE"
-				AdditionalDependencies="OgreMain_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_OctreeSceneManager.lib"
+				AdditionalDependencies="OgreMain_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_OctreeSceneManager.lib Plugin_DotSceneManager.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;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;"
 				ModuleDefinitionFile="..\misc\OgreOcclusionCullingSceneManager.def"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/Plugin_OcclusionCullingSceneManager.pdb"
 				SubSystem="2"
-				ImportLibrary=""
+				ImportLibrary="$(OUTDIR)\Plugin_OcclusionCullingSceneManager.lib"
 				TargetMachine="1"/>
 			<Tool
@@ -145,4 +145,7 @@
 			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
 			<File
+				RelativePath="..\src\OgreOcclusionCullingDotSceneManager.cpp">
+			</File>
+			<File
 				RelativePath="..\src\OgreOcclusionCullingResourceManager.cpp">
 			</File>
@@ -157,8 +160,8 @@
 			</File>
 			<File
-				RelativePath="..\src\OgreSolidHalfBoundingBox.cpp">
+				RelativePath="..\src\OgreOcclusionCullingTerrainSceneManager.cpp">
 			</File>
 			<File
-				RelativePath="..\TestCulling\TestCullingApplication.cpp">
+				RelativePath="..\src\OgreSolidHalfBoundingBox.cpp">
 			</File>
 		</Filter>
@@ -166,4 +169,7 @@
 			Name="Header Files"
 			Filter="h;hpp;hxx;hm;inl;inc">
+			<File
+				RelativePath="..\include\OgreOcclusionCullingDotSceneManager.h">
+			</File>
 			<File
 				RelativePath="..\include\OgreOcclusionCullingResourceManager.h">
@@ -174,4 +180,7 @@
 			<File
 				RelativePath="..\include\OgreOcclusionCullingSceneTraverser.h">
+			</File>
+			<File
+				RelativePath="..\include\OgreOcclusionCullingTerrainSceneManager.h">
 			</File>
 			<File
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManagerDll.cpp	(revision 33)
@@ -24,37 +24,34 @@
 */
 
-//#include "OgreOcclusionCullingSceneManager.h"
-//#include "OgreTerrainOcclusionCullingSceneManager.h"
-#include <OgreOctreeSceneManager.h>
-#include <OgreTerrainSceneManager.h>
+#include "OgreOcclusionCullingTerrainSceneManager.h"
+#include "OgreOcclusionCullingSceneManager.h"
+#include "OgreOcclusionCullingDotSceneManager.h"
 #include <OgreRoot.h>
-#include "OgreHeightmapTerrainPageSource.h"
+
+//#include "OgreHeightmapTerrainPageSource.h"
 //#include <windows.h>
 
 namespace Ogre {
 
-    //OcclusionCullingSceneManager *occlusionPlugin;
-	//TerrainOcclusionCullingSceneManager *terrainOcclusionPlugin;
-	OctreeSceneManager *ocPlugin;
-
+    OcclusionCullingSceneManager *occlusionPlugin;
+	OcclusionCullingTerrainSceneManager *occlusionTerrainPlugin;
+	
     //-----------------------------------------------------------------------
     extern "C" void dllStartPlugin(void)
     {
 		// Create new scene manager
-	//	occlusionPlugin = new OcclusionCullingSceneManager();
-		ocPlugin = new OctreeSceneManager();
+		occlusionPlugin = new OcclusionCullingSceneManager();
+		occlusionTerrainPlugin = new OcclusionCullingTerrainSceneManager();
     
 	    // Register
-		//Root::getSingleton().setSceneManager( ST_GENERIC, occlusionPlugin );
-//		Root::getSingleton().setSceneManager( ST_EXTERIOR_CLOSE, terrainOcclusionPlugin );
-		Root::getSingleton().setSceneManager( ST_EXTERIOR_CLOSE, ocPlugin );
-
-		//MessageBox( NULL, "myplugin registered", "this is my plugin", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+		Root::getSingleton().setSceneManager( ST_GENERIC, occlusionPlugin );
+		Root::getSingleton().setSceneManager( ST_EXTERIOR_CLOSE, occlusionTerrainPlugin );
+		
+		// MessageBox( NULL, "myplugin registered", "this is my plugin", MB_OK | MB_ICONERROR | MB_TASKMODAL);
     }
     extern "C" void dllStopPlugin(void)
     {
-      //  delete occlusionPlugin;
-		delete ocPlugin;
-		//delete terrainOcclusionPlugin;
+        delete occlusionPlugin;
+		delete occlusionTerrainPlugin;
     }
 }
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp	(revision 33)
@@ -15,4 +15,10 @@
 	OcclusionCullingSceneManager::OcclusionCullingSceneManager()
 	{
+		mOcclusionCullingSceneTraverser = new OcclusionCullingSceneTraverser(this, mDestRenderSystem);
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingSceneManager::~OcclusionCullingSceneManager()
+	{
+		delete mOcclusionCullingSceneTraverser;
 	}
 	//-----------------------------------------------------------------------
@@ -24,5 +30,5 @@
 	void OcclusionCullingSceneManager::_renderVisibleObjects( void )
 	{
-		mSceneTraverser.renderScene(mCameraInProgress, mSceneRoot);
+		mOcclusionCullingSceneTraverser->renderScene(mCameraInProgress, mSceneRoot);
 	}
 	//-----------------------------------------------------------------------
@@ -34,5 +40,6 @@
 	void OcclusionCullingSceneManager::_updateSceneGraph( Camera* cam )
 	{
-		mSceneTraverser.preprocess();
+		mOcclusionCullingSceneTraverser->setNumSceneNodes(mSceneNodes.size());
+		mOcclusionCullingSceneTraverser->preprocess();
 		
 		SceneManager::_updateSceneGraph(cam);
@@ -41,5 +48,5 @@
 	bool OcclusionCullingSceneManager::setOption( const String & key, const void * val )
 	{
-		mSceneTraverser.setOption(key, val);
+		mOcclusionCullingSceneTraverser->setOption(key, val);
 			
 		return SceneManager::setOption( key, val );
@@ -48,5 +55,5 @@
 	bool OcclusionCullingSceneManager::getOption( const String & key, void *val )
 	{
-		mSceneTraverser.getOption(key, val);
+		mOcclusionCullingSceneTraverser->getOption(key, val);
 		
 		return SceneManager::getOption( key, val );
@@ -62,11 +69,6 @@
 		SceneManager::getOptionKeys( refKeys );
 
-		refKeys.push_back( "Algorithm" );
-		refKeys.push_back( "Threshold" );
-		refKeys.push_back( "NumSceneNodes" );
-		refKeys.push_back( "NumTraversedNodes" );
-		refKeys.push_back( "NumQueryCulledNodes" );
-		refKeys.push_back( "NumFrustumCulledNodes" );
-		//refKeys.push_back( "mNumRenderedGeometry" );
+		mOcclusionCullingSceneTraverser->getOptionKeys( refKeys );
+
 		return true;
 	}
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp	(revision 33)
@@ -7,4 +7,5 @@
 #include "OgreSolidHalfBoundingBox.h"
 
+
 #include <windows.h>
 
@@ -12,9 +13,9 @@
 	
 	//-----------------------------------------------------------------------
-	OcclusionCullingSceneTraverser::OcclusionCullingSceneTraverser(): 
+	OcclusionCullingSceneTraverser::OcclusionCullingSceneTraverser(SceneManager *sm, RenderSystem *rsys): 
 	mFrameId(1), mDistanceQueue(NULL), mVisibilityThreshold(0), mCurrentTestIdx(0),
 	mQueryMode(MODE_RENDER), mNumSceneNodes(0), mCurrentAlgorithm(RENDER_COHERENT),
 	mNumTraversedNodes(0), mNumQueryCulledNodes(0), mNumFrustumCulledNodes(0), 
-	mNumRenderedGeometry(0), mSceneManager(0), mRenderSystem(0)
+	mNumRenderedGeometry(0), mSceneManager(sm), mRenderSystem(rsys)
 	{		
 		mHalfBoundingBox[0] = mHalfBoundingBox[1] = 0;
@@ -257,5 +258,5 @@
 		//-- initialise occlusion queries.
 		deleteQueries();
-			
+		
 		for(unsigned int i=0; i < mNumSceneNodes; i++)
 		{
@@ -389,3 +390,21 @@
 		return false;
 	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingSceneTraverser::getOptionKeys( StringVector & refKeys )
+	{
+		refKeys.push_back( "Algorithm" );
+		refKeys.push_back( "Threshold" );
+		refKeys.push_back( "NumSceneNodes" );
+		refKeys.push_back( "NumTraversedNodes" );
+		refKeys.push_back( "NumQueryCulledNodes" );
+		refKeys.push_back( "NumFrustumCulledNodes" );
+		//refKeys.push_back( "mNumRenderedGeometry" );
+
+		return true;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingSceneTraverser::setNumSceneNodes(int num)
+	{
+		mNumSceneNodes = num;
+	}
 }	
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp	(revision 33)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp	(revision 33)
@@ -0,0 +1,61 @@
+#include "OgreOcclusionCullingTerrainSceneManager.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystem.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+//#include "OgreWireBoundingBox.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+//#include <windows.h>
+
+namespace Ogre {
+	//-----------------------------------------------------------------------
+	OcclusionCullingTerrainSceneManager::OcclusionCullingTerrainSceneManager()
+	{
+		mOcclusionCullingSceneTraverser = new OcclusionCullingSceneTraverser(this, mDestRenderSystem);
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingTerrainSceneManager::~OcclusionCullingTerrainSceneManager()
+	{
+		delete mOcclusionCullingSceneTraverser;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingTerrainSceneManager::_renderVisibleObjects(void)
+	{
+		mOcclusionCullingSceneTraverser->renderScene(mCameraInProgress, mSceneRoot);
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
+	{
+		// must be empty because objects are found and rendered in an interleaved fashion
+		// in _renderVisibibleObjects 
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingTerrainSceneManager::_updateSceneGraph(Camera* cam)
+	{
+        mOcclusionCullingSceneTraverser->preprocess();
+
+		TerrainSceneManager::_updateSceneGraph(cam);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::setOption( const String & key, const void * val )
+	{
+		return mOcclusionCullingSceneTraverser->setOption( key, val) || TerrainSceneManager::setOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::getOption( const String & key, void *val )
+	{
+		return mOcclusionCullingSceneTraverser->getOption( key, val) || TerrainSceneManager::getOption( key, val ) ;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
+	{
+		return TerrainSceneManager::getOptionValues( key, refValueList );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingTerrainSceneManager::getOptionKeys( StringVector & refKeys )
+	{
+		return mOcclusionCullingSceneTraverser->getOptionKeys ( refKeys ) || TerrainSceneManager::getOptionKeys( refKeys );
+	}
+}	
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingDotSceneManager.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingDotSceneManager.cpp	(revision 33)
+++ trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingDotSceneManager.cpp	(revision 33)
@@ -0,0 +1,61 @@
+#include "OgreOcclusionCullingDotSceneManager.h"
+#include "OgreMath.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystem.h"
+#include "OgreCamera.h"
+#include "OgreHardwareOcclusionQuery.h"
+//#include "OgreWireBoundingBox.h"
+#include "OgreSolidHalfBoundingBox.h"
+
+//#include <windows.h>
+
+namespace Ogre {
+	//-----------------------------------------------------------------------
+	OcclusionCullingDotSceneManager::OcclusionCullingDotSceneManager()
+	{
+		mOcclusionCullingSceneTraverser = new OcclusionCullingSceneTraverser(this, mDestRenderSystem);
+	}
+	//-----------------------------------------------------------------------
+	OcclusionCullingDotSceneManager::~OcclusionCullingDotSceneManager()
+	{
+		delete mOcclusionCullingSceneTraverser;
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingDotSceneManager::_renderVisibleObjects(void)
+	{
+		mOcclusionCullingSceneTraverser->renderScene(mCameraInProgress, mSceneRoot);
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingDotSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
+	{
+		// must be empty because objects are found and rendered in an interleaved fashion
+		// in _renderVisibibleObjects 
+	}
+	//-----------------------------------------------------------------------
+	void OcclusionCullingDotSceneManager::_updateSceneGraph(Camera* cam)
+	{
+        mOcclusionCullingSceneTraverser->preprocess();
+
+		DotSceneManager::_updateSceneGraph(cam);
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::setOption( const String & key, const void * val )
+	{
+		return mOcclusionCullingSceneTraverser->setOption( key, val) || DotSceneManager::setOption( key, val );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::getOption( const String & key, void *val )
+	{
+		return mOcclusionCullingSceneTraverser->getOption( key, val) || DotSceneManager::getOption( key, val ) ;
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
+	{
+		return DotSceneManager::getOptionValues( key, refValueList );
+	}
+	//-----------------------------------------------------------------------
+	bool OcclusionCullingDotSceneManager::getOptionKeys( StringVector & refKeys )
+	{
+		return mOcclusionCullingSceneTraverser->getOptionKeys ( refKeys ) || DotSceneManager::getOptionKeys( refKeys );
+	}
+}	
Index: trunk/VUT/OcclusionCullingSceneManager/src/OgreTerrainOcclusionCullingSceneManager.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/src/OgreTerrainOcclusionCullingSceneManager.cpp	(revision 32)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#include "OgreTerrainOcclusionCullingSceneManager.h"
-#include "OgreMath.h"
-#include "OgreIteratorWrappers.h"
-#include "OgreRenderSystem.h"
-#include "OgreCamera.h"
-#include "OgreHardwareOcclusionQuery.h"
-//#include "OgreWireBoundingBox.h"
-#include "OgreSolidHalfBoundingBox.h"
-
-#include <windows.h>
-
-namespace Ogre {
-	//-----------------------------------------------------------------------
-	TerrainOcclusionCullingSceneManager::TerrainOcclusionCullingSceneManager()
-	{
-	}
-	/*//-----------------------------------------------------------------------
-	void TerrainOcclusionCullingSceneManager::_renderVisibleObjects(void)
-	{
-		//OcclusionCullingSceneManager::_renderVisibleObjects();
-	}
-	//-----------------------------------------------------------------------
-	void TerrainOcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
-	{
-	}
-	//-----------------------------------------------------------------------
-	void TerrainOcclusionCullingSceneManager::_updateSceneGraph(Camera* cam)
-	{
-    //    OcclusionCullingSceneManager::_updateSceneGraph(cam);
-	//	TerrainSceneManager::_updateSceneGraph(cam);
-	}
-	//-----------------------------------------------------------------------
-	bool TerrainOcclusionCullingSceneManager::setOption( const String & key, const void * val )
-	{
-		return TerrainSceneManager::setOption( key, val );
-	}
-	//-----------------------------------------------------------------------
-	bool TerrainOcclusionCullingSceneManager::getOption( const String & key, void *val )
-	{
-		return TerrainSceneManager::getOption( key, val );
-	}
-	//-----------------------------------------------------------------------
-	bool TerrainOcclusionCullingSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
-	{
-		return TerrainSceneManager::getOptionValues( key, refValueList );
-	}
-	//-----------------------------------------------------------------------
-	bool TerrainOcclusionCullingSceneManager::getOptionKeys( StringVector & refKeys )
-	{
-		return TerrainSceneManager::getOptionKeys( refKeys );
-	}*/
-}	
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCulling.vcproj	(revision 33)
@@ -21,6 +21,6 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				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"
+				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)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -34,8 +34,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_OctreeSceneManager.lib"
+				AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib"
 				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/TestCulling.pdb"
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 33)
@@ -6,7 +6,4 @@
 */
 
-//#pragma warning (push)
-//#pragma warning( disable : 4267 )
-
 #include <OgreNoMemoryMacros.h>
 #include <CEGUI/CEGUI.h>
@@ -15,24 +12,8 @@
 #include <../CEGUIRenderer/include/OgreCEGUITexture.h>
 #include <OgreMemoryMacros.h>
-//#pragma warning (pop)
-/*
-#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"
+#include "OgreOcclusionCullingSceneTraverser.h"
 
 #define WIN32_LEAN_AND_MEAN
@@ -83,5 +64,6 @@
 void TestCullingApplication::chooseSceneManager(void)
 {
-    mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+    //mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+	mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);
 }
 
@@ -96,38 +78,38 @@
 {
 
-		// Setup default variables
-        mCurrentObject = NULL;
-        mLMouseDown = false;
-        mRMouseDown = false;
-        mSceneMgr = sceneManager;
-
-        // Reduce move speed
-        mMoveSpeed = 50;
-        mRotateSpeed *= 2;
-	
-		mCurrentAlgorithm = OcclusionCullingSceneTraverser::RENDER_COHERENT;
-		mThreshold = 0;
-
-		// Register this so that we get mouse events.
-        mEventProcessor->addMouseListener(this);
-        mEventProcessor->addMouseMotionListener(this);
-		mEventProcessor->addKeyListener(this);
-
-		// show overlay
-        Overlay* pOver = OverlayManager::getSingleton().getByName("Example/OcclusionDemoOverlay"); 
-
-        mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo");
-		mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo");
-		mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo");
-		mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo");
-        mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo");
-	
-		mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
-		mThresholdInfo->setCaption(": 0");
-		mFrustumCulledNodesInfo->setCaption(": 0");
-		mQueryCulledNodesInfo->setCaption(": 0");
-		mTraversedNodesInfo->setCaption(": 0");
-
-        pOver->show();
+	// Setup default variables
+	mCurrentObject = NULL;
+	mLMouseDown = false;
+	mRMouseDown = false;
+	mSceneMgr = sceneManager;
+
+    // Reduce move speed
+	mMoveSpeed = 50;
+	mRotateSpeed *= 2;
+
+	mCurrentAlgorithm = OcclusionCullingSceneTraverser::RENDER_COHERENT;
+	mThreshold = 0;
+    
+	// Register this so that we get mouse events.
+	mEventProcessor->addMouseListener(this);
+	mEventProcessor->addMouseMotionListener(this);
+	mEventProcessor->addKeyListener(this);
+
+	// show overlay
+	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/OcclusionDemoOverlay"); 
+
+	mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo");
+	mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo");
+	mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo");
+	mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo");
+    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo");
+
+	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
+	mThresholdInfo->setCaption(": 0");
+	mFrustumCulledNodesInfo->setCaption(": 0");
+	mQueryCulledNodesInfo->setCaption(": 0");
+	mTraversedNodesInfo->setCaption(": 0");
+
+    pOver->show();
 } // MouseQueryListener
 //-----------------------------------------------------------------------
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 32)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 33)
@@ -5,5 +5,5 @@
 #include "CEGUIForwardRefs.h"
 #include "ExampleApplication.h"
-#include "OgreOcclusionCullingSceneManager.h"
+//#include "OgreOcclusionCullingSceneManager.h"
 #include "OgreOcclusionCullingSceneTraverser.h"
 
