Index: /trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h
===================================================================
--- /trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h	(revision 175)
+++ /trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h	(revision 254)
@@ -13,6 +13,5 @@
 	/** Different types of occlusion culling algorithms 
 	*/
-	enum CullingManagerType {
-							 COHERENT_HIERARCHICAL_CULLING, 
+	enum CullingManagerType {COHERENT_HIERARCHICAL_CULLING, 
 							 FRUSTUM_CULLING, 
 							 STOP_AND_WAIT_CULLING, 
Index: /trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
===================================================================
--- /trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp	(revision 175)
+++ /trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp	(revision 254)
@@ -7,5 +7,5 @@
 void FrustumCullingManager::RenderScene()
 {
-	//Ogre::LogManager::getSingleton().logMessage("Frustum Culling");
+	Ogre::LogManager::getSingleton().logMessage("Frustum Culling");
 	while (!mHierarchyInterface->GetQueue()->empty())
 	{
Index: /trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
===================================================================
--- /trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 187)
+++ /trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 254)
@@ -25,5 +25,5 @@
 	unsigned int visiblePixels = 0;
 	bool isAvailable = false;
-	//Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling");
+	Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling");
 
 	//-- PART 1: process finished occlusion queries
Index: /trunk/VUT/GtpVisibility/src/VisibilityManager.cpp
===================================================================
--- /trunk/VUT/GtpVisibility/src/VisibilityManager.cpp	(revision 155)
+++ /trunk/VUT/GtpVisibility/src/VisibilityManager.cpp	(revision 254)
@@ -61,5 +61,5 @@
 		}
 
-		// -- set threshold
+		//-- set threshold
 		mCullingManager->SetVisibilityThreshold(mVisibilityThreshold);		
 	}
Index: /trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
===================================================================
--- /trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp	(revision 175)
+++ /trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp	(revision 254)
@@ -7,5 +7,5 @@
 void StopAndWaitCullingManager::RenderScene()
 {
-	//Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling");
+	Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling");
 	while (!mHierarchyInterface->GetQueue()->empty())
 	{
Index: /trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
===================================================================
--- /trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 187)
+++ /trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 254)
@@ -70,5 +70,6 @@
 // output file for object positions / orientations
 const char* objects_out_filename = "objects.out";
-
+	
+std::ofstream video_out("video.lst");
 
 //-----------------------------------------------------------------------
@@ -117,5 +118,5 @@
 mShowVisualization(false),
 mCullCamera(false),
-mRecord(false),
+mRecordFrames(false),
 mShowShadows(false),
 mShowHelp(false),
@@ -134,5 +135,10 @@
 mDeleteObjects(false),
 mUseItemBuffer(false),
-mItemBufferMode(GtpVisibility::QueryManager::PATCH_VISIBILITY)
+mItemBufferMode(GtpVisibility::QueryManager::PATCH_VISIBILITY),
+mRecordVideo(false),
+mPureRenderTimeFps(0.0),
+mNumVideoFrames(0),
+mDemoFps(0),
+mUseDemoFps(false)
 {
 	//mInputDevice = PlatformManager::getSingleton().createInputReader();
@@ -159,6 +165,6 @@
 
 	initVisStatsOverlay(); // visibility stats overlay
-	initHelpOverlay(); // help overlay
-	initQueryOverlay(); // visibility query stats overlay
+	initHelpOverlay();     // help overlay
+	initQueryOverlay();    // visibility query stats overlay
 
 	// show stats overlays
@@ -179,4 +185,8 @@
 	setObjectType(mCurrentObjectType);
 
+	// initialise timer
+	mTimer = Root::getSingleton().getTimer();
+	mTimeFrameEnded = mTimeFrameStarted = mTimer->getMilliseconds();
+	
 	// reset statistics
 	resetStats();
@@ -356,5 +366,5 @@
 	{	return false;	}*/
 
-	// --- set parameters for visualization
+	//-- set parameters for visualization
 	if (mShowVisualization)
 	{
@@ -362,5 +372,5 @@
 		mSceneMgr->setOption("ShowOctree", &mShowVisualization);
 		
-		// ---- setup visualization camera
+		//-- setup visualization camera
 
 		mVizCamera->setPosition(0, 0, 0);
@@ -380,4 +390,10 @@
 		mVizCamera->moveRelative(Vector3(0, 800, 0));
 	}
+	else
+	{
+		// frame start time
+		mTimeFrameStarted = mTimer->getMilliseconds();
+		//Ogre::LogManager::getSingleton().logMessage("Frame started");
+	}
 
 	//-- set application state
@@ -385,11 +401,14 @@
 	{
 	case REPLAY:
+		/// set the current camera data to loaded frame information 
 		setCurrentFrameInfo(evt.timeSinceLastFrame);
+		// HACK to produce demo
+		addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame);
 		break;
 	case WALKTHROUGH:
-		//-- if we are recording camera status per frame
-		if (mRecord)
+		//-- recording the camera settings per frame
+		if (mRecordFrames)
 		{
-			addFrameInfo(mCamNode, evt.timeSinceLastFrame);
+			addFrameInfo(mFrameInfo, mCamNode, evt.timeSinceLastFrame);
 			// print recording message
 			mWindow->setDebugText("Recording frame " + 
@@ -573,10 +592,23 @@
 		return false;
 
+	// timer end time
+	if (!mShowVisualization)
+	{
+		mTimeFrameEnded = mTimer->getMilliseconds();
+		//Ogre::LogManager::getSingleton().logMessage("Frame ended");
+	}
+
     updateStats();
 
+	if (mRecordVideo) // record current frame
+	{
+		//Ogre::LogManager::getSingleton().logMessage("taking video frame");
+		takeVideoFrame(video_out);
+		//Ogre::LogManager::getSingleton().logMessage("finished");
+	}
 	//-- IMPORTANT: must be set, otherwise terrain is not rendered correctly
 	mSceneMgr->endFrame();
 
-	if (mTimeDelay <= 0) // approx. one second
+	if (mTimeDelay <= 0) // simulates approx. one second
 		mTimeDelay = 1.0;
 
@@ -603,5 +635,23 @@
 		ofstr << StringConverter::toString((*it).position) << " " 
 			  << StringConverter::toString((*it).orientation) << " "
-			  << StringConverter::toString((*it).timeElapsed) << "\n";
+			  << StringConverter::toString((*it).timeElapsed) << " "
+			  << StringConverter::toString((*it).fps) << "\n";
+	}
+	ofstr.close();
+}
+// quick hack
+void TerrainFrameListener::writeNewFrameInfo()
+{
+	std::ofstream ofstr("newframe.out");
+	
+	std::vector<frame_info>::const_iterator it, it_end;
+
+	it_end = mSavedFrameInfo.end();
+	for (it = mSavedFrameInfo.begin(); it < it_end; ++it)
+	{
+		ofstr << StringConverter::toString((*it).position) << " " 
+			  << StringConverter::toString((*it).orientation) << " "
+			  << StringConverter::toString((*it).timeElapsed) << " "
+			  << StringConverter::toString((*it).fps) << "\n";
 	}
 	ofstr.close();
@@ -621,7 +671,7 @@
 	{
 		ifstr.getline(line, 256);
-		sscanf(line, "%f %f %f %f %f %f %f %f", &info.position.x, &info.position.y, &info.position.z,
+		sscanf(line, "%f %f %f %f %f %f %f %f %f", &info.position.x, &info.position.y, &info.position.z,
 			   &info.orientation.w, &info.orientation.x, &info.orientation.y, &info.orientation.z,
-			   &info.timeElapsed);
+			   &info.timeElapsed, &info.fps);
 		
 		mFrameInfo.push_back(info);
@@ -636,12 +686,19 @@
 {
 	mCurrentFrame = 0;
+	int lastState = mAppState;
+
+	// transition to the next state
+	mAppState = (mAppState + 1) % STATE_NUM;
 
 	// if last state was replay state
-	if (mAppState == REPLAY)
-	{
-		// reset debug text and write frame info to file
+	if (lastState == REPLAY)
+	{
+        // reset debug text
 		mWindow->setDebugText("");
-		writeFrames();
-		
+				
+		// hack for producing demo
+		writeNewFrameInfo();
+		mSavedFrameInfo.clear();
+
 		float avgFps = (float)mAvgFps / (float)mFrameCount;
 
@@ -659,19 +716,16 @@
 	}
 	
-	//-- set the next státe
-	mAppState = (mAppState + 1) % STATE_NUM;
-
 	// replay recorded walkthrough
 	if (mAppState == REPLAY)
 	{
 		// no recording during replay
-		mRecord = false;
-
-		// load recorded walkthrough
+		mRecordFrames = false; mWindow->setDebugText("");
+
+		// load recorded walkthrough from disk
 		if (mFrameInfo.size() == 0)
 		{
 			loadFrames();
 		}
-
+		
 		// if there are no recorded frames => set next state
 		if (mFrameInfo.size() == 0) 
@@ -679,5 +733,5 @@
 			nextAppState();
 		}
-		else
+		else // replay
 		{
 			mWindow->setDebugText("Replay");
@@ -699,11 +753,16 @@
 void TerrainFrameListener::toggleRecord()
 {
-	mRecord = !mRecord;
-
-	// clear previous camera path
-	if (mRecord)
+	mRecordFrames = !mRecordFrames;
+
+	if (mRecordFrames) 
+	{
+		// starting new recording => clear old frame info
 		mFrameInfo.clear();
+	}
 	else
+	{
+		writeFrames(); // write frame info to file
 		mWindow->setDebugText("");
+	}
 }
 //-----------------------------------------------------------------------
@@ -711,6 +770,10 @@
 {
 	mVisibilityThreshold += incr; 
-	if(mVisibilityThreshold < 0) mVisibilityThreshold = 0;
-	
+
+	if (mVisibilityThreshold < 0)
+	{
+		mVisibilityThreshold = 0;
+	}
+
 	char str[100]; sprintf(str,": %d", mVisibilityThreshold);
 
@@ -722,6 +785,10 @@
 {
 	mAssumedVisibility += incr; 
-	if(mAssumedVisibility < 0) mAssumedVisibility = 0;
-	
+
+	if (mAssumedVisibility < 0) 
+	{	
+		mAssumedVisibility = 0;
+	}
+
 	char str[100]; sprintf(str,": %d", mAssumedVisibility);
 
@@ -739,5 +806,5 @@
 {
 	mCurrentAlgorithm = (mCurrentAlgorithm + 1) % 
-		(GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS - 1);
+		GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS;
 	setAlgorithm(mCurrentAlgorithm);
 }
@@ -745,5 +812,5 @@
 void TerrainFrameListener::setObjectType(int objectType)
 {
-	if (mCurrentObjectType >= 3)
+	if (mCurrentObjectType >= 3) // TODO: define a constant
 		mCurrentObjectType = 0;
 
@@ -779,11 +846,26 @@
 	static String trisString = "Triangle Count: ";
 
+	int currentFps = mWindow->getStatistics().lastFPS;
+	
+	if (mUseDemoFps)
+		currentFps = mDemoFps;
+#if 0
+	// HACK: take pure rendering time, only measures the render call
+	long pureRenderTime = mTimeFrameEnded - mTimeFrameStarted;
+
+	if (pureRenderTime)
+	{
+		mPureRenderTimeFps = 1000.0 / (float) pureRenderTime;
+	}
+	currentFps = mPureRenderRenderTimeFps;
+	//std::stringstream d; d << "Pure render time fps: " << mPureRenderTimeFps << "\n";
+	//Ogre::LogManager::getSingleton().logMessage(d.str());
+#endif
+	
 	// HACK: compute average fps ourselfs, because ogre avg. fps is wrong
 	// TODO: update only once per second
-	mAvgFps += mWindow->getStatistics().lastFPS;
-	++ mFrameCount;
-	
-	float avgFps = (float)mAvgFps / (float)mFrameCount;
-    
+	mAvgFps += currentFps;
+	float avgFps = (float)mAvgFps / (float)(mFrameCount++);
+   
 	// update stats when necessary
     try 
@@ -796,11 +878,14 @@
 		const RenderTarget::FrameStats& stats = mWindow->getStatistics();
 
-		//guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
-		if (mTimeDelay < 0) // only update once per second
+		// HACK: take newly computed avg. fps instead of Ogre avg fps and update only once per second
+		if (mTimeDelay < 0) 
 		{		
 			guiAvg->setCaption(avgFpsString + StringConverter::toString(avgFps) + " ms");
+			//guiCurr->setCaption(currFpsString + StringConverter::toString(currentFps));
 		}
-
-		guiCurr->setCaption(currFpsString + StringConverter::toString(stats.lastFPS));
+		//guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
+		guiCurr->setCaption(currFpsString + StringConverter::toString(currentFps));
+		
+
 		guiBest->setCaption(bestFpsString + StringConverter::toString(stats.bestFPS)
 			+" "+StringConverter::toString(stats.bestFrameTime) + " ms");
@@ -1039,5 +1124,6 @@
 		break;
 	case KC_F2:
-		toggleShowStats();
+		mStatsOn = !mStatsOn;
+		showStats(mStatsOn);
 		break;
 	case KC_F3:
@@ -1063,4 +1149,8 @@
 		mUseAnimation = !mUseAnimation;
 		break;
+
+	case KC_F10:
+		mRecordVideo = !mRecordVideo;
+			
 	case KC_F11:
 		takeScreenshot();
@@ -1081,4 +1171,7 @@
 	case KC_DELETE:
 		mDeleteObjects = true;
+		break;
+	case KC_M: // hack
+		mUseDemoFps = !mUseDemoFps;
 		break;
 	//KEY_PRESSED(KC_F3, 0.3, writeFrames());
@@ -1110,12 +1203,14 @@
 }
 //-----------------------------------------------------------------------
-void TerrainFrameListener::addFrameInfo(SceneNode *camNode, Real timeElapsed)
+void TerrainFrameListener::addFrameInfo(FrameInfoContainer &frameInfos, SceneNode *camNode, Real timeElapsed)
 {
 	frame_info info;
+
 	info.orientation = mCamNode->getOrientation();
 	info.position = mCamNode->getPosition();
 	info.timeElapsed = timeElapsed;
-
-	mFrameInfo.push_back(info);
+	info.fps = mWindow->getStatistics().lastFPS;
+
+	frameInfos.push_back(info);
 }
 //-----------------------------------------------------------------------
@@ -1124,5 +1219,5 @@
 	//-- find current frame relative to elapsed frame time		
 	mReplayTimeElapsed -= timeElapsed;
-
+	
 	while ((mReplayTimeElapsed <= 0) && (mCurrentFrame < (int)mFrameInfo.size() - 1))
 	{
@@ -1130,5 +1225,7 @@
 	}
 
-	frame_info new_frame = mFrameInfo[mCurrentFrame];
+
+	// TODO: crashes here if recording / replaying on the same time!!
+	frame_info new_frame = mFrameInfo[mCurrentFrame]; 
 	frame_info old_frame = mFrameInfo[mCurrentFrame - 1];
 		
@@ -1143,11 +1240,16 @@
 	Vector3 camPos = old_frame.position + factor 
 		* (new_frame.position - old_frame.position);
+
+	// interpolate the orientation
 	Quaternion camOrienation = Quaternion::Slerp(factor, old_frame.orientation, 
 		new_frame.orientation, true);
 
+	// HACK: interpolate fps
+	mDemoFps = old_frame.fps + factor * (new_frame.fps -old_frame.fps);
+
 	mCamNode->setPosition(camPos);
 	mCamNode->setOrientation(camOrienation);
 	
-	// stop replay after a full walkthrough
+	// stop replaying after one full walkthrough
 	if (mCurrentFrame == (int)mFrameInfo.size() - 1)
 	{
@@ -1249,10 +1351,22 @@
 }
 //-----------------------------------------------------------------------
+void TerrainFrameListener::takeVideoFrame(std::ofstream &ofstr)
+{
+	char name[50];
+
+	sprintf(name, "frame_%05d.tga", ++mNumVideoFrames);
+    mWindow->writeContentsToFile(name);
+    //mWindow->setDebugText(String("Wrote ") + name);
+
+	ofstr << name << "\n";
+}
+//-----------------------------------------------------------------------
 void TerrainFrameListener::takeScreenshot()
 {
-	char tmp[20];
-	sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots);
-    mWindow->writeContentsToFile(tmp);
-    mWindow->setDebugText(String("Wrote ") + tmp);
+	char name[50];
+
+	sprintf(name, "screenshot_%05d.png", ++mNumScreenShots);
+    mWindow->writeContentsToFile(name);
+    //mWindow->setDebugText(String("Wrote ") + name);
 }
 //-----------------------------------------------------------------------
@@ -1283,11 +1397,5 @@
 	}
 }
-//-----------------------------------------------------------------------
-void TerrainFrameListener::toggleShowStats()
-{
-	mStatsOn = !mStatsOn;
-
-	showStats(mStatsOn);
-}
+
 //-----------------------------------------------------------------------
 void TerrainFrameListener::toggleShowHelp()
@@ -1336,6 +1444,8 @@
 	initHelpOverlayElement("Recorded", top); top += vert_space;
 	initHelpOverlayElement("Animation", top); top += vert_space;
+	initHelpOverlayElement("Video", top); top += vert_space;
 	initHelpOverlayElement("Screenshots", top); top += vert_space;
 	initHelpOverlayElement("WriteOut", top); top += vert_space;
+
 
 	top +=vert_space;
Index: /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 187)
+++ /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 254)
@@ -305,5 +305,5 @@
 	{
 		// the objects are generated randomly distributed over the terrain
-		generateScene(900, 0);
+		generateScene(900, 0); // create soldiers, trees, ninjas
 		generateScene(500, 1);
 		generateScene(100, 2);
Index: /trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
===================================================================
--- /trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h	(revision 187)
+++ /trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h	(revision 254)
@@ -20,4 +20,5 @@
 
 
+
 /** Frame listener specialised for terrains.
 */
@@ -75,5 +76,8 @@
 	   Quaternion orientation;
 	   Real timeElapsed;
+	   Real fps;
    } frame_info;
+
+   typedef std::vector<frame_info> FrameInfoContainer;
 
    enum  {WALKTHROUGH, REPLAY, STATE_NUM};
@@ -85,5 +89,5 @@
    void zoomVizCamera(int zoom);
 	
-   void addFrameInfo(SceneNode *camNode, Real timeElapsed);
+   void addFrameInfo(FrameInfoContainer &frameInfos, SceneNode *camNode, Real timeElapsed);
    void setCurrentFrameInfo(Real timeElapsed);
 
@@ -95,21 +99,33 @@
    void loadFrames();
 
-  
-    // Constructor takes a RenderWindow because it uses that to determine input context
-    //ExampleFrameListener(RenderWindow* win, Camera* cam, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false)
+	// quick hack
+	void writeNewFrameInfo();
     
     bool processUnbufferedKeyInput(const FrameEvent& evt);
     bool processUnbufferedMouseInput(const FrameEvent& evt);
 
+	/** Shows the frame / algorithm statistics.
+	*/ 
     void showStats(bool show);
 
+	/** Updates frame statistics and the frame statistics display.
+	*/
 	void updateStats();
 
+	/** Toggles wether help screen is shown or not.
+	*/
 	void toggleShowHelp();
-	void toggleShowStats();
-
+	
+	/** Toggles wether shadows are shown or not.
+	*/
 	void toggleShowShadows();
 	void toggleDisplayCameraDetails();
+	/** Takes screenshot of the current scene.
+	*/
 	void takeScreenshot();
+	/** Takes one video frame.
+	*/
+	void takeVideoFrame(std::ofstream &ofstr);
+
 	void nextSceneDetailLevel();
 	void nextFilter();
@@ -120,7 +136,15 @@
 	void changeAssumedVisibility(int incr);
 	void setTestGeometryForVisibleLeaves(bool testGeometryForVisibleLeaves);
+	/** Shows octree hierarchy of the scene.
+	*/
 	void toggleShowOctree();
+	/** Toggles wether we use the initial depth pass.
+	*/
 	void toggleUseDepthPass();
+	/** Toggles wether the visualization is shown.
+	*/
 	void toggleShowViz();
+	/** Toggles wether the frames are recorded.
+	*/
 	void toggleRecord();
 
@@ -134,4 +158,6 @@
 	void applyVisibilityQuery(bool fromPoint, bool relativeVisibility, bool useItemBuffer);
 
+	/** Shows result from visibility queries.
+	*/
 	void toggleShowQueryStats();
 
@@ -168,15 +194,19 @@
 	int mVisibilityThreshold;
 	int mAssumedVisibility;
-	// the current frame number
+	/// the current frame number
 	int mCurrentFrame;
-	// the current application state
+	/// the current application state
 	int mAppState;
-	// The number of objects on the screen
+	/// The number of objects on the screen
 	int mObjectCount;            
-	// visualization mode
+	/// visualization mode
 	int mNodeVizMode;
-
-	SceneNode *mCurrentObject;    // the newly created object
-
+	/// number of video frames
+	int mNumVideoFrames;
+	/// the newly created object
+	SceneNode *mCurrentObject;    
+/// HACK
+float mDemoFps;
+bool mUseDemoFps;
 	OverlayElement *mAlgorithmInfo;
 	OverlayElement *mThresholdInfo;
@@ -214,5 +244,5 @@
 	bool mShowVisualization;
 	bool mCullCamera;
-	bool mRecord;
+	bool mRecordFrames;
 	bool mShowShadows;
 	bool mVisualizeCulledNodes;
@@ -232,7 +262,9 @@
 	SceneNode *mCamNode;
 	
-	//std::deque<Vector3> mWalkList;   // The list of points we are walking to
-	std::vector<frame_info> mFrameInfo;
-		
+	/// Per frame data stored for a walkthrough
+	FrameInfoContainer mFrameInfo;
+	/// HACK: for demo
+	FrameInfoContainer mSavedFrameInfo;
+	
 	Real mReplayTimeElapsed;
 	//EventProcessor* mEventProcessor;
@@ -282,5 +314,10 @@
 
 	bool mDeleteObjects;
-
+	bool mRecordVideo;
+
+	Timer *mTimer;
+	long mTimeFrameEnded;
+	long mTimeFrameStarted;
+	float mPureRenderTimeFps;
 	TestCullingTerrainApplication *mApplication;
 };
Index: /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
===================================================================
--- /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 183)
+++ /trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 254)
@@ -157,5 +157,4 @@
 	Vector3 mTerrainMaxPos;
 
-
 private:
 	void chooseSceneManager(void);
Index: /trunk/VUT/work/TestCulling/TestCullingApplication.cpp
===================================================================
--- /trunk/VUT/work/TestCulling/TestCullingApplication.cpp	(revision 160)
+++ /trunk/VUT/work/TestCulling/TestCullingApplication.cpp	(revision 254)
@@ -20,7 +20,7 @@
 
 
-/***********************************************/
-/* TestCullingApplication implementation       */
-/***********************************************/
+/***************************************************/
+/*     TestCullingApplication implementation       */
+/***************************************************/
 
 //-----------------------------------------------------------------------
Index: /trunk/VUT/work/TestCulling/TestCullingApplication.h
===================================================================
--- /trunk/VUT/work/TestCulling/TestCullingApplication.h	(revision 160)
+++ /trunk/VUT/work/TestCulling/TestCullingApplication.h	(revision 254)
@@ -17,5 +17,5 @@
 }
 
-String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 
+String mCurrentAlgorithmCaptions[] = 
 {
     "View Frustum Culling", 
Index: /trunk/VUT/work/iv/IVFrameListener.cpp
===================================================================
--- /trunk/VUT/work/iv/IVFrameListener.cpp	(revision 187)
+++ /trunk/VUT/work/iv/IVFrameListener.cpp	(revision 254)
@@ -66,5 +66,5 @@
 mShowVisualization(false),
 mCullCamera(false),
-mRecord(false),
+mRecordFrames(false),
 mShowShadows(false),
 mShowHelp(false),
@@ -288,5 +288,5 @@
 	case WALKTHROUGH:
 		//-- if we are recording camera status per frame
-		if (mRecord)
+		if (mRecordFrames)
 		{
 			addFrameInfo(mCamNode, evt.timeSinceLastFrame);
@@ -442,5 +442,5 @@
 	{
 		// no recording during replay
-		mRecord = false;
+		mRecordFrames = false;
 
 		// load recorded walkthrough
@@ -475,8 +475,8 @@
 void IVFrameListener::toggleRecord()
 {
-	mRecord = !mRecord;
+	mRecordFrames = !mRecordFrames;
 
 	// clear previous camera path
-	if (mRecord)
+	if (mRecordFrames)
 		mFrameInfo.clear();
 	else
@@ -834,5 +834,5 @@
 	info.position = mCamNode->getPosition();
 	info.timeElapsed = timeElapsed;
-
+	
 	mFrameInfo.push_back(info);
 }
Index: /trunk/VUT/work/iv/IVFrameListener.h
===================================================================
--- /trunk/VUT/work/iv/IVFrameListener.h	(revision 187)
+++ /trunk/VUT/work/iv/IVFrameListener.h	(revision 254)
@@ -182,5 +182,5 @@
 	bool mShowVisualization;
 	bool mCullCamera;
-	bool mRecord;
+	bool mRecordFrames;
 	bool mShowShadows;
 	bool mVisualizeCulledNodes;
Index: /trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
===================================================================
--- /trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 202)
+++ /trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h	(revision 254)
@@ -128,11 +128,11 @@
 	/// if we use a depth pass (i.e., fill only the depth buffer in the first pass)
 	bool mUseDepthPass;
-	/// if we currently render the depth pass
-	bool mRenderDepthPass;
+	/// if we currently rendering the depth pass
+	bool mIsDepthPassPhase;
 	
 	/// if we use an item buffer for rendering (i.e., object ids as color codes
 	bool mUseItemBuffer;
 	/// if we currently render the item buffer 
-	bool mRenderItemBuffer;
+	bool mIsItemBufferPhase;
 
 	/// if depth write should be enabled
Index: /trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
===================================================================
--- /trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h	(revision 202)
+++ /trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h	(revision 254)
@@ -86,4 +86,6 @@
 	void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup);
 
+	void loadVisibilityConfig(const String& filename);
+
 protected:
 	
@@ -123,10 +125,10 @@
 	bool mUseDepthPass;
 	/// flag indicating if we currently render the depth pass
-	bool mRenderDepthPass;
+	bool mIsDepthPassPhase;
 
 	/// if we use an item buffer for rendering (i.e., object ids as color codes
 	bool mUseItemBuffer;
 	/// if we currently render the item buffer 
-	bool mRenderItemBuffer;
+	bool mIsItemBufferPhase;
 
 	/// if depth write should be enabled
Index: /trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- /trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 202)
+++ /trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 254)
@@ -24,8 +24,8 @@
 mDelayRenderTransparents(true),
 mUseDepthPass(false),
-mRenderDepthPass(false),
+mIsDepthPassPhase(false),
 mUseItemBuffer(false),
 //mUseItemBuffer(true),
-mRenderItemBuffer(false),
+mIsItemBufferPhase(false),
 mCurrentEntityId(1),
 mEnableDepthWrite(true),
@@ -147,8 +147,8 @@
 {
 	// TODO: setting vertex program is not efficient
-	//Pass *usedPass = ((mRenderDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass); 
+	//Pass *usedPass = ((mIsDepthPassPhase && !pass->hasVertexProgram()) ? mDepthPass : pass); 
 	
 	// set depth fill pass if we currently do not make an aabb occlusion query
-	Pass *usedPass = (mRenderDepthPass && !mHierarchyInterface->IsBoundingBoxQuery() ? 
+	Pass *usedPass = (mIsDepthPassPhase && !mHierarchyInterface->IsBoundingBoxQuery() ? 
 					  mDepthPass : pass);
 		
@@ -157,5 +157,5 @@
 	// set illumination stage to NONE so no shadow material is used 
 	// for depth pass or for occlusion query
-	if (mRenderDepthPass || mHierarchyInterface->IsBoundingBoxQuery())
+	if (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery())
 	{
 		mIlluminationStage = IRS_NONE;
@@ -163,5 +163,5 @@
 	
 	// --- set vertex program of current pass in order to set correct depth
-	if (mExecuteVertexProgramForAllPasses && mRenderDepthPass && pass->hasVertexProgram())
+	if (mExecuteVertexProgramForAllPasses && mIsDepthPassPhase && pass->hasVertexProgram())
 	{
 		// add vertex program of current pass to depth pass
@@ -315,6 +315,6 @@
 
 		//-- reset parameters
-		mRenderDepthPass = false;
-		mRenderItemBuffer = false;
+		mIsDepthPassPhase = false;
+		mIsItemBufferPhase = false;
 		mSkipTransparents = false;
 		mLeavePassesInQueue = 0;
@@ -501,5 +501,5 @@
 {
 	// skip all but first pass if we are doing the depth pass
-	if ((mRenderDepthPass || mRenderItemBuffer) && pass->getIndex() > 0)
+	if ((mIsDepthPassPhase || mIsItemBufferPhase) && pass->getIndex() > 0)
 	{
 		return false;
@@ -510,5 +510,5 @@
 void VisibilityTerrainSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup)
 {
-	if (!mRenderItemBuffer)
+	if (!mIsItemBufferPhase)
 	{
 		TerrainSceneManager::renderQueueGroupObjects(pGroup);
@@ -640,10 +640,10 @@
 
 	// set depth pass flag before rendering
-	mRenderDepthPass = mUseDepthPass;
+	mIsDepthPassPhase = mUseDepthPass;
 
 	// item buffer needs full ambient lighting to use item colors as unique id
 	if (mUseItemBuffer) 
 	{
-		mRenderItemBuffer = true;
+		mIsItemBufferPhase = true;
 		setAmbientLight(ColourValue(1,1,1,1));
 	}
Index: /trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
===================================================================
--- /trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp	(revision 187)
+++ /trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp	(revision 254)
@@ -15,4 +15,5 @@
 	if (key == "Algorithm")
 	{
+		// delete old queries (not needed for e.g., view frustum culling)
 		mHierarchyInterface->DeleteQueries();
 		mVisibilityManager->SetCullingManager(*static_cast<const 
Index: /trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
===================================================================
--- /trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 202)
+++ /trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 254)
@@ -9,5 +9,5 @@
 #include <OgreEntity.h>
 #include <OgreSubEntity.h>
-
+#include <OgreConfigFile.h>
 
 namespace Ogre {
@@ -24,9 +24,11 @@
 mLeavePassesInQueue(0),
 mDelayRenderTransparents(true),
+//mDelayRenderTransparents(false),
+//mUseDepthPass(true),
 mUseDepthPass(false),
-mRenderDepthPass(false),
+mIsDepthPassPhase(false),
 mUseItemBuffer(false),
 //mUseItemBuffer(true),
-mRenderItemBuffer(false),
+mIsItemBufferPhase(false),
 mCurrentEntityId(1),
 mEnableDepthWrite(true),
@@ -44,4 +46,6 @@
 	// TODO: set maxdepth to reasonable value
 	mMaxDepth = 50;
+
+	//loadVisibilityConfig("GtpVisibility.cfg");
 }
 //-----------------------------------------------------------------------
@@ -145,5 +149,5 @@
 {
 	// set depth fill pass if we currently do not make an aabb occlusion query
-	Pass *usedPass = (mRenderDepthPass && !mHierarchyInterface->IsBoundingBoxQuery() ? 
+	Pass *usedPass = (mIsDepthPassPhase && !mHierarchyInterface->IsBoundingBoxQuery() ? 
 					  mDepthPass : pass);
 
@@ -152,5 +156,5 @@
 	// set illumination stage to NONE so no shadow material is used 
 	// for depth pass or for occlusion query
-	if (mRenderDepthPass || mHierarchyInterface->IsBoundingBoxQuery())
+	if (mIsDepthPassPhase || mHierarchyInterface->IsBoundingBoxQuery())
 	{
 		mIlluminationStage = IRS_NONE;
@@ -158,5 +162,5 @@
 
 	//-- set vertex program of current pass in order to set correct depth
-	if (mRenderDepthPass && mExecuteVertexProgramForAllPasses && pass->hasVertexProgram())
+	if (mIsDepthPassPhase && mExecuteVertexProgramForAllPasses && pass->hasVertexProgram())
     {
 		// add vertex program of current pass to depth pass
@@ -311,6 +315,6 @@
 
 		//-- reset parameters
-		mRenderDepthPass = false;
-		mRenderItemBuffer = false;
+		mIsDepthPassPhase = false;
+		mIsItemBufferPhase = false;
 		mSkipTransparents = false;
 		mIsHierarchicalCulling = false;
@@ -498,5 +502,5 @@
 {
 	// skip all but first pass if we are doing the depth pass
-	if ((mRenderDepthPass || mRenderItemBuffer) && pass->getIndex() > 0)
+	if ((mIsDepthPassPhase || mIsItemBufferPhase) && pass->getIndex() > 0)
 	{
 		return false;
@@ -507,5 +511,5 @@
 void VisibilityOctreeSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup)
 {
-	if (!mRenderItemBuffer)
+	if (!mIsItemBufferPhase)
 	{
 		OctreeSceneManager::renderQueueGroupObjects(pGroup);
@@ -513,5 +517,5 @@
 	}
 
-	// --- item buffer
+	//-- renders item buffer
 
     // Iterate through priorities
@@ -559,5 +563,5 @@
 	}
 
-	// -- TRANSPARENT LOOP: must be handled differently 
+	//-- TRANSPARENT LOOP: must be handled differently 
 
 	// transparents are treated either as solids or completely discarded
@@ -637,5 +641,5 @@
 
 	// set depth pass flag before rendering
-	mRenderDepthPass = mUseDepthPass;
+	mIsDepthPassPhase = mUseDepthPass;
 
 	mIsHierarchicalCulling = true; // during hierarchical culling
@@ -644,5 +648,5 @@
 	if (mUseItemBuffer) 
 	{
-		mRenderItemBuffer = true;
+		mIsItemBufferPhase = true;
 		setAmbientLight(ColourValue(1,1,1,1));
 	}
@@ -739,67 +743,7 @@
 		}
 	}
-	else
+	else // render the rest of the passes
 	{
 		OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup);
-
-		/*RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator();
-	    LightList lightList;
-		
-		while (groupIt.hasMoreElements())
-		{
-		
-			RenderPriorityGroup* pPriorityGrp = groupIt.getNext();
-
-			// Sort the queue first
-			pPriorityGrp->sort(mCameraInProgress);
-
-			// Clear light list
-			lightList.clear();
-
-			// Now iterate per light
-			mIlluminationStage = IRS_PER_LIGHT;
-	
-		    // Iterate over lights, render all volumes to stencil
-	        LightList::const_iterator li, liend;
-		    liend = mLightsAffectingFrustum.end();
-	
-		    for (li = mLightsAffectingFrustum.begin(); li != liend; ++li)
-			{
-				LogManager::getSingleton().logMessage("iterating over lights");
-				Light* l = *li;
-				// Set light state
-
-				if (l->getCastShadows())
-				{
-					// Clear stencil
-					mDestRenderSystem->clearFrameBuffer(FBT_STENCIL);
-					renderShadowVolumesToStencil(l, mCameraInProgress);
-					// turn stencil check on
-					mDestRenderSystem->setStencilCheckEnabled(true);
-					// NB we render where the stencil is equal to zero to render lit areas
-					mDestRenderSystem->setStencilBufferParams(CMPF_EQUAL, 0);
-				}
-
-				// render lighting passes for this light
-				if (lightList.empty())
-					lightList.push_back(l);
-				else
-					lightList[0] = l;
-				OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDiffuseSpecular(), false, &lightList);
-
-				// Reset stencil params
-				mDestRenderSystem->setStencilBufferParams();
-				mDestRenderSystem->setStencilCheckEnabled(false);
-				mDestRenderSystem->_setDepthBufferParams();
-
-			}// for each light
-
-			// Now render decal passes, no need to set lights as lighting will be disabled
-			mIlluminationStage = IRS_DECAL;
-			OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesDecal(), false);
-	    }// for each priority
-	
-		// reset lighting stage
-	    mIlluminationStage = IRS_NONE;*/
 	}
 }
@@ -828,3 +772,26 @@
    }
 }
-}   // namespace Ogre
+//-------------------------------------------------------------------------
+void VisibilityOctreeSceneManager::loadVisibilityConfig(const String& filename)
+{
+	/// Set up the options
+	ConfigFile config;
+	String val;
+
+	config.load(filename);
+
+	val = config.getSetting("Algorithm");
+
+    if (!val.empty())
+	{
+		 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str());
+	}
+
+	val = config.getSetting("UseDepthPass");
+
+	if (!val.empty())
+	{
+		 setOption("UseDepthPass", val.c_str());
+	}
+}
+}  // namespace Ogre
Index: /trunk/VUT/Ogre/resources/materials/scripts/natFX_Tree1_LOD3.material
===================================================================
--- /trunk/VUT/Ogre/resources/materials/scripts/natFX_Tree1_LOD3.material	(revision 183)
+++ /trunk/VUT/Ogre/resources/materials/scripts/natFX_Tree1_LOD3.material	(revision 254)
@@ -204,5 +204,5 @@
 			texture_unit
 			{
-				texture D:\Profiles\giegl\My Documents\maya\projects\default\sourceimages\_12bb041f_1121354365.png
+				texture _12bb041f_1121354365.png
 				tex_coord_set 0
 				colour_op modulate
@@ -228,5 +228,5 @@
 			texture_unit
 			{
-				texture D:\Profiles\giegl\My Documents\maya\projects\default\sourceimages\_12bb041l_1121354365.png
+				texture _12bb041l_1121354365.png
 				tex_coord_set 0
 				colour_op modulate
@@ -252,5 +252,5 @@
 			texture_unit
 			{
-				texture D:\Profiles\giegl\My Documents\maya\projects\default\sourceimages\_12bb049f_1121354365.png
+				texture _12bb049f_1121354365.png
 				tex_coord_set 0
 				colour_op modulate
@@ -276,10 +276,10 @@
 			texture_unit
 			{
-				texture D:\Profiles\giegl\My Documents\maya\projects\default\sourceimages\_12bb049l_1121354365.png
-				tex_coord_set 0
-				colour_op modulate
-			}
-		}
-	}
-}
-
+				texture _12bb049l_1121354365.png
+				tex_coord_set 0
+				colour_op modulate
+			}
+		}
+	}
+}
+
Index: /trunk/VUT/Ogre/resources/overlays/VisibilityDemo.overlay
===================================================================
--- /trunk/VUT/Ogre/resources/overlays/VisibilityDemo.overlay	(revision 183)
+++ /trunk/VUT/Ogre/resources/overlays/VisibilityDemo.overlay	(revision 254)
@@ -333,4 +333,11 @@
 			caption [F9] Start / End animation
 		}
+		element TextArea(Example/Visibility/Help/Video): Example/Visibility/Templates/BasicText
+		{
+			left 5
+			width 180
+			height 30
+			caption [F10] Write out video (i.e., one image per frame)
+		}
 		element TextArea(Example/Visibility/Help/Screenshots): Example/Visibility/Templates/BasicText
 		{
Index: unk/VUT/Ogre/resources/VisibilityDemo.overlay
===================================================================
--- /trunk/VUT/Ogre/resources/VisibilityDemo.overlay	(revision 161)
+++ 	(revision )
@@ -1,642 +1,0 @@
-template element TextArea(Example/Visibility/Templates/BasicText)
-{
-	metrics_mode pixels
-	left 5
-	top 5
-	width 180
-	height 30
-	font_name TrebuchetMSBold
-	char_height 16
-	colour_top 0.5 0.7 0.5
-	colour_bottom 0.3 0.5 0.3
-}
-
-Example/Visibility/CullStatsOverlay
-{
-	zorder 500
-	// Stats block
-	container BorderPanel(Example/Visibility/VisibilityPanel)
-	{
-		metrics_mode pixels
-		vert_align top
-		left 5 
-		top 5
-		width 430
-		height 90
-		material Core/StatsBlockCenter
-        	border_size 1 1 1 1
-        	border_material Core/StatsBlockBorder
-        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
-	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
-	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
-	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
-	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
-	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
-        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
-	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
-
-
-		element TextArea(Example/Visibility/Algorithm): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			caption [SPACE] Algorithm
-		}
-		element TextArea(Example/Visibility/AlgorithmInfo): Example/Visibility/Templates/BasicText
-		{
-			left 210
-			width 120
-			height 30
-			caption :
-		}
-
-		element TextArea(Example/Visibility/Threshold): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 120
-			height 30
-			caption [-][+] Threshold
-		}
-		element TextArea(Example/Visibility/ThresholdInfo): Example/Visibility/Templates/BasicText
-		{
-			left 210
-			width 120
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/TestGeometryForVisibleLeaves): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 120
-			height 30
-			caption [G] Test Geometry For Leaves
-		}
-		element TextArea(Example/Visibility/TestGeometryForVisibleLeavesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 210
-			width 120
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/UseDepthPass): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 120
-			height 30
-			caption [X] Depth pass
-		}
-		element TextArea(Example/Visibility/UseDepthPassInfo): Example/Visibility/Templates/BasicText
-		{
-			left 210
-			width 120
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/AssumedVisibility): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 120
-			height 30
-			caption [8][9] Assumed Visibility
-		}
-		
-		element TextArea(Example/Visibility/AssumedVisibilityInfo): Example/Visibility/Templates/BasicText
-		{
-			left 210
-			width 120
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/CurrentObjectType): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 120
-			height 30
-			caption [F7] Object type
-		}	
-		element TextArea(Example/Visibility/CurrentObjectTypeInfo): Example/Visibility/Templates/BasicText
-		{
-			left 210
-			width 90
-			font_name TrebuchetMSBold
-			caption :			
-		}	
-	}
-
-	container BorderPanel(Example/Visibility/VisibilityStatsPanel)
-	{
-		metrics_mode pixels
-		vert_align top
-		horz_align right
-		left -250 
-		top 5
-		width 320
-		height 135
-		material Core/StatsBlockCenter
-        	border_size 1 1 1 1
-        	border_material Core/StatsBlockBorder
-        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
-	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
-	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
-	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
-	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
-	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
-        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
-	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
-
-		element TextArea(Example/Visibility/FrustumCulledNodes): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Frustum Culled Nodes
-		}
-		element TextArea(Example/Visibility/FrustumCulledNodesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/QueryCulledNodes): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Query Culled Nodes
-		}	
-		element TextArea(Example/Visibility/QueryCulledNodesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/TraversedNodes): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Traversed Nodes
-		}	
-		element TextArea(Example/Visibility/TraversedNodesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/HierarchyNodes): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Hierarchy Nodes
-		}	
-		element TextArea(Example/Visibility/HierarchyNodesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/RenderedNodes): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Rendered Nodes
-		}	
-		element TextArea(Example/Visibility/RenderedNodesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/ObjectsCount): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Number of objects
-		}	
-		element TextArea(Example/Visibility/ObjectsCountInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/QueriesIssued): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption Queries issued
-		}	
-		element TextArea(Example/Visibility/QueriesIssuedInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			font_name TrebuchetMSBold
-			caption :			
-		}
-		
-	}
-}
-
-
-Example/Visibility/HelpOverlay
-{
-	zorder 600
-	// Stats block
-	container BorderPanel(Example/Visibility/Help/HelpPanel)
-	{
-		metrics_mode pixels
-		horz_align left
-		vert_align top
-		width 600
-		height 300
-		left 200
-		top 200
-		material Core/StatsBlockCenter
-		//material Example/Visibility/Helpscreen
-        	border_size 1 1 1 1
-        	border_material Core/StatsBlockBorder
-        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
-	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
-	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
-	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
-	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
-	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
-        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
-	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
-
-		container Panel(Example/Visibility/Help/BreakPanel)
-		{
-			metrics_mode pixels
-			left 5 
-			top 22
-			width 590
-			height 1
-			material Core/StatsBreak
-		}
-
-		element TextArea(Example/Visibility/Help/HelpOptions)
-		{
-			metrics_mode pixels
-			left 5
-			top 5
-			width 90
-			height 30
-			font_name TrebuchetMSBold
-			char_height 19
-			caption Help: Additional Options
-			colour_top 1 1 0.7
-			colour_bottom 1 1 0.7
-		}
-
-		element TextArea(Example/Visibility/Help/ShowHelp): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F1] Show / Hide this screen
-		}
-		element TextArea(Example/Visibility/Help/Stats): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F2] Show / Hide stats
-		}
-		element TextArea(Example/Visibility/Help/AppState): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F3] Toggle between interactive / recorded walkthrough
-		}
-		element TextArea(Example/Visibility/Help/Recorded): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F4] Start / End frame recording
-		}
-		element TextArea(Example/Visibility/Help/Animation): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F9] Start / End animation
-		}
-		element TextArea(Example/Visibility/Help/Screenshots): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F11] Screenshot
-		}
-		element TextArea(Example/Visibility/Help/WriteOut): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F12] Write scene entities to file
-		}
-		
-		//-- visualization
-		element TextArea(Example/Visibility/Help/VizSection): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption ****** Visualization ******
-		}
-		element TextArea(Example/Visibility/Help/Viz): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [1] Show / hide visualization
-		}
-		element TextArea(Example/Visibility/Help/NextVizMode): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 175
-			height 30
-			caption [2] Toggle visualization mode
-		}
-		element TextArea(Example/Visibility/Help/ZoomViz): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 190
-			height 30
-			caption [3][4] Zoom in / out of visualization
-		}
-		element TextArea(Example/Visibility/Help/SceneDetail): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [R] Toggle between solid / wireframe / point based rendering
-		}
-		element TextArea(Example/Visibility/Help/DisplayCameraDetails): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [P] Show / hide camera details 
-		}
-		element TextArea(Example/Visibility/Help/DisplayOctree): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [T] Show / hide octree 
-		}
-		element TextArea(Example/Visibility/Help/UseShadows): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [S] Show / hide shadows
-		}
-		element TextArea(Example/Visibility/Help/Filter): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F] toggle filtering method (trilinear, anisotropic, bilinear)
-		}
-		element TextArea(Example/Visibility/Help/VisQuery): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption ****** Visibility Queries ******
-		}
-		element TextArea(Example/Visibility/Help/FromCameraQuery): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F5] From camera visible pixels (+ SHIFT: relative visibility)
-		}
-		element TextArea(Example/Visibility/Help/FromPointQuery): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F6] From camera visible pixels (+ SHIFT: relative visibility)
-		}
-		element TextArea(Example/Visibility/Help/QueryType): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [I] Change between occlusion query / item buffer visibility query
-		}
-		element TextArea(Example/Visibility/Help/QueryTarget): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [C] Mesh / Patch visibility (only item buffer)
-		}
-		element TextArea(Example/Visibility/Help/SceneObjects): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption ******* Generation / Destruction of scene objects ******
-		}
-		element TextArea(Example/Visibility/Help/GenerateObjects): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [F8] Generate 500 objects
-		}
-		element TextArea(Example/Visibility/Help/RemoveObjects): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [DEL] Remove generated objects 
-		}
-		element TextArea(Example/Visibility/Help/DropObject): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 180
-			height 30
-			caption [MOUSE LEFT] Drop object on terrain
-		}
-	}
-}
-
-Example/Visibility/QueryOverlay
-{
-	zorder 650
-	// Stats block
-	container BorderPanel(Example/Visibility/Query/QueryPanel)
-	{
-		metrics_mode pixels
-		horz_align left
-		vert_align top
-		width 600
-		height 145
-		left 200
-		top 300
-		material Core/StatsBlockCenter
-		
-        	border_size 1 1 1 1
-        	border_material Core/StatsBlockBorder
-        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
-	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
-	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
-	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
-	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
-	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
-        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
-	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
-
-		container Panel(Example/Visibility/Query/BreakPanel)
-		{
-			metrics_mode pixels
-			left 5 
-			top 22
-			width 590
-			height 1
-			material Core/StatsBreak
-		}
-
-		element TextArea(Example/Visibility/Query/Headline)
-		{
-			metrics_mode pixels
-			left 5
-			top 5
-			width 90
-			height 30
-			font_name TrebuchetMSBold
-			char_height 19
-			caption Exact Visibility Query
-			colour_top 1 1 0.7
-			colour_bottom 1 1 0.7
-		}
-
-		element TextArea(Example/Visibility/Query/QueryType): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Type
-		}
-		
-		
-		element TextArea(Example/Visibility/Query/QueryTypeInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-
-		element TextArea(Example/Visibility/Query/VisibleNodes): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Visible nodes
-		}
-		element TextArea(Example/Visibility/Query/VisibleNodesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-
-		element TextArea(Example/Visibility/Query/VisibleGeometry): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Visible geometry
-		}
-		element TextArea(Example/Visibility/Query/VisibleGeometryInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-
-
-		element TextArea(Example/Visibility/Query/VisiblePatches): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Visible patches
-		}
-		element TextArea(Example/Visibility/Query/VisiblePatchesInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-
-		element TextArea(Example/Visibility/Query/NodeVisibility): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Avg. node visibility
-		}
-
-		element TextArea(Example/Visibility/Query/NodeVisibilityInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-
-		element TextArea(Example/Visibility/Query/GeometryVisibility): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Avg. geometry visibility
-		}
-
-		element TextArea(Example/Visibility/Query/GeometryVisibilityInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-		element TextArea(Example/Visibility/Query/PatchVisibility): Example/Visibility/Templates/BasicText
-		{
-			left 5
-			width 90
-			height 30
-			caption Avg. patch visibility
-		}
-
-		element TextArea(Example/Visibility/Query/PatchVisibilityInfo): Example/Visibility/Templates/BasicText
-		{
-			left 180
-			width 90
-			height 30
-			caption :
-		}
-			
-
-	}
-}
