Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h	(revision 1220)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h	(revision 1250)
@@ -213,4 +213,6 @@
 			virtual bool isEmpty() const = 0;
 			virtual bool hasGeometry() const = 0;
+			
+			virtual void mergeLeaves(std::set<Leaf *>& leaves) = 0;
 
 			// Gets this node's parent (NULL if this is the root).
@@ -223,5 +225,5 @@
 			// add contained objects to render queue
 			virtual void queueVisibleObjects(unsigned long currentFrame, 
-				Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes) = 0;
+				Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false) = 0;
 
 			// add contained geometry (Entities) to list
@@ -326,4 +328,10 @@
 			virtual bool hasGeometry() const { return false; };
 
+			virtual void mergeLeaves(std::set<Leaf *>& leaves)
+			{
+				for (std::set<Leaf *>::iterator it = mLeaves.begin(); it != mLeaves.end(); it++)
+					leaves.insert(*it);
+			}
+
 			// a branch should have at least one child
 			virtual KdTree::Node * getLeftChild() const { return mLeft; };
@@ -331,9 +339,13 @@
 
 			virtual void queueVisibleObjects(unsigned long currentFrame, 
-				Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes)
+				Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false)
 			{
 				if (showBoxes)
 					if (mLevel == mOwner->getHiLiteLevel() || mOwner->getShowAllBoxes())
 						queue->addRenderable(getWireBoundingBox());
+
+				if (fullVis)
+					for (std::set<Leaf *>::iterator it = mLeaves.begin(); it != mLeaves.end(); it ++)
+						(*it)->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, fullVis);
 			}
 
@@ -347,8 +359,15 @@
 				mWorldAABB.setNull();
 
+				// merge box & leaves
 				if (mLeft)
+				{
 					mWorldAABB.merge(mLeft->mWorldAABB);
+					mLeft->mergeLeaves(mLeaves);
+				}
 				if (mRight)
+				{
 					mWorldAABB.merge(mRight->mWorldAABB);
+					mRight->mergeLeaves(mLeaves);
+				}
 
 				// update parent recursively
@@ -361,4 +380,6 @@
 			Plane  * mSplitPlane;
 			PlaneEvent::Side mPlaneSide;
+		protected:
+			std::set<Leaf *> mLeaves;
 		};
 
@@ -373,11 +394,14 @@
 
 			// a leaf is a leaf, dammit
-			virtual bool isLeaf() const { return true; };
+			virtual bool isLeaf() const { return true; }
 
 			// a leaf is empty when it does not posses renderables
-			virtual bool isEmpty() const { return mKdRenderables.empty(); };
+			virtual bool isEmpty() const { return mKdRenderables.empty(); }
 
 			// a leaf has geometry when it has renderables
-			virtual bool hasGeometry() const { return !mKdRenderables.empty(); };
+			virtual bool hasGeometry() const { return !mKdRenderables.empty(); }
+
+			// a leaf adds itself to the leaf set
+			virtual void mergeLeaves(std::set<Leaf *>& leaves)	{ leaves.insert(this); }
 
 			// a leaf never has children 
@@ -386,5 +410,5 @@
 
 			virtual void queueVisibleObjects(unsigned long currentFrame, 
-				Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes);
+				Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis = false);
 
 			virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList);
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h	(revision 1212)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h	(revision 1250)
@@ -51,4 +51,7 @@
 	// enhanced visibility
 	NodeVisibility getVisibilityEnhanced(const AxisAlignedBox& box) const;
+
+	// DEBUG
+	//mutable unsigned int mNumVisQueries;
 protected:
 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp	(revision 1212)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp	(revision 1250)
@@ -28,8 +28,4 @@
 {
 	mEnhancedVisMode = enhanced;
-	//if (mEnhancedVisMode)
-	//	getVisibility = getVisibilityEnhanced;
-	//else
-	//	getVisibility = getVisibilitySimple;
 }
 
@@ -43,4 +39,5 @@
 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilityEnhanced(const AxisAlignedBox& box) const
 {
+	//++ mNumVisQueries;
 	// Null boxes always invisible
 	if ( box.isNull() )
@@ -101,4 +98,6 @@
 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilitySimple(const AxisAlignedBox& box) const
 {
+	//++ mNumVisQueries;
+
 	// dummy
 	FrustumPlane* culledBy = 0;
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp	(revision 1211)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp	(revision 1250)
@@ -1188,7 +1188,13 @@
 		bool showBoxes, KdTree::NodeList& visibleNodes)
 	{
+		// debug
+		//cam->mNumVisQueries = 0;
+
 		if (mKdRoot)
 			recQueueVisibleObjects(mKdRoot, Root::getSingleton().getCurrentFrameNumber(),
 				cam, queue, onlyShadowCasters, showBoxes, visibleNodes);
+
+		//mBuildLog->logMessage("Frame # " + StringConverter::toString(Root::getSingleton().getCurrentFrameNumber()) +
+		//	" ," + StringConverter::toString(cam->mNumVisQueries) + " vis queries");
 	}
 
@@ -1207,14 +1213,17 @@
 			visibleNodes.push_back(node);
 
-			node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes);
-
-			if (node->getLeftChild())
-				recQueueVisibleObjects(node->getLeftChild(), currentFrame, 
-				cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 
-				(fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false);
-			if (node->getRightChild())
-				recQueueVisibleObjects(node->getRightChild(), currentFrame, 
-				cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 
-				(fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false);
+			bool v = (fullVis || vis == KdTreeCamera::KDNV_FULL);
+			node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, v);
+
+			if (!v)
+			{
+
+				if (node->getLeftChild())
+					recQueueVisibleObjects(node->getLeftChild(), currentFrame, 
+					cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v);
+				if (node->getRightChild())
+					recQueueVisibleObjects(node->getRightChild(), currentFrame, 
+					cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v);
+			}
 		}
 	}
@@ -1366,5 +1375,5 @@
 	//-------------------------------------------------------------------------
 	void KdTree::Leaf::queueVisibleObjects(unsigned long currentFrame, 
-		Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes)
+		Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, bool fullVis)
 	{
 		KdRenderableList::iterator it  = mKdRenderables.begin();
Index: GTP/trunk/Lib/Vis/GtpVisibility.sln
===================================================================
--- GTP/trunk/Lib/Vis/GtpVisibility.sln	(revision 1239)
+++ GTP/trunk/Lib/Vis/GtpVisibility.sln	(revision 1250)
@@ -10,5 +10,4 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "OnlineCullingCHC\IVReader\src\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}"
 	ProjectSection(ProjectDependencies) = postProject
-		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}
 	EndProjectSection
 EndProject
@@ -30,4 +29,6 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingTerrain", "..\..\App\Demos\Vis\HillyTerrain\OGRE\TestCullingTerrain.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}"
 	ProjectSection(ProjectDependencies) = postProject
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}
+		{7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D}
 	EndProjectSection
 EndProject
@@ -35,4 +36,5 @@
 	ProjectSection(ProjectDependencies) = postProject
 		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}
+		{7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D}
 	EndProjectSection
 EndProject
