Index: /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1250)
+++ /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1258)
@@ -41,4 +41,5 @@
 #include <OgreStringConverter.h>
 #include <OgreException.h>
+#include <OgreTextAreaOverlayElement.h>
 
 #include <OgreKdTree.h>
@@ -239,4 +240,5 @@
 
 	OverlayElement *mDemoStatus;
+	TextAreaOverlayElement *mDemoTime;
 
 
Index: /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp	(revision 1250)
+++ /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp	(revision 1258)
@@ -37,6 +37,5 @@
 				.addOpt("s","scenemgr", ARGUMENT_REQUIRED)
 				.addOpt("","comment", ARGUMENT_REQUIRED)
-				.addOpt("e","enhancevis", ARGUMENT_NONE)
-				.addOpt("","logint",ARGUMENT_REQUIRED);
+				.addOpt("e","enhancevis", ARGUMENT_NONE);
 
 
@@ -88,11 +87,4 @@
 				s << tmp;
 				s >> options.mKI;
-				s.clear();
-			}
-
-			if (cmdparser.getOpt("logint", tmp))
-			{
-				s << tmp;
-				s >> options.mDemoInterval;
 				s.clear();
 			}
Index: /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp	(revision 1250)
+++ /GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp	(revision 1258)
@@ -164,4 +164,5 @@
 	mDemoOverlay = 0;
 	mDemoStatus = 0;
+	mDemoTime = 0;
 
 	initKdTreeOverlay();
@@ -1069,4 +1070,12 @@
 		mDemoStats.mTotalEllapsedTime += evt.timeSinceLastFrame;
 
+		// set time display
+		int m = (int)mDemoStats.mTotalEllapsedTime / 60;
+		int s = (int)mDemoStats.mTotalEllapsedTime % 60;
+
+		mDemoTime->setCaption(
+			StringConverter::toString(m, 2, '0') + ":" + 
+			StringConverter::toString(s, 2, '0'));
+
 		// store fps when in demo mode
 		if (mOptions.mDemoMode)
@@ -1154,4 +1163,16 @@
 	if (mAppState == AS_RECORD)
 	{
+		// update stats
+		++ mDemoStats.mTotalNumFrames;
+		mDemoStats.mTotalEllapsedTime += evt.timeSinceLastFrame;
+
+		// set time display
+		int m = (int)mDemoStats.mTotalEllapsedTime / 60;
+		int s = (int)mDemoStats.mTotalEllapsedTime % 60;
+
+		mDemoTime->setCaption(
+			StringConverter::toString(m, 2, '0') + ":" + 
+			StringConverter::toString(s, 2, '0'));
+
 		mFrameList.push_back(FrameInfo(mCamNode->getPosition(), mCamNode->getOrientation(), evt.timeSinceLastFrame));
 	}
@@ -1234,4 +1255,10 @@
 		// clear old recording
 		mFrameList.clear();
+
+		// reset stats
+		mDemoStats.mNumFrames = 0;
+		mDemoStats.mTotalNumFrames = 0;
+		mDemoStats.mEllapsedTime = 0.0f;
+		mDemoStats.mTotalEllapsedTime = 0.0f;
 	}
 	// stop recording
@@ -1572,8 +1599,9 @@
 {
 	// init overlay if not present
-	if (!mDemoOverlay || !mDemoStatus)
+	if (!mDemoOverlay || !mDemoStatus || !mDemoTime)
 	{
 		OGRE_DELETE(mDemoOverlay);
 		OGRE_DELETE(mDemoStatus);
+		OGRE_DELETE(mDemoTime);
 
 		mDemoStatus = OverlayManager::getSingleton().createOverlayElement("Panel", "KdTree/DemoStatus");
@@ -1585,7 +1613,30 @@
 		mDemoStatus->setDimensions(32, 32);
 
+		//mDemoTime = static_cast<TextAreaOverlayElement *>
+		//	(OverlayManager::getSingleton().createOverlayElementFromTemplate(
+		//	"KdTree/Templates/BasicText", "TextArea", "KdTree/DemoTime"));
+		mDemoTime = static_cast<TextAreaOverlayElement *>
+			(OverlayManager::getSingleton().createOverlayElement("TextArea", "KdTree/DemoTime"));
+		mDemoTime->setMetricsMode(GMM_PIXELS);
+		mDemoTime->setTop(6);
+		mDemoTime->setLeft(8);
+		mDemoTime->setFontName("TrebuchetMSBold");
+		mDemoTime->setCharHeight(24.0);
+		mDemoTime->setCaption("00:00");
+
+		PanelOverlayElement *timeCont = static_cast<PanelOverlayElement *>
+			(OverlayManager::getSingleton().createOverlayElement("Panel", "KdTree/DemoTimePanel"));
+		timeCont->setMetricsMode(GMM_PIXELS);
+		timeCont->setHorizontalAlignment(GHA_CENTER);
+		timeCont->setVerticalAlignment(GVA_TOP);
+		timeCont->setTop(5);
+		timeCont->setLeft(16);
+		timeCont->setDimensions(64, 32);
+		timeCont->addChild(mDemoTime);
+
 		mDemoOverlay = OverlayManager::getSingleton().create("KdTree/DemoOverlay");
 		mDemoOverlay->setZOrder(500);
 		mDemoOverlay->add2D(static_cast<PanelOverlayElement *>(mDemoStatus));
+		mDemoOverlay->add2D(timeCont);
 	}
 
@@ -1597,8 +1648,12 @@
 	case AS_PLAYBACK:
 		mDemoStatus->setMaterialName("KdTree/DemoPlayButton");
+		mDemoTime->setColourTop(ColourValue(0.5, 0.7, 0.5));
+		mDemoTime->setColourBottom(ColourValue(0.3, 0.5, 0.3));
 		mDemoOverlay->show();
 		break;
 	case AS_RECORD:
 		mDemoStatus->setMaterialName("KdTree/DemoRecordButton");
+		mDemoTime->setColourTop(ColourValue(0.7, 0.5, 0.5));
+		mDemoTime->setColourBottom(ColourValue(0.5, 0.3, 0.3));
 		mDemoOverlay->show();
 		break;
Index: /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h	(revision 1251)
+++ /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h	(revision 1258)
@@ -11,9 +11,15 @@
 #define _KdTreeSceneManager_H__
 
-#include <OgreKdTreeHierarchyInterface.h>
 #include <OgreSceneManager.h>
 #include <VisibilityManager.h>
+
+#include <OgreTerrainPrerequisites.h>
+#include <OgreTerrainRenderable.h>
+#include <OgreTerrainPageSource.h>
+#include <OgreIteratorWrappers.h>
+
 #include "OgreKdTree.h"
 #include "OgreKdTreeCamera.h"
+#include "OgreKdTreeHierarchyInterface.h"
 
 #define KDTREE_MAX_DEPTH 12
Index: /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 1251)
+++ /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 1258)
@@ -11,12 +11,17 @@
 #include <OgreSubEntity.h>
 #include <OgreMaterialManager.h>
+#include <OgreLogManager.h>
+#include <OgreStringConverter.h>
+
+#include <OgreTerrainPage.h>
+#include <OgreTerrainVertexProgram.h>
+#include <OgreHeightmapTerrainPageSource.h>
+
 #include "OgreKdTreeSceneManager.h"
 #include "OgreKdTreeSceneNode.h"
 #include "OgreKdTree.h"
+
+#include <VisibilityEnvironment.h>
 #include "OgreVisibilityOptionsManager.h"
-#include <VisibilityEnvironment.h>
-
-#include <OgreLogManager.h>
-#include <OgreStringConverter.h>
 
 namespace Ogre
