Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 254)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 259)
@@ -190,5 +190,5 @@
 	
 	// reset statistics
-	resetStats();
+	mWalkthroughStats.Reset();
 } 
 //-----------------------------------------------------------------------
@@ -403,6 +403,6 @@
 		/// set the current camera data to loaded frame information 
 		setCurrentFrameInfo(evt.timeSinceLastFrame);
-		// HACK to produce demo
-		addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame);
+		// HACK for demo
+		//addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame);
 		break;
 	case WALKTHROUGH:
@@ -701,15 +701,6 @@
 		mSavedFrameInfo.clear();
 
-		float avgFps = (float)mAvgFps / (float)mFrameCount;
-
-		//-- write out stats for recorded walkthrough
 		std::stringstream d;
-		d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n"
-		  //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n"
-		  << "avg. FPS: " << avgFps << "\n"
-		  << "best FPS: " << mWindow->getBestFPS() << "\n"
-		  << "worst FPS: " << mWindow->getWorstFPS() << "\n"
-		  << "best frame time: " <<	mWindow->getBestFrameTime() << "\n"
-		  << "worst frame time: " << mWindow->getWorstFrameTime();
+		mWalkthroughStats.Print(d, msAlgorithmCaptions[mCurrentAlgorithm]);
  		
 		LogManager::getSingleton().logMessage(d.str());
@@ -739,5 +730,5 @@
 			// reset, because we measure fps stats during walkthrough (warning: average fps broken)
 			mWindow->resetStatistics();
-			resetStats();
+			mWalkthroughStats.Reset();
 
 			//-- initialise frame data
@@ -827,10 +818,4 @@
 	mAlgorithmInfo->setCaption(": " + msAlgorithmCaptions[mCurrentAlgorithm]);
 	mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm);
-}
-//-----------------------------------------------------------------------
-void TerrainFrameListener::resetStats()
-{
-	mAvgFps = 0;
-	mFrameCount = 0;
 }
 //-----------------------------------------------------------------------
@@ -848,4 +833,5 @@
 	int currentFps = mWindow->getStatistics().lastFPS;
 	
+	// HACK for demo: use precomputed FPS
 	if (mUseDemoFps)
 		currentFps = mDemoFps;
@@ -863,9 +849,18 @@
 #endif
 	
+	unsigned int nodeInfo[3];
+    mSceneMgr->getOption("NumRenderedNodes", nodeInfo);
+	mSceneMgr->getOption("NumQueryCulledNodes", nodeInfo+1);
+	mSceneMgr->getOption("NumFrustumCulledNodes", nodeInfo+2);
+
+
+	mWalkthroughStats.UpdateFrame(currentFps, mWindow->getBestFPS(), mWindow->getWorstFPS(),
+								  (int)mWindow->getTriangleCount(), nodeInfo[0], nodeInfo[1], nodeInfo[2]);
+
 	// HACK: compute average fps ourselfs, because ogre avg. fps is wrong
 	// TODO: update only once per second
-	mAvgFps += currentFps;
-	float avgFps = (float)mAvgFps / (float)(mFrameCount++);
-   
+	float avgFps = (float)mWalkthroughStats.mAccFps / (float)(mWalkthroughStats.mFrameCount);
+	
+
 	// update stats when necessary
     try 
@@ -895,7 +890,10 @@
 		OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
         guiTris->setCaption(trisString + StringConverter::toString(stats.triangleCount));
+		
+		//LogManager::getSingleton().logMessage(StringConverter::toString(stats.triangleCount));
 
 		OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
 		guiDbg->setCaption(mWindow->getDebugText());
+
 
 		//-- culling stats
Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h	(revision 254)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h	(revision 259)
@@ -19,5 +19,74 @@
 using namespace Ogre;
 
-
+/** Struct storing walktrough statistics
+*/
+struct WalkthroughStats
+{
+public:
+
+	unsigned long mAccFps;
+	unsigned long mBestFps;
+	unsigned long mWorstFps;
+	unsigned long mAccTris;
+	unsigned long mAccQueryCulledNodes;
+	unsigned long mAccFrustumCulledNodes;
+	unsigned long mFrameCount;
+	unsigned long mAccRenderedNodes;
+	
+	WalkthroughStats(): 
+	mAccFps(0), mBestFps(0), mWorstFps(0), mAccTris(0),
+	mAccQueryCulledNodes(0), mAccFrustumCulledNodes(0),
+	mFrameCount(0), mAccRenderedNodes(0)
+	{}
+
+	void Reset()
+	{
+		mAccFps = mBestFps = mWorstFps = mAccTris = mAccQueryCulledNodes = mAccFrustumCulledNodes = mFrameCount = mAccRenderedNodes = 0;
+	}
+
+	void UpdateFrame(int currentFps, int bestFps, int worstFps, int renderedTris, int renderedNodes, int queryCulledNodes, int frustumCulledNodes)
+	{
+		mAccFps += currentFps;
+		mBestFps = bestFps;
+		mWorstFps = worstFps;
+
+		// accumulated #triangles (M)
+		mAccTris += renderedTris / 1000;
+		mAccRenderedNodes += renderedNodes;
+		mAccQueryCulledNodes += queryCulledNodes;
+		mAccFrustumCulledNodes += frustumCulledNodes;
+	
+		++ mFrameCount;
+	}
+
+	void Print(std::ostream &d, const std::string &algorithmName) const
+	{
+		// compuate average fps and triangle count
+		float avgFps = (float)mAccFps / (float)mFrameCount;
+		float avgTris = (float)mAccTris / (float)mFrameCount;
+		float avgFrustumCulledNodes = 0;
+		float avgRenderedNodes = 0;
+		float avgQueryCulledNodes = 0;
+		
+		if (mFrameCount != 0)
+		{
+			avgFrustumCulledNodes = (float)mAccFrustumCulledNodes / (float)mFrameCount;
+			avgQueryCulledNodes  = (float)mAccQueryCulledNodes / (float)mFrameCount;
+			avgRenderedNodes = (float)mAccRenderedNodes / (float) mFrameCount;
+		}
+
+		//-- write out stats for recorded walkthrough
+		d << "Algorithm: " << algorithmName << "\n"
+			<< "avg. FPS: " << avgFps << "\n"
+			<< "best FPS: " << mBestFps << "\n"
+			<< "worst FPS: " << mWorstFps << "\n"
+			<< "avg. #triangles: " << avgTris << " M\n"
+			<< "#frames: " << mFrameCount << "\n"
+			<< "avg. #query culled nodes: " << avgFrustumCulledNodes << "\n"
+			<< "avg. #frustum culled nodes: " << avgQueryCulledNodes << "\n"
+			<< "avg. #rendered nodes: " << avgRenderedNodes << "\n";
+	}
+
+};
 
 /** Frame listener specialised for terrains.
@@ -39,5 +108,4 @@
 
    ~TerrainFrameListener();
-
 
    bool frameStarted(const FrameEvent& evt);
@@ -184,6 +252,4 @@
 	void initVisStatsOverlay();
 	void initQueryOverlay();
-
-	void resetStats();
 	
 	SceneManager *mSceneMgr;           // A pointer to the scene manager
@@ -206,7 +272,11 @@
 	/// the newly created object
 	SceneNode *mCurrentObject;    
-/// HACK
-float mDemoFps;
-bool mUseDemoFps;
+
+	WalkthroughStats mWalkthroughStats;
+
+	/// HACK for demo
+	float mDemoFps;
+	bool mUseDemoFps;
+
 	OverlayElement *mAlgorithmInfo;
 	OverlayElement *mThresholdInfo;
@@ -301,8 +371,5 @@
 	bool mShiftPressed;
 	bool mShowQueryStats;
-
-	unsigned long mAvgFps;
-	unsigned long mFrameCount;
-
+	
 	//bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn;
 	PlatformQueryManager *mQueryManager;
Index: trunk/VUT/work/iv/IVFrameListener.cpp
===================================================================
--- trunk/VUT/work/iv/IVFrameListener.cpp	(revision 254)
+++ trunk/VUT/work/iv/IVFrameListener.cpp	(revision 259)
@@ -78,5 +78,7 @@
 mDelayedTraversedNodes(0.0),
 mApplication(app),
-mMoveSpeed(15)
+mMoveSpeed(15),
+mAccumulatedTris(0),
+mAccumulatedFps(0)
 {
 	mRaySceneQuery = mSceneMgr->createRayQuery(
@@ -420,8 +422,10 @@
 		writeFrames();
 		
-		float avgFps = (float)mAvgFps / (float)mFrameCount;
+		float avgFps = (float)mAccumulatedFps / (float)mFrameCount;
+		float avgTris = (float)mAccumulatedTris / (float)mFrameCount;
 
 		//-- write out stats for recorded walkthrough
 		std::stringstream d;
+	
 		d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n"
 		  //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n"
@@ -430,6 +434,8 @@
 		  << "worst FPS: " << mWindow->getWorstFPS() << "\n"
 		  << "best frame time: " <<	mWindow->getBestFrameTime() << "\n"
-		  << "worst frame time: " << mWindow->getWorstFrameTime();
- 		
+		  << "worst frame time: " << mWindow->getWorstFrameTime() << "\n"
+		  << "avg. #triangles: " << avgTris << " M\n"
+		  << "#frames: " << mFrameCount < "\n";
+
 		LogManager::getSingleton().logMessage(d.str());
 	}
@@ -515,5 +521,5 @@
 {
 	mCurrentAlgorithm = (mCurrentAlgorithm + 1) % 
-		(GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS - 1);
+		GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS;
 	setAlgorithm(mCurrentAlgorithm);
 }
@@ -527,5 +533,6 @@
 void IVFrameListener::resetStats()
 {
-	mAvgFps = 0;
+	mAccumulatedFps = 0;
+	mAccumulatedTris = 0;
 	mFrameCount = 0;
 }
@@ -544,8 +551,8 @@
 	// HACK: compute average fps ourselfs, because ogre avg. fps is wrong
 	// TODO: update only once per second
-	mAvgFps += mWindow->getStatistics().lastFPS;
+	mAccumulatedFps += mWindow->getStatistics().lastFPS;
 	++ mFrameCount;
 	
-	float avgFps = (float)mAvgFps / (float)mFrameCount;
+	float avgFps = (float)mAccumulatedFps / (float)mFrameCount;
     
 	// update stats when necessary
Index: trunk/VUT/work/iv/TestCullingIVApplication.cpp
===================================================================
--- trunk/VUT/work/iv/TestCullingIVApplication.cpp	(revision 193)
+++ trunk/VUT/work/iv/TestCullingIVApplication.cpp	(revision 259)
@@ -92,5 +92,5 @@
 	mSceneMgr->setOption("NodeVizScale", &scale);
 	// HACK: change this to relative path
-	String path = "D:/gametools/trunk/VUT/Ogre/resources/";
+	String path = "D:/svn/gtp/trunk/VUT/Ogre/resources/";
 		
 	SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1");
Index: trunk/VUT/work/iv/IVFrameListener.h
===================================================================
--- trunk/VUT/work/iv/IVFrameListener.h	(revision 254)
+++ trunk/VUT/work/iv/IVFrameListener.h	(revision 259)
@@ -237,5 +237,6 @@
 	bool mShowQueryStats;
 
-	unsigned long mAvgFps;
+	unsigned long mAccumulatedFps;
+	unsigned long mAccumulatedTris;
 	unsigned long mFrameCount;
 
