Index: trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
===================================================================
--- trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h	(revision 87)
+++ trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h	(revision 92)
@@ -50,4 +50,7 @@
 	GtpVisibility::VisibilityManager *getVisibilityManager( void );
 
+	//writes out into the Ogre log file
+	void WriteLog();
+
 protected:
 	
Index: trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
===================================================================
--- trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h	(revision 86)
+++ trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h	(revision 92)
@@ -7,5 +7,6 @@
 #include <OgreRenderSystem.h>
 
-#include "OgreSolidHalfBoundingBox.h"
+//#include "OgreSolidHalfBoundingBox.h"
+#include "OgreSolidBoundingBox.h"
 #include "HierarchyInterface.h"
 #include "OgrePlatformOcclusionQuery.h"
@@ -81,9 +82,12 @@
 	/** Returns pointer to current renderable half bounding box geometry
 	*/
-	SolidHalfBoundingBox *GetSolidHalfBoundingBox();
+	//SolidHalfBoundingBox *GetSolidHalfBoundingBox();
+	/** Returns pointer to current renderable bounding box geometry
+	*/
+	SolidBoundingBox *GetSolidBoundingBox();
 
 	/** one renderable half of an aabb. 
 	*/
-	SolidHalfBoundingBox *mSolidHalfBoundingBox;
+	SolidBoundingBox *mSolidBoundingBox;
 
 	SceneManager *mSceneManager;
Index: trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h
===================================================================
--- trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h	(revision 86)
+++ trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h	(revision 92)
@@ -6,7 +6,7 @@
 namespace Ogre {
 
-/** Allows the rendering of one half of a solid bounding box.
+/** The renderable of one half of a solid bounding box.
     @remarks
-        This class builds a wireframe renderable from a given aabb. A pointer to this class can be
+        This class builds a solid renderable from a given aabb. A pointer to this class can be
 		added to a render queue to display the bounding box of an object.
 */
Index: trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
===================================================================
--- trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 87)
+++ trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 92)
@@ -53,6 +53,9 @@
 	GtpVisibility::VisibilityManager *getVisibilityManager();
 	
+	//writes out statis into the Ogre log file
+	void WriteLog();
+
 protected:
-
+	
 	OctreeHierarchyInterface *mHierarchyInterface;
 	GtpVisibility::VisibilityManager *mVisibilityManager;
Index: trunk/VUT/Ogre/include/OgreSolidBoundingBox.h
===================================================================
--- trunk/VUT/Ogre/include/OgreSolidBoundingBox.h	(revision 92)
+++ trunk/VUT/Ogre/include/OgreSolidBoundingBox.h	(revision 92)
@@ -0,0 +1,57 @@
+#ifndef _SolidBoundingBox_H__
+#define _SolidBoundingBox_H__
+
+#include "OgreSimpleRenderable.h"
+
+namespace Ogre {
+
+/** A renderable of a solid bounding box using a material with no depth write,
+	no colors, and no lighting.
+*/
+class SolidBoundingBox : public SimpleRenderable
+{
+public:
+
+	SolidBoundingBox();
+	~SolidBoundingBox();
+	/** Sets up the solid box.
+		@param aab the axis aligned bounding box
+	*/
+	void SetupBoundingBox(const AxisAlignedBox& aabb);
+	
+	/** Builds the wireframe line list.
+		@param aab the axis aligned bounding box for setting up the vertices
+    */
+	void SetupBoundingBoxVertices(const AxisAlignedBox& aab);
+
+	Real getSquaredViewDepth(const Camera* cam) const;
+
+	Real getBoundingRadius(void) const { return mRadius; }
+
+protected:
+		/** 
+			Sets the material used for occlusion queries. 
+			@remark the material is called "OcclusionQuery" and
+			uses no lighting, no depth write, and no colours
+		*/
+		void SetOcclusionQueryMaterial();
+        /** Override this method to prevent parent transforms (rotation,translation,scale)
+        */
+		void getWorldTransforms( Matrix4* xform ) const;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+		
+        /** Builds the wireframe line list.
+        */
+		void setupBoundingBoxVertices(const AxisAlignedBox& aab);
+
+        Real mRadius;
+};
+
+}// namespace Ogre
+
+#endif // SolidBoundingBox
+
+
Index: trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj
===================================================================
--- trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 74)
+++ trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 92)
@@ -196,4 +196,7 @@
 				</File>
 				<File
+					RelativePath="..\include\OgreSolidBoundingBox.h">
+				</File>
+				<File
 					RelativePath="..\include\OgreSolidHalfBoundingBox.h">
 				</File>
@@ -216,4 +219,7 @@
 				<File
 					RelativePath="..\src\OgreSceneNodeHierarchyInterface.cpp">
+				</File>
+				<File
+					RelativePath="..\src\OgreSolidBoundingBox.cpp">
 				</File>
 				<File
Index: trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 91)
+++ trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 92)
@@ -5,4 +5,5 @@
 #include <OgreRenderSystem.h>
 #include <OgreCamera.h>
+#include <OgreLogManager.h>
 
 #include <windows.h>
@@ -73,4 +74,7 @@
 	clearSpecialCaseRenderQueues();
 	SceneManager::_renderVisibleObjects();
+
+	// write out stats
+	WriteLog();
 }
 //-----------------------------------------------------------------------
@@ -141,4 +145,16 @@
 	return mVisibilityManager;
 }
+void VisibilityOctreeSceneManager::WriteLog()
+{
+	std::stringstream d;
 
+	d << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", "
+	  << "Hierarchy nodes: " << mNumOctreeNodes << ", " << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", "
+	  << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", "
+	  << "Query culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes() << ", "
+	  << "Frustum culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes() << ", "
+      << "Queries issued: " << mVisibilityManager->GetCullingManager()->GetNumQueriesIssued() << "\n";
+
+	LogManager::getSingleton().logMessage(d.str());
+}
 }   // namespace Ogre
Index: trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 91)
+++ trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 92)
@@ -1,7 +1,6 @@
-//#include <OgreMath.h>
-//#include <OgreIteratorWrappers.h>
 #include <OgreCamera.h>
 
-#include "OgreSolidHalfBoundingBox.h"
+//#include "OgreSolidHalfBoundingBox.h"
+#include "OgreSolidBoundingBox.h"
 #include "OgrePlatformHierarchyInterface.h"
 #include "OgrePlatformOcclusionQuery.h"
@@ -12,5 +11,5 @@
 //-----------------------------------------------------------------------
 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys):
-mSceneManager(sm), mRenderSystem(rsys), mSolidHalfBoundingBox(NULL)
+mSceneManager(sm), mRenderSystem(rsys), mSolidBoundingBox(NULL)/*, mSolidHalfBoundingBox(NULL)*/
 {
 }
@@ -20,6 +19,6 @@
 	DeleteQueries();
 
-	if(mSolidHalfBoundingBox)
-		delete mSolidHalfBoundingBox;
+	if(mSolidBoundingBox)
+		delete mSolidBoundingBox;
 }
 //-----------------------------------------------------------------------
@@ -37,19 +36,25 @@
 
 	//TODO: this should be the full bounding box
-	SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox();
+	SolidBoundingBox *solidBox = GetSolidBoundingBox();
 	
 	mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY);
-	mSceneManager->useRenderableViewProjMode(halfbox);
-    mSceneManager->setPass(halfbox->getTechnique()->getPass(0));
+	mSceneManager->useRenderableViewProjMode(solidBox);
+    mSceneManager->setPass(solidBox->getTechnique()->getPass(0));
+
+	solidBox->SetupBoundingBoxVertices(*box);
+				
+	solidBox->getRenderOperation(ro);
+	ro.srcRenderable = solidBox;
+	mRenderSystem->_render(ro);
 
 	// Render two halfes of the bounding box (using triangle fans)
-	for(int halfIdx = 0; halfIdx < 2; ++halfIdx)
+	/*for(int halfIdx = 0; halfIdx < 2; ++halfIdx)
 	{
-		halfbox->SetupBoundingBoxVertices(*box, halfIdx == 1);
+		solidBox->SetupBoundingBoxVertices(*box, halfIdx == 1);
 				
-		halfbox->getRenderOperation(ro);
-		ro.srcRenderable = halfbox;
+		solidBox->getRenderOperation(ro);
+		ro.srcRenderable = solidBox;
 		mRenderSystem->_render(ro);
-	}
+	}*/
 }
 //-----------------------------------------------------------------------
@@ -121,10 +126,10 @@
 }
 //-----------------------------------------------------------------------
-SolidHalfBoundingBox *PlatformHierarchyInterface::GetSolidHalfBoundingBox()
+SolidBoundingBox *PlatformHierarchyInterface::GetSolidBoundingBox()
 {
-	if(!mSolidHalfBoundingBox)
-		mSolidHalfBoundingBox = new SolidHalfBoundingBox;
+	if(!mSolidBoundingBox)
+		mSolidBoundingBox = new SolidBoundingBox;
 
-	return mSolidHalfBoundingBox;
+	return mSolidBoundingBox;
 }
 
Index: trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp	(revision 92)
+++ trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp	(revision 92)
@@ -0,0 +1,166 @@
+#include "OgreStableHeaders.h"
+#include "OgreSolidBoundingBox.h"
+
+#include "OgreSimpleRenderable.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreCamera.h"
+#include "OgreMaterialManager.h"
+//#include <windows.h>
+
+namespace Ogre {
+
+#define POSITION_BINDING 0
+//-----------------------------------------------------------------------
+SolidBoundingBox::SolidBoundingBox()
+{
+	 mRenderOp.vertexData = new VertexData();
+	 mRenderOp.indexData = new IndexData();
+
+	 mRenderOp.indexData->indexStart = 0;
+	 mRenderOp.vertexData->vertexStart = 0;
+
+	 mRenderOp.vertexData->vertexCount = 8;
+	 mRenderOp.indexData->indexCount  = 36;
+
+	 mRenderOp.operationType = RenderOperation::OT_TRIANGLE_LIST; 
+	 mRenderOp.useIndexes = true; 
+
+     VertexDeclaration* decl = mRenderOp.vertexData->vertexDeclaration;
+     VertexBufferBinding* bind = mRenderOp.vertexData->vertexBufferBinding;
+
+     decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);
+	 //decl->addElement(INDEX_BINDING, 0, VET_, VES_POSITION);
+
+	 // create the vertex buffer
+     HardwareVertexBufferSharedPtr vbuf = 
+            HardwareBufferManager::getSingleton().createVertexBuffer(
+                decl->getVertexSize(POSITION_BINDING),
+                mRenderOp.vertexData->vertexCount,
+                HardwareBuffer::HBU_STATIC_WRITE_ONLY);
+
+     // Bind buffer
+     bind->setBinding(POSITION_BINDING, vbuf);
+
+	 //-- index buffer
+	 unsigned short faces[36] = 
+	 {
+        0,2,3,
+        0,1,2,
+        1,6,2,
+        1,5,6,
+        4,6,5,
+        4,7,6,
+        0,7,4,
+        0,3,7,
+        0,5,1,
+        0,4,5,
+        2,7,3,
+        2,6,7
+	 };
+
+	 /// Allocate index buffer of the requested number of vertices 
+     HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton().
+         createIndexBuffer(
+             HardwareIndexBuffer::IT_16BIT, 
+             mRenderOp.indexData->indexCount, 
+             HardwareBuffer::HBU_STATIC_WRITE_ONLY);
+
+	 /// 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");
+}
+SolidBoundingBox::~SolidBoundingBox() 
+{
+	delete mRenderOp.vertexData;
+	delete mRenderOp.indexData;
+}
+//-----------------------------------------------------------------------
+void SolidBoundingBox::SetupBoundingBoxVertices(const AxisAlignedBox& aab) 
+{
+	const Vector3& min = aab.getMinimum();
+    const Vector3& max = aab.getMaximum();
+
+	// fill the vertex buffer: 12 lines with 2 endpoints each make up a box
+    HardwareVertexBufferSharedPtr vbuf =
+        mRenderOp.vertexData->vertexBufferBinding->getBuffer(POSITION_BINDING);     
+
+    float* pPos = static_cast<float*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
+
+	*pPos++ = min.x; *pPos++ = max.y; *pPos++ = min.z; 
+	*pPos++ = max.x; *pPos++ = max.y; *pPos++ = min.z; 
+	*pPos++ = max.x; *pPos++ = min.y; *pPos++ = min.z; 
+	*pPos++ = min.x; *pPos++ = min.y; *pPos++ = min.z; 
+		
+	*pPos++ = min.x; *pPos++ = max.y; *pPos++ = max.z; 
+	*pPos++ = max.x; *pPos++ = max.y; *pPos++ = max.z; 
+	*pPos++ = max.x; *pPos++ = min.y; *pPos++ = max.z; 
+	*pPos++ = min.x; *pPos++ = min.y; *pPos++ = max.z;
+
+    vbuf->unlock();
+}
+//-----------------------------------------------------------------------
+void SolidBoundingBox::SetupBoundingBox(const AxisAlignedBox& aab)
+{
+	// init the vertices to the aabb
+	SetupBoundingBoxVertices(aab);
+
+	Real sqLen = std::max(aab.getMaximum().squaredLength(), 
+						  aab.getMinimum().squaredLength());
+    mRadius = Math::Sqrt(sqLen);
+
+    // setup the bounding box of this SimpleRenderable
+	setBoundingBox(aab);
+}
+//-----------------------------------------------------------------------
+void SolidBoundingBox::SetOcclusionQueryMaterial()
+{
+	m_pMaterial = MaterialManager::getSingleton().getByName("OcclusionQuery");
+
+	if(m_pMaterial.isNull())
+	{
+		m_pMaterial = MaterialManager::getSingleton().
+			create("OcclusionQuery", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		m_pMaterial->setColourWriteEnabled(false);
+		m_pMaterial->setDepthWriteEnabled(false);
+		m_pMaterial->setLightingEnabled(false);
+	}
+
+	setMaterial("OcclusionQuery");
+}
+
+// Override this method to prevent parent transforms (rotation,translation,scale)
+void SolidBoundingBox::getWorldTransforms(Matrix4* xform) const
+{
+	// return identity matrix to prevent parent transforms
+    *xform = Matrix4::IDENTITY;
+}
+//-----------------------------------------------------------------------
+const Quaternion& SolidBoundingBox::getWorldOrientation() const
+{
+	return Quaternion::IDENTITY;
+}
+//-----------------------------------------------------------------------
+const Vector3& SolidBoundingBox::getWorldPosition() const
+{
+	return Vector3::ZERO;
+}
+
+Real SolidBoundingBox::getSquaredViewDepth(const Camera* cam) const
+{
+	Vector3 min, max, mid, dist;
+
+	min = mBox.getMinimum();
+	max = mBox.getMaximum();
+	mid = ((min - max) * 0.5) + min;
+	dist = cam->getDerivedPosition() - mid;
+
+	return dist.squaredLength();
+}
+
+} // namespace Ogre
+
