Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj	(revision 64)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj	(revision 74)
@@ -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)\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"
+				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;;../../GtpVisibility/include;../include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -37,5 +37,5 @@
 				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingTerrain.exe"
 				LinkIncremental="2"
-				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;"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/TestCullingTerrain.pdb"
@@ -66,12 +66,12 @@
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory=".\bin\$(ConfigurationName)"
+			IntermediateDirectory=".\obj\$(ConfigurationName)"
 			ConfigurationType="1"
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include"
-				PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE"
+				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;;../../GtpVisibility/include;../include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_RELEASE;WIN32;_STLP_RELEASE;GTP_VISIBILITY_MODIFIED_OGRE"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
@@ -83,8 +83,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="OGREMain.LIB"
-				OutputFile="..\..\..\Samples\Common\Bin\Release\TestCullingTerrain.exe"
+				AdditionalDependencies="OGREMain.LIB Plugin_OctreeSceneManager.lib CEGUIBase.lib OgreGUIRenderer.lib"
+				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCullingTerrain.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\..\OgreMain\Lib\Release"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				GenerateDebugInformation="TRUE"
 				SubSystem="2"
Index: trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp	(revision 61)
+++ trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp	(revision 74)
@@ -3,8 +3,11 @@
         TerrainContentGenerator.cpp
     \brief
-        Creates content for the terrain,
+        Creates content for the terrain.
 */
 #include "TerrainContentGenerator.h"
 
+/********************************************/
+/*  TerrainContentGenerator implementation  */
+/********************************************/
 //-----------------------------------------------------------------------
 TerrainContentGenerator::TerrainContentGenerator( SceneManager *sm, RayQueryExecutor *rayQueryEx )
@@ -13,6 +16,6 @@
 	mRayQueryExecutor = rayQueryEx;
 
-	mMinTranslation = Vector3(-70.0f, -70.0f, 0.0f);
-	mMaxTranslation = Vector3(70.0f, 70.0f, 600.0f);
+	mMinPos = Vector3(-200.0f, -70.0f, 200.0f);
+	mMaxPos = Vector3(200.0f, 70.0f, 200.0f);
 
 	mMinAngle = 0;
@@ -48,11 +51,11 @@
 	// Setup the ray scene query
 	Real rotation = mMinAngle + rotationRatio.x * (mMaxAngle - mMinAngle);
-	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
+	Vector3 position = mMinPos + translationRatio * (mMaxPos - mMinPos);
 
-	translation.y = 5000;
+	position.y = 5000;
     
 	Vector3 queryResult;
 
-	if(mRayQueryExecutor->executeRayQuery(&queryResult, translation, Vector3::NEGATIVE_UNIT_Y))
+	if(mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y))
 	{
 		char name[16];
@@ -60,11 +63,15 @@
 
 		Entity *ent = mSceneMgr->createEntity(name, entName);
-		SceneNode *currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", queryResult);
+		SceneNode *currentObject = mSceneMgr->getRootSceneNode()->
+			createChildSceneNode(String(name) + "Node", queryResult);
 		currentObject->attachObject(ent);
 		currentObject->setScale(0.1f, 0.1f, 0.1f);
 	}
 }
+/****************************************/
+/*  RayQueryExecutor implementation     */
+/****************************************/
 //-----------------------------------------------------------------------
-RayQueryExecutor::RayQueryExecutor( SceneManager *sm )
+RayQueryExecutor::RayQueryExecutor(SceneManager *sm)
 {
 	mRaySceneQuery = sm->createRayQuery(Ray());
@@ -76,12 +83,16 @@
 }
 //-----------------------------------------------------------------------
-bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir )
+bool RayQueryExecutor::executeRayQuery(Vector3 *result, const Vector3 &pos, const Vector3 &dir)
 {
-	Ray ray(pos, dir);
+	return executeRayQuery(result, Ray(pos, dir));
+}
+
+bool RayQueryExecutor::executeRayQuery(Vector3 *result, const Ray &ray)
+{
     mRaySceneQuery->setRay(ray);
 
     // Perform the scene query
     RaySceneQueryResult &queryResult = mRaySceneQuery->execute();
-    RaySceneQueryResult::iterator it = queryResult.begin( );
+    RaySceneQueryResult::iterator it = queryResult.begin();
 
 	if (it != queryResult.end() && it->worldFragment)
Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 61)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 74)
@@ -3,5 +3,5 @@
         TestCullingTerrainApplication.cpp
     \brief
-        Tests the occlusion culling algorithm
+        Tests the visibility culling algorithm
 */
 
@@ -44,37 +44,9 @@
 }
 //-----------------------------------------------------------------------
-void TestCullingTerrainApplication::generateSceneObject(const Vector3 &translationRatio, 
-					 const Vector3 &rotationRatio, const int idx, const String& entName)
-{
-	// Setup the ray scene query
-	/*Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);
-	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
-
-	translation.y = 5000;
-    Ray ray(translation, Vector3::NEGATIVE_UNIT_Y);
-    mRaySceneQuery->setRay(ray);
-
-    // Execute query
-	RaySceneQueryResult &result = mRaySceneQuery->execute();
-	RaySceneQueryResult::iterator itr = result.begin( );
-
-	// Get results, create a node/entity on the position
-	if ( itr != result.end() && itr->worldFragment )
-	{
-		char name[16];
-		sprintf( name, "%s%d", entName.c_str(), mCount++ );
-
-		Entity *ent = mSceneMgr->createEntity( name, entName );
-		SceneNode currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );
-		currentObject->attachObject( ent );
-		currentObject->setScale( 0.1f, 0.1f, 0.1f );
-	}*/
-}
-
-//-----------------------------------------------------------------------
 void TestCullingTerrainApplication::createScene( void )
 {
 	mRayQueryExecutor = new RayQueryExecutor(mSceneMgr);
 	mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr, mRayQueryExecutor);
+
 	// Set ambient light
 	mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
@@ -111,5 +83,5 @@
 	terrain_cfg = mResourcePath + terrain_cfg;
 #endif
-	mSceneMgr -> setWorldGeometry( terrain_cfg );
+	mSceneMgr->setWorldGeometry(terrain_cfg);
 	// Infinite far plane?
 	if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
@@ -124,4 +96,6 @@
 	// CEGUI setup
 	setupGui();
+
+	mTerrainContentGenerator->generateScene(100);
 }
 //-----------------------------------------------------------------------
@@ -149,5 +123,4 @@
 void TestCullingTerrainApplication::chooseSceneManager(void)
 {
-    //mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
 	mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);
 }
@@ -171,5 +144,5 @@
 	mRotateSpeed *= 2;
 
-	mCurrentAlgorithm = 0;//VisibilitySceneTraverser::RENDER_COHERENT;
+	mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING,
 	mThreshold = 0;
     
@@ -179,17 +152,16 @@
 	mEventProcessor->addKeyListener(this);
 
-	mRaySceneQuery = mSceneMgr->createRayQuery(Ray());
+	mRayQueryExecutor = new RayQueryExecutor(mSceneMgr);
 
 	// show overlay
 	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay"); 
 
-	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");
-	mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo");
-	mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo");
-	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo");
+	mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo");
+	mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo");
+	mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo");
+	mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo");
+    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo");
+	mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo");
+	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo");
 
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
@@ -198,5 +170,4 @@
 	mQueryCulledNodesInfo->setCaption(": 0");
 	mTraversedNodesInfo->setCaption(": 0");
-	mSceneNodesInfo->setCaption(": 0");
 	mHierarchyNodesInfo->setCaption(": 0");
 	mRenderedNodesInfo->setCaption(": 0");
@@ -207,5 +178,5 @@
 MouseQueryListener::~MouseQueryListener( )
 {
-	delete mRaySceneQuery;
+	delete mRayQueryExecutor;
 }
 //-----------------------------------------------------------------------
@@ -225,18 +196,15 @@
 		 // Setup the ray scene query
          Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
-         mRaySceneQuery->setRay( mouseRay );
-
-         // Execute query
-         RaySceneQueryResult &result = mRaySceneQuery->execute();
-         RaySceneQueryResult::iterator itr = result.begin( );
-
+   
+		 Vector3 queryResult;
          // Get results, create a node/entity on the position
-         if ( itr != result.end() && itr->worldFragment )
+		 if(mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay))
          {
 			 char name[16];
              sprintf( name, "Robot%d", mCount++ );
 
-             Entity *ent = mSceneMgr->createEntity( name, "robot.mesh" );
-             mCurrentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );
+             Entity *ent = mSceneMgr->createEntity(name, "robot.mesh");
+             mCurrentObject = mSceneMgr->getRootSceneNode()->
+				 createChildSceneNode( String(name) + "Node", queryResult);
              mCurrentObject->attachObject( ent );
              mCurrentObject->setScale( 0.1f, 0.1f, 0.1f );
@@ -275,14 +243,11 @@
 	 if ( mLMouseDown )
      {
-		 Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
-		 mRaySceneQuery->setRay( mouseRay );
-
-		 RaySceneQueryResult &result = mRaySceneQuery->execute();
-		 RaySceneQueryResult::iterator itr = result.begin( );
-
-		 if ( itr != result.end() && itr->worldFragment )
+		 Vector3 queryResult;
+		 Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY());
+
+		 if(mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay))
 		 {
-			 mCurrentObject->setPosition( itr->worldFragment->singleIntersection );
-		 } 
+			 mCurrentObject->setPosition(queryResult);
+		 }
      }
 	 // If we are dragging the right mouse button.
@@ -297,17 +262,11 @@
 {
 	// clamp to terrain
-	Vector3 camPos = mCamera->getPosition( );
-    Ray cameraRay( Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y );
-    mRaySceneQuery->setRay( cameraRay );
-
-    // Perform the scene query
-    RaySceneQueryResult &queryResult = mRaySceneQuery->execute();
-    RaySceneQueryResult::iterator it = queryResult.begin( );
-
-	if (it != queryResult.end() && it->worldFragment)
+	Vector3 camPos = mCamera->getPosition();
+	Vector3 queryResult;
+
+    if(mRayQueryExecutor->executeRayQuery(&queryResult, 
+		Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y))
 	{
-		SceneQuery::WorldFragment* wf = it->worldFragment;
-
-		mCamera->setPosition(mCamera->getPosition().x, wf->singleIntersection.y + 10, 
+		mCamera->setPosition(mCamera->getPosition().x, queryResult.y + 10, 
 			mCamera->getPosition().z);
 	}
@@ -347,5 +306,6 @@
 void MouseQueryListener::changeAlgorithm()
 {
-    //mCurrentAlgorithm = ++mCurrentAlgorithm % VisibilitySceneTraverser::NUM_RENDERMODES;
+	mCurrentAlgorithm = ++mCurrentAlgorithm % 
+		GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS,
 
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
@@ -367,8 +327,5 @@
 	mTraversedNodesInfo->setCaption(str);
 
-	mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt); 
-	mSceneNodesInfo->setCaption(str);
-
-	mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt); 
+	mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt); 
 	mHierarchyNodesInfo->setCaption(str);
 
Index: trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h	(revision 61)
+++ trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h	(revision 74)
@@ -5,24 +5,29 @@
 #include "ExampleApplication.h"
 
+/** Class which executes a simple ray query.
+*/
 class RayQueryExecutor
 {
 public:
-	RayQueryExecutor( SceneManager *sm );
-	~RayQueryExecutor( );
-	bool executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir );
+	RayQueryExecutor(SceneManager *sm);
+	~RayQueryExecutor();
+	
+	bool executeRayQuery(Vector3 *result, const Vector3 &pos, const Vector3 &dir);
+	bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Ray &ray);
+
 protected:
 	RaySceneQuery *mRaySceneQuery;
 };
-
+/** Class which fills a terrain with content in a random way.
+*/
 class TerrainContentGenerator
 {
 public:
-	TerrainContentGenerator(  SceneManager *sm, RayQueryExecutor *rayQueryEx );
+	TerrainContentGenerator(SceneManager *sm, RayQueryExecutor *rayQueryEx);
 	/** Generates a the scene hierarchy with random values .
-	@param number of objects to generate
+		@param number of objects to generate
 	*/
-	void generateScene( int numObjects );
-	/** 
-		generates a new scene object 
+	void generateScene(int numObjects);
+	/** Generates a new scene object 
 		@param tranlationRatio ratio between minimal and maximal possible translation
 		@param rotationRatio ratio between minimal and maximal possible rotation
@@ -30,6 +35,6 @@
 		@entName the name of the object entity
 	*/
-	void generateSceneObject( const Vector3 &translationRatio, const Vector3 &rotationRatio, 
-							  const int idx, const String &entName );
+	void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 
+							 const int idx, const String &entName);
 
 protected:
@@ -37,6 +42,6 @@
 	Real mMinAngle;
 	Real mMaxAngle;
-	Vector3 mMaxTranslation;
-	Vector3 mMinTranslation;
+	Vector3 mMaxPos;
+	Vector3 mMinPos;
 
 	RayQueryExecutor *mRayQueryExecutor;
Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 61)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 74)
@@ -6,4 +6,5 @@
 #include "ExampleApplication.h"
 #include "TerrainContentGenerator.h"
+#include "VisibilityEnvironment.h"
 
 Real timeDelay = 0;
@@ -17,9 +18,9 @@
 }
 
-String mCurrentAlgorithmCaptions[3/*VisibilitySceneTraverser::NUM_RENDERMODES*/] = 
+String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 
 {
-    "Cull Frustum", 
-	"Stop and Wait", 
-	"Coherent Occlusion Culling"
+    "View Frustum Culling", 
+	"Stop and Wait Culling", 
+	"Coherent Hierarchical Culling"
 };
 
@@ -83,5 +84,4 @@
 
 	SceneNode *mCurrentObject;         // The newly created object
-	RaySceneQuery *mRaySceneQuery;     // The ray scene query pointer
 	int mCount;                        // The number of robots on the screen
 
@@ -101,14 +101,4 @@
 	virtual void createCamera(void);
 
-	/** 
-		generates a new scene object 
-		@param tranlationRatio ratio between minimal and maximal possible translation
-		@param rotationRatio ratio between minimal and maximal possible rotation
-		@idx the index of the new object
-		@entName the name of the object entity
-	*/
-	void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 
-							 const int idx, const String &entName);
-
 	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
 	CEGUI::System *mGUISystem;
Index: trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h	(revision 61)
+++ trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h	(revision 74)
@@ -130,23 +130,24 @@
 		*/
 		void _renderSceneNode( Camera *cam, SceneNode *node );
-		
 		/** deletes all queues which we were currently processing
 			@remark clears renderqueue after rendering scene node
 		*/
 		void _deleteRenderedQueueGroups();
-	
-		
-		void myrenderSingleObject(Renderable* rend, Pass* pass, bool doLightIteration, 
-            const LightList* manualLightList = 0)
-		{
-			setPass(pass);
-			renderSingleObject(rend, pass, doLightIteration, manualLightList);}
-
+		/** Internal method used by _renderVisibleObjects to deal with renderables
+            which override the camera's own view / projection materices. 
+			@remark made public by matt 
+		*/
+        void useRenderableViewProjMode(Renderable* pRend);
+		/** Method for setting up the renderstate for a rendering pass.
+            @param
+                pass The Pass details to set.
+            @returns
+                A Pass object that was used instead of the one passed in, can
+                happen when rendering shadow passes
+			@remark made public by matt
+        */
+        virtual Pass* setPass(Pass* pass);
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
-		/** Internal method used by _renderVisibleObjects to deal with renderables
-            which override the camera's own view / projection materices. made
-			public by matt */
-        void useRenderableViewProjMode(Renderable* pRend);
-		
+
     protected:
 
@@ -250,4 +251,5 @@
         /** Retrieves the internal render queue. */
         virtual RenderQueue* getRenderQueue(void);
+#ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section
         /** Internal method for setting up the renderstate for a rendering pass.
             @param
@@ -258,4 +260,5 @@
         */
         virtual Pass* setPass(Pass* pass);
+#endif
         /// A pass designed to let us render shadow colour on white for texture shadows
         Pass* mShadowCasterPlainBlackPass;
@@ -332,5 +335,9 @@
         AnimationList mAnimationsList;
         AnimationStateSet mAnimationStates;
-
+#ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section
+        /** Internal method used by _renderVisibleObjects to deal with renderables
+            which override the camera's own view / projection materices. */
+        void useRenderableViewProjMode(Renderable* pRend);
+#endif
         /// Controller flag for determining if we need to set view/proj matrices
         bool mCamChanged;
Index: trunk/VUT/work/TestCulling/TestCulling.vcproj
===================================================================
--- trunk/VUT/work/TestCulling/TestCulling.vcproj	(revision 64)
+++ trunk/VUT/work/TestCulling/TestCulling.vcproj	(revision 74)
@@ -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)\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"
+				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;../../GtpVisibility/include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -37,5 +37,5 @@
 				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe"
 				LinkIncremental="2"
-				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;"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/TestCulling.pdb"
@@ -66,12 +66,12 @@
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory=".\bin\$(ConfigurationName)"
+			IntermediateDirectory=".\obj\$(ConfigurationName)"
 			ConfigurationType="1"
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include"
-				PreprocessorDefinitions="_WINDOWS,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE"
+				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;../../GtpVisibility/include"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_RELEASE;WIN32;_STLP_RELEASE;GTP_VISIBILITY_MODIFIED_OGRE"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
@@ -83,8 +83,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="OGREMain.LIB"
-				OutputFile="..\..\..\Samples\Common\Bin\Release\TestCulling.exe"
+				AdditionalDependencies="OGREMain.LIB Plugin_OctreeSceneManager.lib CEGUIBase.lib OgreGUIRenderer.lib"
+				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCulling.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\..\OgreMain\Lib\Release"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
 				GenerateDebugInformation="TRUE"
 				SubSystem="2"
Index: trunk/VUT/work/TestCulling/TestCullingApplication.cpp
===================================================================
--- trunk/VUT/work/TestCulling/TestCullingApplication.cpp	(revision 61)
+++ trunk/VUT/work/TestCulling/TestCullingApplication.cpp	(revision 74)
@@ -3,5 +3,5 @@
         TestCullingApplication.cpp
     \brief
-        Tests the occlusion culling algorithm
+        Tests the visibility culling algorithm
 */
 
@@ -15,5 +15,4 @@
 #include "Ogre.h"
 #include "TestCullingApplication.h"
-//#include "OgreVisibilitySceneTraverser.h"
 
 #define WIN32_LEAN_AND_MEAN
@@ -93,14 +92,18 @@
 //-----------------------------------------------------------------------
 void TestCullingApplication::generateSceneObject(const Vector3 &translationRatio, 
-												 const Vector3 &rotationRatio, const int idx, const String& entName)
+												 const Vector3 &rotationRatio, 
+												 const int idx, 
+												 const String& entName)
 {
 	Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);
-	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
+	Vector3 translation = mMinTranslation + 
+		translationRatio * (mMaxTranslation - mMinTranslation);
 
 	char name[16];
     sprintf( name, "object%d", idx );
 
-    Entity *ent = mSceneMgr->createEntity( name, entName );
-	SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode( String(name) + "Node", translation);
+    Entity *ent = mSceneMgr->createEntity(name, entName);
+	SceneNode *node = mSceneMgr->getRootSceneNode()->
+		createChildSceneNode(String(name) + "Node", translation);
 	node->attachObject(ent);
 	node->scale(0.1,0.1,0.1);
@@ -150,5 +153,5 @@
 	mRotateSpeed *= 2;
 
-	mCurrentAlgorithm = 0;//VisibilitySceneTraverser::RENDER_COHERENT;
+	mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;
 	mThreshold = 0;
     
@@ -161,12 +164,11 @@
 	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay"); 
 
-	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");
-	mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo");
-	mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo");
-	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo");
+	mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo");
+	mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo");
+	mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo");
+	mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo");
+    mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo");
+	mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo");
+	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo");
 
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
@@ -175,5 +177,4 @@
 	mQueryCulledNodesInfo->setCaption(": 0");
 	mTraversedNodesInfo->setCaption(": 0");
-	mSceneNodesInfo->setCaption(": 0");
 	mHierarchyNodesInfo->setCaption(": 0");
 	mRenderedNodesInfo->setCaption(": 0");
@@ -275,5 +276,5 @@
 void MouseQueryListener::changeAlgorithm()
 {
-    //mCurrentAlgorithm = ++mCurrentAlgorithm % VisibilitySceneTraverser::NUM_RENDERMODES;
+    mCurrentAlgorithm = ++mCurrentAlgorithm % GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS,
 
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
@@ -295,8 +296,5 @@
 	mTraversedNodesInfo->setCaption(str);
 
-	mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt); 
-	mSceneNodesInfo->setCaption(str);
-
-	mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt); 
+	mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt); 
 	mHierarchyNodesInfo->setCaption(str);
 
Index: trunk/VUT/work/TestCulling/TestCullingApplication.h
===================================================================
--- trunk/VUT/work/TestCulling/TestCullingApplication.h	(revision 61)
+++ trunk/VUT/work/TestCulling/TestCullingApplication.h	(revision 74)
@@ -5,5 +5,5 @@
 #include "CEGUIForwardRefs.h"
 #include "ExampleApplication.h"
-//#include "OgreVisibilitySceneTraverser.h"
+#include "VisibilityEnvironment.h"
 
 
@@ -18,9 +18,9 @@
 }
 
-String mCurrentAlgorithmCaptions[3] = 
+String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 
 {
-    "Cull Frustum", 
-	"Stop and Wait", 
-	"Coherent Occlusion Culling"
+    "View Frustum Culling", 
+	"Stop and Wait Culling", 
+	"Coherent Hierarchical Culling"
 };
 
@@ -80,5 +80,4 @@
     OverlayElement *mTraversedNodesInfo;
 	OverlayElement *mHierarchyNodesInfo;
-	OverlayElement *mSceneNodesInfo;
 	OverlayElement *mRenderedNodesInfo;
 };
