Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneNodeHierarchyInterface.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneNodeHierarchyInterface.cpp	(revision 2280)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneNodeHierarchyInterface.cpp	(revision 2455)
@@ -121,7 +121,7 @@
 {
 	// only create renderable bounding box for new node
-	if (node != mSavedNode)
+	if (node != mOldNode)
 	{
-		mSavedNode = node;
+		mOldNode = node;
 		mBox = static_cast<SceneNode *>(node)->_getWorldAABB();
 	}
@@ -151,6 +151,4 @@
 		{
 			Entity *ent = static_cast<Entity *>(movable);
-			//std::stringstream d; d << "ent " << ent->getName(); 
-			//LogManager::getSingleton().logMessage(d.str());
 			geometryList->push_back(ent);
 		}
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 2130)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 2455)
@@ -1419,5 +1419,5 @@
 	d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", "
 		<< "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", "
-		<< "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", "
+		//<< "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", "
 		<< "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", "
 		<< "Hierarchy nodes: " << (mKdTree ? mKdTree->getTreeStats().mNumNodes : 0) << ", " 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeHierarchyInterface.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeHierarchyInterface.cpp	(revision 2280)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeHierarchyInterface.cpp	(revision 2455)
@@ -84,7 +84,7 @@
 	// reuse box if node is the same
 	// only create renderable bounding box for new node
-	if (node != mSavedNode)
+	if (node != mOldNode)
 	{
-		mSavedNode = node;
+		mOldNode = node;
 		mBox = KDNODEPTR_CAST(node)->_getWorldAABB();
 	}
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp	(revision 2171)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp	(revision 2455)
@@ -24,4 +24,5 @@
 		return true;
 	}
+
 	if (key == "Threshold")
 	{
@@ -36,5 +37,5 @@
 	if (key == "TestGeometryForVisibleLeaves")
 	{
-		mHierarchyInterface->TestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
+		mVisibilityManager->SetTestGeometryForVisibleLeaves(*static_cast<const bool *>(val));
 		return true;
 	}
@@ -75,4 +76,22 @@
 		return true;
 	}
+	if (key == "TestGeometryForVisibleLeaves")
+	{
+		* static_cast<bool *>(val) = 
+			mVisibilityManager->GetTestGeometryForVisibleLeaves();
+		return true;
+	}
+	if (key == "AssumedVisibility")
+	{
+		* static_cast<unsigned int *>(val) = 
+			mVisibilityManager->GetAssumedVisibilityForChc();
+		return true;
+	}
+	if (key == "TestGeometryForVisibleLeaves")
+	{
+		* static_cast<unsigned int *>(val) = 
+			mVisibilityManager->GetRandomUpdateCandidatesForRuc();
+		return true;
+	}
 	
 	return false;
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneContentGenerator.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneContentGenerator.cpp	(revision 2280)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneContentGenerator.cpp	(revision 2455)
@@ -12,4 +12,6 @@
 namespace Ogre {
 
+
+
 /*************************************************************/
 /*           SceneContentGenerator implementation            */
@@ -169,9 +171,7 @@
 			&mScale.x, &mScale.y, &mScale.z);
 
-		GenerateSceneObject(position, orientation, objName);
-		
-		//std::stringstream d; d << StringConverter::toString(position) << " " << StringConverter::toString(orientation);
-		//LogManager::getSingleton().logMessage(d.str());
-	}
+		GenerateSceneObject(position, orientation, objName);	
+	}
+
 	ifstr.close();
 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp	(revision 2280)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp	(revision 2455)
@@ -12,24 +12,5 @@
 namespace Ogre {
 
-//----------------------------------------------------------------------- 
-/*
-PlatformQueryManager::PlatformQueryManager(PlatformHierarchyInterface *hierarchyInterface, 
-										   Viewport *vp, 
-										   int queryModes):
-//QueryManager(hierarchyInterface, queryModes), 
-QueryManager(queryModes),
-mViewport(vp), 
-mWasInitialised(false),
-mHierarchyInterface(hierarchyInterface)
-{
-}*/
-//-----------------------------------------------------------------------
-/*bool PlatformQueryManager::ShootRay(const Ray &ray, 
-									std::vector<Mesh *> *visibleMeshes, 
-									bool isGlobalLine)
-{
-    // run OGRE ray shooting query
-    return false;
-}*/
+
 //-----------------------------------------------------------------------
 void PlatformQueryManager::ComputeFromPointVisibility(
@@ -41,6 +22,5 @@
 											const bool approximateVisibility)
 {
-	SceneManager *sm =
-		static_cast<PlatformHierarchyInterface *>
+	SceneManager *sm = static_cast<PlatformHierarchyInterface *>
 								(mHierarchyInterface)->GetSceneManager();
 
@@ -95,5 +75,4 @@
 			                    relativeVisibility,
 								approximateVisibility);
-		//mViewport->getTarget()->update(); for(int j=0; j<10000000; j++)	printf("wait");
 
 		// permute directions
@@ -176,6 +155,4 @@
 	uchar *buf = mViewport->getTarget()->getBufferContents(dimx, dimy);
 
-	//std::stringstream d; d << "dimx: " << dimx << ", dimy: " << dimy; LogManager::getSingleton().logMessage(d.str());
-
 	// loop through frame buffer and collect visible pixels
 	for (int idx = 0; idx < dimy * dimx * 3; idx += 3)
@@ -185,6 +162,4 @@
 		id += buf[idx + 1] << 8;
 		id += buf[idx + 2];
-
-		//std::stringstream d; d << "myid: " << (int)buf[idx] << " " << (int)buf[idx + 1] << " " << (int)buf[idx + 2]; LogManager::getSingleton().logMessage(d.str());
 
 		// if valid id <= add visibility (id values start at 1)
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp	(revision 2184)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp	(revision 2455)
@@ -71,15 +71,7 @@
 	 /// Upload the index data to the card
 	 ibuf->writeData(0, ibuf->getSizeInBytes(), faces, true);
-	 //mRenderOp.useSharedVertices = true;
 	 mRenderOp.indexData->indexBuffer = ibuf;
 	 // set material with no lighting, no color, no depth write
 	 SetOcclusionQueryMaterial();
-	 //setMaterial("BaseWhiteNoLighting");
-
-	/* std::stringstream d;
-	d << "vtx: " << mRenderOp.vertexData;
-	LogManager::getSingleton().logMessage(d.str());
-	*/
-
 }
 //-----------------------------------------------------------------------
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 2402)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 2455)
@@ -311,4 +311,5 @@
 	}
 
+	/////////////
 	val = config.getSetting("OnlineCullingAlgorithm");
 		
@@ -357,5 +358,45 @@
 
 	/////////////
-	// terrain options
+	val = config.getSetting("TestGeometryForVisibleLeaves");
+
+	if (!val.empty())
+	{
+		if (val == "yes")
+			mVisibilityManager->SetTestGeometryForVisibleLeaves(true);
+		else
+			mVisibilityManager->SetTestGeometryForVisibleLeaves(false);
+	}
+
+	/////////////
+	val = config.getSetting("TestGeometryBounds");
+
+	if (!val.empty())
+	{
+		if (val == "yes")
+			mHierarchyInterface->SetTestGeometryBounds(true);
+		else
+			mHierarchyInterface->SetTestGeometryBounds(false);
+	}
+
+	/////////////
+	val = config.getSetting("AssumedVisibleFrames");
+
+	if (!val.empty())
+	{
+		mVisibilityManager->SetAssumedVisibilityForChc(atoi(val.c_str()));
+	}
+
+
+	/////////////
+	val = config.getSetting("RandomUpdateCandidates");
+
+	if (!val.empty())
+	{
+		mVisibilityManager->SetRandomUpdateCandidatesForRuc(atoi(val.c_str()));
+	}
+
+
+	/////////////
+	// output
 
 	if (mUseDepthPass)
@@ -395,4 +436,18 @@
 	else
 		LogManager::getSingleton().logMessage("not flushing queue after some frames");
+
+	if (mVisibilityManager->GetTestGeometryForVisibleLeaves())
+		LogManager::getSingleton().logMessage("test geometry for visible leaves");
+	else
+		LogManager::getSingleton().logMessage("not testing geometry for visible leaves");
+	
+	if (mHierarchyInterface->GetTestGeometryBounds())
+		LogManager::getSingleton().logMessage("test geometry bounds instead of bounding box");
+	else
+		LogManager::getSingleton().logMessage("not testing geometry bounds instead of bounding box");
+
+
+	/////////////
+	// terrain options
 
 	if (!mShowTerrain)
@@ -1263,5 +1318,5 @@
 	d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", "
 	  << "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", "
-	  << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", "
+//	  << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", "
 	  << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", "
 	  << "Hierarchy nodes: " << mNumOctants << ", " 
@@ -1686,5 +1741,4 @@
 		LogManager::getSingleton().logMessage("error: should not come here");
 		// question: if no view cell, set everything visible?
-		//SetObjectsVisible(true);
 		SetObjectsVisible(false);
 		return;
@@ -1693,7 +1747,4 @@
 	////////////
 	//-- set PVS of view cell to visible
-
-	//std::stringstream d; d << "appying new view cell pvs: " << vc->GetPvs().GetSize();
-	//LogManager::getSingleton().logMessage(d.str());
 
 	GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator();
@@ -1717,7 +1768,4 @@
 	const GtpVisibilityPreprocessor::Vector3 viewPoint = 
 		OgreTypeConverter::ConvertFromOgre(cam->getDerivedPosition());
-
-	//std::stringstream d; d << "vp: " << viewPoint;
-	//LogManager::getSingleton().logMessage(d.str());
 
 	GtpVisibilityPreprocessor::ViewCell *newElementary = 
@@ -2173,7 +2221,4 @@
     }
 
-	// Prepare render queue for receiving new objects
-	//prepareRenderQueue();
-
 	mDestRenderSystem->_beginGeometryCount();
     // Begin the frame
@@ -2281,13 +2326,12 @@
 	///////////////////////
 	//-- put items in render queue
-	//////////
 
 	getRenderQueue()->clear();
 
-	//////////////////////
-	//-- apply queries on geometry level
-
 	if (!nodeVisibility)
 	{
+		//////////////////
+		//-- apply queries on geometry level
+
 		MeshInfoContainer::iterator geomIt, geomIt_end = visibleGeometry.end();
 
@@ -2384,7 +2428,7 @@
         if (camera->isWindowSet())  
         {
-            const std::vector<Plane>& planeList = 
-                camera->getWindowPlanes();
-            for (ushort i = 0; i < 4; ++i)
+			const std::vector<Plane>& planeList = camera->getWindowPlanes();
+
+            for (ushort i = 0; i < 4; ++ i)
             {
                 mDestRenderSystem->enableClipPlane(i, true);
@@ -2421,5 +2465,4 @@
 
 	RenderHierarchicalCulling(fillQueue);
-	// _renderVisibleObjects();
    
     // End frame
@@ -2529,7 +2572,5 @@
 
 		if (mQueryMode == 2)
-		{
 			approximateVisibility = true;
-		}
 	}
 	else
@@ -2542,5 +2583,4 @@
 		new OcclusionQueriesQueryManager(mHierarchyInterface,
 										 cam->getViewport(),
-										 //mCurrentViewport,
 										 queryModes, 
 										 itemBufferMode);
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp	(revision 2360)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp	(revision 2455)
@@ -3,4 +3,5 @@
 #include <OgreLogManager.h>
 #include <OgreStringConverter.h>
+#include <OgreOctreeNode.h>
 
 
@@ -187,50 +188,4 @@
 }
 //-----------------------------------------------------------------------
-void OctreeHierarchyInterface::DetermineVisibilityRatio(GtpVisibility::HierarchyNode *node) const
-{	
-#if 0	
-	Octree *octant = static_cast<Octree *>(node);
-
-	// node not visited in this frame => no change
-	if (octant->lastVisited() != mFrameId)
-		return;
-	
-	// leaf node: terminate recursion
-	if (IsLeaf(node))
-	{
-		octant->setNumLeaves(1);	
-		octant->setNumVisibleLeaves(octant->isOctreeVisible() ? 1 : 0);	
-		return;
-	}
-
-	int numVisibleLeaves = 0;
-	int numLeaves = 0;
-
-	Octree *nextChild;
-	
-	for (int i = 0; i < 8; ++ i)
-	{
-		int x = (i & 4) / 4;
-		int y = (i & 2) / 2;
-		int z = i & 1;
-
-		nextChild = octant->mChildren[x][y][z];
-
-		if (!nextChild)
-			continue;
-		
-		// recursive traversal
-		DetermineVisibilityRatio(nextChild);
-		
-		// this leaf is not fully visible
-		numLeaves += nextChild->getNumLeaves();
-		numVisibleLeaves += nextChild->getNumVisibleLeaves();
-	}
-
-	octant->setNumLeaves(numLeaves);
-	octant->setNumVisibleLeaves(numVisibleLeaves);
-#endif
-}
-//-----------------------------------------------------------------------
 void OctreeHierarchyInterface::RenderNode(GtpVisibility::HierarchyNode *node)
 {
@@ -290,13 +245,4 @@
 }
 //-----------------------------------------------------------------------
-float OctreeHierarchyInterface::GetNodeVisibilityRatio(GtpVisibility::HierarchyNode *node) const
-{
-#if 0
-	return static_cast<Octree *>(node)->getVisibilityRatio();
-#else
-	return 1.0f;
-#endif
-}
-//-----------------------------------------------------------------------
 unsigned int OctreeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) const
 {
@@ -312,7 +258,7 @@
 	// reuse box if node is the same
 	// only create renderable bounding box for new node
-	if (node != mSavedNode)
-	{
-		mSavedNode = node;
+	if (node != mOldNode)
+	{
+		mOldNode = node;
 	    //static_cast<Octree *>(node)->_getCullBounds(&mBox);
 		mBox = static_cast<Octree *>(node)->_getWorldAABB();
@@ -374,16 +320,8 @@
 			
 			for (int z = 0; z < 2; ++ z)
-			{	
 				for (int y = 0; y < 2; ++ y)
-				{
 					for (int x = 0; x < 2; ++ x)
-					{
 						if ((child = octree->mChildren[x][y][z]) != NULL)
-						{
 							tStack.push(child);
-						}
-					}
-				}
-			}
 		}
 	}
@@ -394,7 +332,37 @@
 {
 	Octree *octree = static_cast<Octree *>(node);
-
 	return octree->getParent();
 }
+//-----------------------------------------------------------------------
+int OctreeHierarchyInterface::GetNodeAssumedVisible(GtpVisibility::HierarchyNode *node)
+{
+	Octree *octree = static_cast<Octree *>(node);
+	return octree->getAssumedVisible();
+}
+//-----------------------------------------------------------------------
+void OctreeHierarchyInterface::SetNodeAssumedVisible(GtpVisibility::HierarchyNode *node, int assumedVisible)
+{
+	Octree *octree = static_cast<Octree *>(node);
+	octree->setAssumedVisible(assumedVisible);
+}
+//-----------------------------------------------------------------------
+void OctreeHierarchyInterface::DecNodeAssumedVisible(GtpVisibility::HierarchyNode *node)
+{
+	Octree *octree = static_cast<Octree *>(node);
+	octree->decAssumedVisible();
+}
+//-----------------------------------------------------------------------
+void OctreeHierarchyInterface::RenderGeometryBounds(GtpVisibility::HierarchyNode *node)
+{
+	Octree *octree = static_cast<Octree *>(node);
+
+	NodeList::iterator it, it_end = octree->mNodes.end();
+
+    for (it = octree->mNodes.begin(); it != it_end; ++ it)
+    {
+		RenderBoundingBox(&(*it)->_getWorldAABB());
+    }	
+}
+
 
 } // namespace Ogre
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBiHierarchySceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBiHierarchySceneManager.cpp	(revision 2402)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBiHierarchySceneManager.cpp	(revision 2455)
@@ -1429,5 +1429,5 @@
 	d << "Depth pass: " << StringConverter::toString(mUseDepthPass) << ", "
 		<< "Delay transparents: " << StringConverter::toString(mDelayRenderTransparents) << ", "
-		<< "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", "
+		//<< "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", "
 		<< "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", "
 		<< "Hierarchy nodes: " << (mBiHierarchy ? mBiHierarchy->getTreeStats().mNumNodes : 0) << ", " 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp	(revision 2318)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp	(revision 2455)
@@ -99,14 +99,12 @@
 	mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY);
 	mSceneManager->useRenderableViewProjModeWrapper(solidBox);
-	// HACK! (mySetPass should be setPass)
+	
 	// set no depth write, no color, no lighting material
 	mSceneManager->setPassWrapper(solidBox->getTechnique()->getPass(0));
-	//mSceneManager->_setPass(solidBox->getTechnique()->getPass(0)); 
-	//SetOcclusionPass();
-
 	solidBox->SetupBoundingBoxVertices(*box);
 
 	solidBox->getRenderOperation(ro);
 	ro.srcRenderable = solidBox;
+	
 	//std::stringstream d;
 	//d << "vt2: " << ro.vertexData;
@@ -132,8 +130,4 @@
 	{
 		mOcclusionQueries.push_back(new PlatformOcclusionQuery(mRenderSystem));
-
-		/*std::stringstream d;
-		d << "resizing queries: " << (int)mOcclusionQueries.size() << std::endl;
-		LogManager::getSingleton().logMessage(d.str());*/
 	}
 	
@@ -147,5 +141,5 @@
 	GtpVisibility::HierarchyInterface::InitTraversal();
 	
-	mSavedNode = NULL;
+	mOldNode = NULL;
 	mLeavePassesInQueue = leavePassesInQueue;
 
@@ -181,5 +175,5 @@
 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueNodeOcclusionQuery(
 	                                                                      GtpVisibility::HierarchyNode *node, 
-																		  const bool wasVisible) 
+																		  const bool testGeometry) 
 {
 	// get next available test id
@@ -189,20 +183,27 @@
 	query->BeginQuery();
 	
-	// if node is leaf and was visible => will be rendered anyway.
-	// In this case we can also test with the real geometry.
-	// If camera for culling is different from camera for rendering or only solids 
-	// will be rendered => cannot optimize
-	if (mTestGeometryForVisibleLeaves && (mCamera == mCullCamera) && wasVisible && IsLeaf(node)) 
-	{
+	if (testGeometry && IsLeaf(node))
+	{
+		// if node is a leaf and was visible => will be rendered anyway.
+		// In this case we can also test with the real geometry.
 		RenderNode(node);
 	}
-	else
-	{
-		// this information is used e.g., by the scene graph, because the bounding box
-		// must be treated differently to the scene geometry during rendering
-		mIsBoundingBoxQuery = true;
-		RenderBoundingBox(GetBoundingBox(node));
-
-		mIsBoundingBoxQuery = false;
+	else 
+	{
+		if (mTestGeometryBounds && IsLeaf(node))
+		{
+			mIsBoundingBoxQuery = true;
+			// we can also test the tighter bounds of the geometry instead of the hierarchy nodes.
+			RenderGeometryBounds(node);
+			mIsBoundingBoxQuery = false;
+		}
+		else
+		{
+			// this information is used e.g., by the scene graph, because the bounding box
+			// must be treated differently to the scene geometry during rendering
+			mIsBoundingBoxQuery = true;
+			RenderBoundingBox(GetBoundingBox(node));
+			mIsBoundingBoxQuery = false;
+		}
 	}
 
@@ -236,7 +237,8 @@
 	////////
 	//-- the actual query test
-
 	query->BeginQuery();
+
 	RenderGeometry(mesh);
+	
 	query->EndQuery();
 
@@ -244,31 +246,8 @@
 }
 //-----------------------------------------------------------------------
-/*void PlatformHierarchyInterface::SetOcclusionPass()
-{
-    // disable vertex and fragment program
-	mRenderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM);
-	mRenderSystem->unbindGpuProgram(GPT_FRAGMENT_PROGRAM);
-	
-	// disable lighting
-	mRenderSystem->setLightingEnabled(false);
-
-    // Disable remaining texture units
-    mRenderSystem->_disableTextureUnitsFrom(0);
-
-    //--Set up non-texture related material settings
-   
-	// Depth buffer settings
-	mRenderSystem->_setDepthBufferParams(true, false, CMPF_LESS_EQUAL);
-	// Set colour write mode off
-	mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false);
-}*/
-//-----------------------------------------------------------------------
 SolidBoundingBox *PlatformHierarchyInterface::GetSolidBoundingBox()
 {
 	if (!mSolidBoundingBox)
-	{
 		mSolidBoundingBox = new SolidBoundingBox;
-		//LogManager::getSingleton().logMessage("solid box created");
-	}
 
 	return mSolidBoundingBox;
@@ -285,9 +264,4 @@
 }
 //-----------------------------------------------------------------------
-bool PlatformHierarchyInterface::GetTestGeometryForVisibleLeaves()
-{
-	return mTestGeometryForVisibleLeaves;
-}
-//-----------------------------------------------------------------------
 bool PlatformHierarchyInterface::IsBoundingBoxQuery()
 {
@@ -314,4 +288,14 @@
 	return mRenderSystem;
 }
+//-----------------------------------------------------------------------
+void PlatformHierarchyInterface::SetTestGeometryBounds(bool testGeometryBounds)
+{
+	mTestGeometryBounds = testGeometryBounds;
+}
+//-----------------------------------------------------------------------
+int PlatformHierarchyInterface::GetTestGeometryBounds()
+{
+	return mTestGeometryBounds;
+}
 
 } // namespace Ogre
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBiHierarchyInterface.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBiHierarchyInterface.cpp	(revision 2348)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBiHierarchyInterface.cpp	(revision 2455)
@@ -84,7 +84,7 @@
 	// reuse box if node is the same
 	// only create renderable bounding box for new node
-	if (node != mSavedNode)
+	if (node != mOldNode)
 	{
-		mSavedNode = node;
+		mOldNode = node;
 		mBox = BIHNODEPTR_CAST(node)->_getWorldAABB();
 	}
