Index: trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 155)
+++ trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 156)
@@ -9,4 +9,5 @@
 #include <OgreEntity.h>
 #include <OgreSubEntity.h>
+
 
 namespace Ogre {
@@ -31,5 +32,6 @@
 mSkipTransparents(false),
 mSavedShadowTechnique(SHADOWTYPE_NONE),
-mRenderOnlyBoundingBoxes(false)
+mRenderHierarchyNodes(false)
+//mRenderHierarchyNodes(true)
 {
 	mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem);
@@ -147,5 +149,5 @@
 	//Pass *usedPass = ((mRenderDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass); 
 	
-	// set depth fill pass only if depth write enabled
+	// set depth fill pass if we currently do not make an aabb occlusion query
 	Pass *usedPass = (mRenderDepthPass && !mHierarchyInterface->IsBoundingBoxQuery() ? 
 					  mDepthPass : pass);
@@ -208,4 +210,10 @@
 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
 {
+	// clear list of solid boxes (used for item buffer hierarchy node rendering)
+	/*for (int i=0; i<(int)mSolidBoxes.size(); ++i)
+		delete mSolidBoxes[i];
+
+	mSolidBoxes.clear();*/
+
 	//-- show visible scene nodes and octree bounding boxes from last frame
 	if (mShowVisualization)
@@ -213,6 +221,28 @@
 		PrepareVisualization(cam);
 	}
-	else if (mRenderOnlyBoundingBoxes)
-	{
+	else if (mRenderHierarchyNodes)
+	{
+		AxisAlignedBox aab;
+		
+
+		// get rendered hierarchy nodes from last frame
+		GtpVisibility::HierarchyNodeList *nodeList = mHierarchyInterface->GetRenderedNodes();
+		GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end();
+
+		for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt)		
+		{
+			SolidBoundingBox *solidBox = new SolidBoundingBox();
+			solidBox->SetupBoundingBox(aab);
+
+			Octree *octree = static_cast<Octree *>(*nodeIt);
+			solidBox->setId(octree->getId());
+			mSolidBoxes.push_back(solidBox);
+
+			aab = octree->_getWorldAABB();
+			std::stringstream d; d << "bounding box with id: " << octree->getId() << ", " << aab << "\n";
+			LogManager::getSingleton().logMessage(d.str());
+
+			getRenderQueue()->addRenderable(solidBox);	
+		}
 	}
 	else 
@@ -233,7 +263,7 @@
 	//TerrainSceneManager::_findVisibleObjects(cam, onlyShadowCasters);
 	
+	// -- delete lists stored for visualization
 	mVisible.clear();
 	mBoxes.clear();
-
 }
 //-----------------------------------------------------------------------
@@ -246,11 +276,12 @@
     // e.g., visualization, shadow pass
 
-	if (mShowVisualization || mRenderOnlyBoundingBoxes ||
-	   (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && mIlluminationStage == IRS_RENDER_TO_TEXTURE))
+	if (mShowVisualization || mRenderHierarchyNodes ||
+	   (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && 
+	    mIlluminationStage == IRS_RENDER_TO_TEXTURE))
 	{	
 		IlluminationRenderStage savedStage = mIlluminationStage; 
 	
-		if (mShowVisualization) 
-			// disable illumination stage because we want no shadows in visualization
+		if (mShowVisualization || mRenderHierarchyNodes) 
+			// disable illumination stage because we want no shadows
 			mIlluminationStage = IRS_NONE;
 
@@ -416,4 +447,8 @@
 		mUseItemBuffer = (*static_cast<const bool *>(val));
 		return true;
+	}
+	if (key == "RenderHierarchyNodes")
+	{
+		mRenderHierarchyNodes = (*static_cast<const bool *>(val));
 	}
 	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
@@ -503,5 +538,6 @@
 	}
 
-	//--- item buffer
+	// --- item buffer
+
     // Iterate through priorities
     RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator();
@@ -604,11 +640,5 @@
 
 	Pass *usedPass = setPass(mItemBufferPass); 
-	
-	/*if (rend->getId() > 0)
-	{
-		std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col[0] <<
-			" " << col[1] << " " << col[2] << " " << col[3];
-		LogManager::getSingleton().logMessage(d.str());
-	}*/
+
 
 	// Render a single object, this will set up auto params if required
