Index: GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp	(revision 2359)
+++ GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp	(revision 2455)
@@ -135,4 +135,5 @@
 mUseDepthPass(false),
 mTestGeometryForVisibleLeaves(false),
+mTestGeometryBounds(false),
 mShowVisualization(false),
 mCullCamera(false),
@@ -165,5 +166,4 @@
 mUseViewCells(false),
 mViewCellsLoaded(false),
-mUseVisibilityFilter(false),
 mFloorDist(2),
 mFlushQueue(false),
@@ -171,7 +171,4 @@
 m_iBoundingBoxLevel(0)
 {
-	//mInputDevice = PlatformManager::getSingleton().createInputReader();
-	//mInputDevice->initialise(win, true, true);
-
 	mEventProcessor = new EventProcessor();
 	
@@ -242,17 +239,25 @@
 	// the scale factor for the visualized bounding boxes
 	mSceneMgr->setOption("NodeVizScale", &mVizScale);
-	
-	/////////
-	//-- set the current culling algorithm type
-	//setAlgorithm(mApplication->mAlgorithm);
+
+	int assumedIncr;
+	mSceneMgr->getOption("AssumedVisibility", &assumedIncr);
+	changeAssumedVisibility(assumedIncr);
+
+	/////
+	// test geometry boundaries instead bounding box
+	mSceneMgr->getOption("TestGeometryBounds", &mTestGeometryBounds);
+	setTestGeometryBounds(mTestGeometryBounds);
+
+	/////////////////////////////////
+	// culling algorithm
 
 	bool isNormalExecution;
 		
 	mSceneMgr->getOption("NormalExecution", &isNormalExecution);
+	
 	if (isNormalExecution)
 	{
 		// no algorithm
-		mCurrentAlgorithm = 
-			GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS;
+		mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS;
 	}
 	else
@@ -261,12 +266,16 @@
 	}
 	
+	// apply the chosen culling algorithm
 	applyCurrentAlgorithm();
 	
+
 	///////////////////////////////
-
 	// set scene manager options
+	
+	//////////
+	mSceneMgr->getOption("TestGeometryForVisibleLeaves", &mTestGeometryForVisibleLeaves);
 	setTestGeometryForVisibleLeaves(mTestGeometryForVisibleLeaves);
 
-	//mSceneMgr->setOption("UseDepthPass", &mUseDepthPass);
+	/////////////
 	mSceneMgr->getOption("UseDepthPass", &mUseDepthPass);
 
@@ -278,4 +287,5 @@
 	mSceneMgr->getOption("FlushQueue", &mFlushQueue);
 	
+	//////////
 	if (mFlushQueue)
 		LogManager::getSingleton().logMessage("initial setting: flushing queue");
@@ -283,4 +293,5 @@
 		LogManager::getSingleton().logMessage("initial setting: not flushing queue");
 
+	/////////////
 	mSceneMgr->setOption("ShowOctree", &mShowOctree);
 	mSceneMgr->setOption("ShowViewCells", &mShowViewCells);
@@ -290,11 +301,11 @@
 	applyObjectType();
 
-	// initialise timer
+
+	///////////////
+	// initialize timer
+
 	mTimer = Root::getSingleton().getTimer();
 	mTimeFrameEnded = mTimeFrameStarted = mTimer->getMilliseconds();
 	
-	// init view cell parameters
-	mSceneMgr->setOption("UseVisibilityFilter", &mUseVisibilityFilter);
-
 	// reset statistics
 	mWalkthroughStats.Reset();
@@ -863,6 +874,4 @@
 		mFrameInfo.push_back(info);
 		
-		// std::stringstream d; d << StringConverter::toString(info.position) << " " << StringConverter::toString(info.orientation);
-		// LogManager::getSingleton().logMessage(d.str());
 		++ i;
 	}
@@ -892,5 +901,5 @@
 		// we produced precomputed fps during the last replay =>
 		// save them to file
-		if (mSavePrecomputedFps) //!mPrecomputedFpsFrameInfo.empty())
+		if (mSavePrecomputedFps)
 		{
 			std::string filename = msApprevAlgorithmCaptions[mCurrentAlgorithm] + "_frames.out";
@@ -997,7 +1006,5 @@
 
 	if (mAssumedVisibility < 0) 
-	{	
 		mAssumedVisibility = 0;
-	}
 
 	char str[100]; sprintf(str,": %d", mAssumedVisibility);
@@ -1229,21 +1236,22 @@
 	mSceneMgr->setOption("TestGeometryForVisibleLeaves", &mTestGeometryForVisibleLeaves);
 	
-	/* disable optimization which tests geometry instead of aabb
-	 * for "delayed" rendering of transparents (i.e., render transparents after all the solids)
-	 * because otherwise visible transparents could be skipped
-	 */
-	bool delayedRendering = !mTestGeometryForVisibleLeaves;
-
-	mSceneMgr->setOption("DelayRenderTransparents", &delayedRendering);
-
+	// disable optimization for transparent objects, becaue otherwise visible 
+	// transparents could be skipped
 	if (mTestGeometryForVisibleLeaves)
-	{
 		mTestGeometryForVisibleLeavesInfo->setCaption(": true");
-	}
 	else
-	{
 		mTestGeometryForVisibleLeavesInfo->setCaption(": false");
-	}
-}
+}
+//-----------------------------------------------------------------------
+void TerrainFrameListener::setTestGeometryBounds(bool testGeometryBounds)
+{
+	mSceneMgr->setOption("TestGeometryBounds", &mTestGeometryBounds);
+	
+	if (mTestGeometryBounds)
+		LogManager::getSingleton().logMessage("Testing geometry boundaries");
+	else
+		LogManager::getSingleton().logMessage("Testing bounding box of hierarchy node");
+}
+
 //-----------------------------------------------------------------------
 void TerrainFrameListener::toggleShowOctree()
@@ -1293,10 +1301,4 @@
 }
 //-----------------------------------------------------------------------
-void TerrainFrameListener::toggleUseVisibilityFilter()
-{
-	mUseVisibilityFilter = !mUseVisibilityFilter;
-	mSceneMgr->setOption("UseVisibilityFilter", &mUseVisibilityFilter);
-}
-//-----------------------------------------------------------------------
 void TerrainFrameListener::toggleUseDepthPass()
 {
@@ -1485,5 +1487,6 @@
 		break;
 	case KC_Q:
-		toggleUseVisibilityFilter();
+		mTestGeometryBounds = !mTestGeometryBounds;
+		setTestGeometryBounds(mTestGeometryBounds);
 		break;
 	case KC_R:
Index: GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp	(revision 2401)
+++ GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp	(revision 2455)
@@ -25,5 +25,4 @@
 
 
-//using namespace GtpVisibility;
 
 /*************************************************************/
@@ -478,8 +477,12 @@
 		if (0) generateScene(1000, 2); // create trees
 	}
-	int MaxDepth=30;
-	mSceneMgr->setOption("BiHierarchyMaxDepth", &MaxDepth);
-	int Mode=1;
-	mSceneMgr->setOption("EnhancedVisibility", &Mode);
+
+	int maxDepth = 30;
+	
+	mSceneMgr->setOption("BiHierarchyMaxDepth", &maxDepth);
+	
+	int mode = 1;
+	
+	mSceneMgr->setOption("EnhancedVisibility", &mode);
 	mSceneMgr->setOption("RebuildBiHierarchy", NULL);
 	mSceneMgr->setOption("RebuildKdTree", NULL);
@@ -509,5 +512,5 @@
 	//-- add animation state for new robots (located at the end of the list)
 	
-	for (int i = (int)entList->size() - num; i < (int)entList->size(); ++i)
+	for (size_t i = entList->size() - (unsigned int)num; i < entList->size(); ++ i)
 	{
 		mEntityStates.push_back(new EntityState((*entList)[i], 
Index: GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h
===================================================================
--- GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h	(revision 2359)
+++ GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h	(revision 2455)
@@ -224,16 +224,20 @@
 	void changeAssumedVisibility(int incr);
 	void changeVizScale(const int incr);
+	
 	void setTestGeometryForVisibleLeaves(bool testGeometryForVisibleLeaves);
+	
+	void setTestGeometryBounds(bool testGeometryBounds);
+
 	/** Shows visualization of octree hierarchy nodes.
 	*/
 	void toggleShowOctree();
+
 	/** Shows visualization of the view cells.
 	*/
 	void toggleShowViewCells();
+	
 	/** Toggles between view cells / no view cells.
 	*/
 	void toggleUseViewCells();
-
-	void toggleUseVisibilityFilter();
 
 	/** Toggles whether we use the initial depth pass.
@@ -372,5 +376,4 @@
 	OverlayElement *mQueryGeometryVisibilityInfo;
 	OverlayElement *mQueryPatchVisibilityInfo;
-	//OverlayElement *mHelpInfo;
 
 	RayQueryExecutor *mRayQueryExecutor;
@@ -378,4 +381,6 @@
 
 	bool mTestGeometryForVisibleLeaves;
+	bool mTestGeometryBounds;
+
 	bool mShowOctree;
 	bool mShowViewCells;
@@ -389,6 +394,10 @@
 	bool mShowHelp;
 	bool mStatsOn;
+	
+
+	////////
+	//-- true if the mouse buttons are down
+	
 	bool mLMouseDown;
-	// True if the mouse buttons are down
 	bool mRMouseDown;    
 	bool mShutdownRequested;
@@ -397,4 +406,5 @@
 	bool mUseAnimation;
 	
+
 	int mItemBufferMode;
 
@@ -410,5 +420,4 @@
 	
 	Real mReplayTimeElapsed;
-	//EventProcessor* mEventProcessor;
     InputReader* mInputDevice;
     Camera* mCamera;
@@ -446,5 +455,4 @@
 	bool mShowQueryStats;
 	
-	//bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn;
 	PlatformQueryManager *mQueryManager;
 
@@ -467,5 +475,4 @@
 	bool mUseViewCells;
 	bool mViewCellsLoaded;
-	bool mUseVisibilityFilter;
 
 	float mFloorDist;
