Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 1185)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 1187)
@@ -61,6 +61,6 @@
 
 // test
-//String chc = "CHC";
-//setOption("RenderMethod", &chc);
+String chc = "CHC";
+setOption("RenderMethod", &chc);
 }
 
@@ -557,5 +557,5 @@
 		getRenderQueue()->clear();
 		if (mKdTree)
-			mKdTree->queueVisibleObjects(cam, getRenderQueue(), onlyShadowCasters, mRenderMethod, mShowBoxes);
+			mKdTree->queueVisibleObjects(cam, getRenderQueue(), onlyShadowCasters, mShowBoxes);
 	}
 	else
@@ -578,5 +578,5 @@
 				getRenderQueue()->clear();
 				if (mKdTree)
-					mKdTree->queueVisibleObjects(cam, getRenderQueue(), onlyShadowCasters, mRenderMethod, mShowBoxes);
+					mKdTree->queueVisibleObjects(cam, getRenderQueue(), onlyShadowCasters, mShowBoxes);
 			}
 
@@ -697,13 +697,19 @@
 			if (mUseDepthPass)
 			{
-				KdRenderableList::const_iterator it, it_end = mVisibleNodes.end();
-
-				//getRenderQueue()->clear();
-				for (it = mVisibleNodes.begin(); it != it_end; ++ it)
+				//KdRenderableList::const_iterator it, it_end = mVisibleNodes.end();
+
+				////getRenderQueue()->clear();
+				//for (it = mVisibleNodes.begin(); it != it_end; ++ it)
+				//{
+				//	(*it)->queueObjects(mCameraInProgress, getRenderQueue(), false);
+				//}
+				KdTree::NodeList::const_iterator it, end = mVisibleNodes.end();
+				for (it = mVisibleNodes.begin(); it != end; it++)
 				{
-					(*it)->queueObjects(mCameraInProgress, getRenderQueue(), false);
+					(*it)->queueVisibleObjects(mHierarchyInterface->GetFrameId(), mCameraInProgress,
+						getRenderQueue(), false, mShowBoxes);
 				}
 			}
-#endif	
+#endif
 			//-- now we can render all remaining queue objects
 			//-- used for depth pass, transparents, overlay
@@ -724,25 +730,28 @@
 }
 
-void KdTreeSceneManager::_renderNodes(const KdRenderableList& nodelist, Camera * cam, 
-	bool onlyShadowCasters, int leavePassesInQueue)
-{
-#ifdef GTP_VISIBILITY_MODIFIED_OGRE
+//void KdTreeSceneManager::_renderNodes(const KdRenderableList& nodelist, Camera * cam, 
+//	bool onlyShadowCasters, int leavePassesInQueue)
+void KdTreeSceneManager::_renderNode(KdTree::NodePtr node, Camera * cam, 
+									 bool onlyShadowCasters, int leavePassesInQueue)
+{
 	RenderQueueGroup *currentGroup = 
 		getRenderQueue()->getQueueGroup(getRenderQueue()->getDefaultQueueGroup());
 	currentGroup->clear(leavePassesInQueue);
-#else
-	getRenderQueue()->clear();
-#endif
-	KdRenderableList::const_iterator it = nodelist.begin();
-	KdRenderableList::const_iterator end = nodelist.end();
-	while (it != end)
-	{
-		if (!(*it)->isQueued(mHierarchyInterface->GetFrameId(), cam))
-		{
-			mVisibleNodes.push_back(*it);
-			(*it)->queueObjects(cam, getRenderQueue(), onlyShadowCasters);
-		}
-		it++;
-	}
+
+	node->queueVisibleObjects(mHierarchyInterface->GetFrameId(), cam, getRenderQueue(),
+		onlyShadowCasters, mShowBoxes);
+	mVisibleNodes.push_back(node);
+
+	//KdRenderableList::const_iterator it = nodelist.begin();
+	//KdRenderableList::const_iterator end = nodelist.end();
+	//while (it != end)
+	//{
+	//	if (!(*it)->isQueued(mHierarchyInterface->GetFrameId(), cam))
+	//	{
+	//		mVisibleNodes.push_back(*it);
+	//		(*it)->queueObjects(cam, getRenderQueue(), onlyShadowCasters);
+	//	}
+	//	it++;
+	//}
 
 	_renderQueueGroupObjects(currentGroup, QueuedRenderableCollection::OM_PASS_GROUP);
@@ -957,17 +966,20 @@
 		nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();
 
-		for (KdRenderableList::iterator it = mVisibleNodes.begin(); it != mVisibleNodes.end(); ++it)
+		for (KdTree::NodeList::iterator it = mVisibleNodes.begin(); it != mVisibleNodes.end(); ++it)
 		{
 			if (mRenderNodesForViz)
 			{
-				KdTreeSceneNode * node = static_cast<KdTreeSceneNode *>(*it);
-				// render the leaf nodes
-				if (node->numAttachedObjects() && 
-					!node->numChildren() && 
-					(node->getAttachedObject(0)->getMovableType() == "Entity") &&
-					node->getAttachedObject(0)->isVisible())
-				{
-					getRenderQueue()->addRenderable(node);
-				}
+				//KdTreeSceneNode * node = static_cast<KdTreeSceneNode *>(*it);
+				//// render the leaf nodes
+				//if (node->numAttachedObjects() && 
+				//	!node->numChildren() && 
+				//	(node->getAttachedObject(0)->getMovableType() == "Entity") &&
+				//	node->getAttachedObject(0)->isVisible())
+				//{
+				//	//getRenderQueue()->addRenderable(node);
+				//	node->_addBoundingBoxToQueue(getRenderQueue());
+				//}
+
+				/*** TODO: fix this ... maybe revert to original state, not quite happy now! ***/
 
 				// addbounding boxes instead of node itself
@@ -977,5 +989,7 @@
 			if (mRenderNodesContentForViz) 
 			{
-				(*it)->queueObjects(cam, getRenderQueue(), false);
+				//(*it)->queueObjects(cam, getRenderQueue(), false);
+				(*it)->queueVisibleObjects(mHierarchyInterface->GetFrameId(), 
+					cam, getRenderQueue(), false, mShowBoxes);
 			}
 		}
