Index: trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
===================================================================
--- trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h	(revision 99)
+++ trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h	(revision 100)
@@ -57,5 +57,7 @@
 	OctreeHierarchyInterface *mHierarchyInterface;
 	GtpVisibility::VisibilityManager *mVisibilityManager;
+	
 	bool mUseVisibilityCulling;
+	bool mShowVisualization;
 };
 
Index: trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
===================================================================
--- trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 99)
+++ trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 100)
@@ -56,5 +56,9 @@
 	void WriteLog();
 	void SetShowVisualization(bool showViz);
-	
+
+/*	void SetSkyBoxEnabled(bool enabled);
+	void SetSkyPlaneEnabled(bool enabled);
+	void SetSkyDomeEnabled(bool enabled);*/
+
 protected:
 	
Index: trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj
===================================================================
--- trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 92)
+++ trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 100)
@@ -88,5 +88,5 @@
 				OptimizeForProcessor="2"
 				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;..\..\GtpVisibility\include"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_OCCLUSIONCULLINGSCENEMANAGER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
Index: trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 99)
+++ trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 100)
@@ -12,5 +12,6 @@
 VisibilityOctreeSceneManager::VisibilityOctreeSceneManager(
 	GtpVisibility::VisibilityManager *visManager)
-: mVisibilityManager(visManager), mUseVisibilityCulling(true)
+: mVisibilityManager(visManager), mUseVisibilityCulling(true),
+mShowVisualization(false)
 {
 	mHierarchyInterface = 
@@ -35,5 +36,5 @@
 	mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 
 							mCullCamera ? getCamera("CullCamera") : NULL);
-	mVisibilityManager->GetCullingManager()->InitFrame();
+	//mVisibilityManager->GetCullingManager()->InitFrame();
 
 	// standard scenemanager rendering without hierarchical culling
@@ -65,6 +66,10 @@
 	setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
 
-	//-- the hierarchical culling algorithm
+
+	/** 
+	* the hierarchical culling algorithm
+	**/
 	mVisibilityManager->ApplyVisibilityCulling();
+
 
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
@@ -84,12 +89,22 @@
 	// we interleave identification and rendering of objects 
 	// in _renderVisibibleObjects 
+	if (!mUseVisibilityCulling)
+	{
+		OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters);
+		return;	
+	}
+	
+	if (mShowVisualization)
+    {
+		
+		for ( BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it )
+		{
+			getRenderQueue()->addRenderable(*it);
+		}
+	}
+
 	getRenderQueue()->clear();
     mBoxes.clear();
     mVisible.clear();
-
-	if(!mUseVisibilityCulling)
-	{
-		OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters);
-	}
 }
 //-----------------------------------------------------------------------
@@ -112,5 +127,9 @@
 		return true;
 	}
-	
+	if (key == "ShowVisualization")
+	{
+		mShowVisualization = (*static_cast<const bool *>(val));
+		return true;
+	}
 	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
 		setOption(key, val) || OctreeSceneManager::setOption(key, val);
Index: trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp	(revision 94)
+++ trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp	(revision 100)
@@ -62,5 +62,5 @@
 	SceneNode *sceneNode = static_cast<SceneNode *>(node);
 
-	while(sceneNode && !sceneNode->isNodeVisible())
+	while (sceneNode && !sceneNode->isNodeVisible())
 	{
 		sceneNode->setNodeVisible(true);
@@ -115,8 +115,7 @@
 AxisAlignedBox *SceneNodeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node)
 {
-	if(node != mPreviousNode)
+	if (node != mPreviousNode)
 	{
 		mPreviousNode = node;
-
 		mBox = static_cast<SceneNode *>(node)->_getWorldAABB();
 	}
Index: trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 94)
+++ trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 100)
@@ -20,5 +20,5 @@
 	DeleteQueries();
 
-	if(mSolidBoundingBox)
+	if (mSolidBoundingBox)
 		delete mSolidBoundingBox;
 }
@@ -26,5 +26,5 @@
 void PlatformHierarchyInterface::DeleteQueries()
 {
-	for(int i=0; i < (int)mOcclusionQueries.size(); ++i)
+	for (int i=0; i < (int)mOcclusionQueries.size(); ++i)
 		delete mOcclusionQueries[i];
 
@@ -72,5 +72,5 @@
 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::GetNextOcclusionQuery()
 {
-	if(mCurrentTestIdx == mOcclusionQueries.size())
+	if (mCurrentTestIdx == mOcclusionQueries.size())
 	{
 		mOcclusionQueries.push_back(new PlatformOcclusionQuery(mRenderSystem));
@@ -87,5 +87,5 @@
 	SetCamera(cam);
 
-	if(cullCam)
+	if (cullCam)
 		SetCullCamera(cullCam);
 	else
@@ -143,5 +143,5 @@
 SolidBoundingBox *PlatformHierarchyInterface::GetSolidBoundingBox()
 {
-	if(!mSolidBoundingBox)
+	if (!mSolidBoundingBox)
 		mSolidBoundingBox = new SolidBoundingBox;
 
Index: trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp	(revision 97)
+++ trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp	(revision 100)
@@ -42,5 +42,5 @@
 
 	// fan 1
-	if(isFirstHalf)
+	if (isFirstHalf)
 	{
 		*pPos++ = min.x; *pPos++ = max.y; *pPos++ = max.z; //011
@@ -89,5 +89,5 @@
 	m_pMaterial = MaterialManager::getSingleton().getByName("QueryMaterial");
 
-	if(m_pMaterial.isNull())
+	if (m_pMaterial.isNull())
 	{
 		m_pMaterial = MaterialManager::getSingleton().
Index: trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 99)
+++ trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 100)
@@ -7,4 +7,5 @@
 #include <OgreCamera.h>
 #include <OgreLogManager.h>
+#include <OgreStringConverter.h>
 
 #include <windows.h>
@@ -36,5 +37,5 @@
 	mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 
 							mCullCamera ? getCamera("CullCamera") : NULL);
-	mVisibilityManager->GetCullingManager()->InitFrame();
+	//mVisibilityManager->GetCullingManager()->InitFrame();
 	
 	// standard scenemanager rendering without hierarchical culling
@@ -56,4 +57,5 @@
 	setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
 	SceneManager::_renderVisibleObjects();
+
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
 	_deleteRenderedQueueGroups();
@@ -65,6 +67,10 @@
 	setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
 
-	//-- the hierarchical culling algorithm
+
+	/** 
+	* the hierarchical culling algorithm
+	**/
 	mVisibilityManager->ApplyVisibilityCulling();
+
 
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
@@ -83,21 +89,38 @@
 	// does nothing if hierarchical culling is used =>
 	// we interleave identification and rendering of objects 
-	// in _renderVisibibleObjects 
+	// in _renderVisibibleObjects
+	getRenderQueue()->clear();
+	
+	if (!mUseVisibilityCulling)
+	{
+		OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters);
+		return;	
+	}
+	
+	//-- show visibile scene nodes and octree bounding boxes from last frame
 	if (mShowVisualization)
     {
-		for ( BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it )
+		// add cull camera for visualization purpose
+		if (mCullCamera)
+		{
+			Camera *c;
+			if ((c = getCamera("CullCamera")) != NULL)
+			{
+				getRenderQueue()->addRenderable(c);
+			}
+		}
+
+		for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it)
 		{
 			getRenderQueue()->addRenderable(*it);
 		}
-	}
-
-	getRenderQueue()->clear();
+		for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it)
+		{
+			getRenderQueue()->addRenderable(*it);
+		}
+	}
+	
+	mVisible.clear();
     mBoxes.clear();
-    mVisible.clear();
-
-	if(!mUseVisibilityCulling)
-	{
-		OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters);
-	}
 }
 //-----------------------------------------------------------------------
@@ -126,5 +149,19 @@
 		return true;
 	}
-
+	if (key == "SkyBoxEnabled")
+	{
+		mSkyBoxEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "SkyPlaneEnabled")
+	{
+		mSkyPlaneEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "SkyDomeEnabled")
+	{
+		mSkyDomeEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
 	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
 		setOption(key, val) || TerrainSceneManager::setOption(key, val);
@@ -139,5 +176,4 @@
 	}
 	
-
 	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
 		getOption(key, val) && TerrainSceneManager::getOption(key, val);
@@ -169,4 +205,20 @@
 	mShowVisualization = showViz;
 }
+/*
+//-----------------------------------------------------------------------
+void SetSkyBoxEnabled(bool enabled)
+{
+	mSkyBoxEnabled = enabled;
+}
+//-----------------------------------------------------------------------
+void SetSkyPlaneEnabled(bool enabled)
+{
+	mSkyPlaneEnabled = enabled;
+}
+//-----------------------------------------------------------------------
+void SetSkyDomeEnabled(bool enabled)
+{
+	mSkyDomeEnabled = enabled;
+} */
 //-----------------------------------------------------------------------
 void VisibilityTerrainSceneManager::WriteLog()
Index: trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp	(revision 97)
+++ trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp	(revision 100)
@@ -121,5 +121,5 @@
 	m_pMaterial = MaterialManager::getSingleton().getByName("QueryMaterial");
 
-	if(m_pMaterial.isNull())
+	if (m_pMaterial.isNull())
 	{
 		m_pMaterial = MaterialManager::getSingleton().
Index: trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp	(revision 94)
+++ trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp	(revision 100)
@@ -28,9 +28,9 @@
 //#include <OgreVisibilityDotSceneManager.h>
 #include <OgreHeightmapTerrainPageSource.h>
+#include <OgreRoot.h>
+
 #include "VisibilityManager.h"
 #include "StopAndWaitCullingManager.h"
 #include "VisibilityEnvironment.h"
-
-#include <OgreRoot.h>
 
 GtpVisibility::VisibilityEnvironment *visEnv;
Index: trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp	(revision 87)
+++ trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp	(revision 100)
@@ -3,7 +3,9 @@
 namespace Ogre {
 //-----------------------------------------------------------------------
-VisibilityOptionsManager::VisibilityOptionsManager(GtpVisibility::VisibilityManager *visManager, 
-										GtpVisibility::HierarchyInterface *hierarchyInterface):
-mVisibilityManager(visManager), mHierarchyInterface(hierarchyInterface)
+VisibilityOptionsManager::VisibilityOptionsManager(
+	GtpVisibility::VisibilityManager *visManager, 
+	GtpVisibility::HierarchyInterface *hierarchyInterface):
+mVisibilityManager(visManager), 
+mHierarchyInterface(hierarchyInterface)
 {
 }
@@ -11,5 +13,5 @@
 bool VisibilityOptionsManager::setOption( const String & key, const void * val )
 {
-	if( key == "Algorithm" )
+	if (key == "Algorithm")
 	{
 		mVisibilityManager->SetCullingManager(*static_cast<const 
@@ -17,5 +19,5 @@
 		return true;
 	}
-	if(key == "Threshold")
+	if (key == "Threshold")
 	{
 		mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val));
@@ -67,10 +69,10 @@
 }
 //-----------------------------------------------------------------------
-bool VisibilityOptionsManager::getOptionKeys( StringVector & refKeys )
+bool VisibilityOptionsManager::getOptionKeys(StringVector & refKeys)
 {
-	refKeys.push_back( "NumRenderedNodes" );
-	refKeys.push_back( "NumTraversedNodes" );
-	refKeys.push_back( "NumQueryCulledNodes" );
-	refKeys.push_back( "NumFrustumCulledNodes" );
+	refKeys.push_back("NumRenderedNodes");
+	refKeys.push_back("NumTraversedNodes");
+	refKeys.push_back("NumQueryCulledNodes");
+	refKeys.push_back("NumFrustumCulledNodes");
 	
 	return true;
Index: trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp	(revision 99)
+++ trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp	(revision 100)
@@ -27,5 +27,5 @@
 	// we interleave identification and rendering of objects 
 	// in _renderVisibibleObjects 
-	if(!mUseVisibilityCulling)
+	if (!mUseVisibilityCulling)
 	{
 		SceneManager::_findVisibleObjects(cam, onlyShadowCasters);
@@ -38,5 +38,5 @@
 	mVisibilityManager->GetCullingManager()->InitFrame();
 
-	if(!mUseVisibilityCulling)
+	if (!mUseVisibilityCulling)
 	{	
 		SceneManager::_renderVisibleObjects();
