Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 85)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 86)
@@ -96,5 +96,8 @@
 
 	mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr);
+	
+	mTerrainContentGenerator->GenerateScene(500, "ninja.mesh");
 	mTerrainContentGenerator->GenerateScene(500, "robot.mesh");
+
 	// no limitations needed anymore: the user can set 
 	// objects also on peaks of terrain
@@ -137,20 +140,19 @@
 									   CEGUI::Renderer *renderer,
 									   TerrainContentGenerator *sceneGenerator): 
-ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 
-mShutdownRequested(false)
-{
-	// Setup default variables
-	mCurrentObject = NULL;
-	mLMouseDown = false;
-	mRMouseDown = false;
-	mSceneMgr = sceneManager;
-	mTerrainContentGenerator = sceneGenerator;
-
-    // Reduce move speed
+ExampleFrameListener(win, cam, false, true), 
+mGUIRenderer(renderer), 
+mShutdownRequested(false), 
+mUseOptimization(false),
+mLMouseDown(false),
+mRMouseDown(false),
+mSceneMgr(sceneManager),
+mCurrentObject(NULL),
+mTerrainContentGenerator(sceneGenerator),
+mVisibilityThreshold(0),
+mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING)
+{
+	// Reduce move speed
 	mMoveSpeed = 50;
 	mRotateSpeed *= 2;
-
-	mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;
-	mVisibilityThreshold = 0;
     
 	// Register this so that we get mouse events.
@@ -173,4 +175,5 @@
 	mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo");
 	mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo");
+	mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo");
 
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
@@ -182,6 +185,9 @@
 	mRenderedNodesInfo->setCaption(": 0");
 	mNumObjectsInfo->setCaption(": 0");
+	mUseOptimizationInfo->setCaption(": true");
 
 	setAlgorithm(mCurrentAlgorithm);
+	toggleUseOptimization();
+	toggleShowOctree();
 
     pOver->show();
@@ -293,4 +299,6 @@
 	KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10));
 	KEY_PRESSED(KC_ADD, 0, changeThreshold(10));
+	KEY_PRESSED(KC_O, 0.3, toggleUseOptimization());
+	KEY_PRESSED(KC_S, 0.3, toggleShowOctree());
 	//KEY_PRESSED(KC_T, 1, change);
       
@@ -321,4 +329,5 @@
 void MouseQueryListener::setAlgorithm(int algorithm)
 {
+	//OutputDebugString("changing algorithm\n");
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
 	mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm);
@@ -347,4 +356,23 @@
 	sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount()); 
 	mNumObjectsInfo->setCaption(str);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::toggleUseOptimization()
+{
+	mUseOptimization = !mUseOptimization;
+
+	mSceneMgr->setOption("UseOptimization", &mUseOptimization);
+
+	if(mUseOptimization)
+		mUseOptimizationInfo->setCaption(": true");
+	else
+		mUseOptimizationInfo->setCaption(": false");
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::toggleShowOctree()
+{
+	mShowOctree = !mShowOctree;
+
+	mSceneMgr->setOption("ShowOctree", &mShowOctree);
 }
 //-----------------------------------------------------------------------
Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 85)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h	(revision 86)
@@ -63,4 +63,6 @@
 	void changeThreshold(int incr);
 	void changeStats();
+	void toggleUseOptimization();
+	void toggleShowOctree();
 
 protected:
@@ -80,5 +82,5 @@
     OverlayElement *mTraversedNodesInfo;
 	OverlayElement *mHierarchyNodesInfo;
-	//OverlayElement *mSceneNodesInfo;
+	OverlayElement *mUseOptimizationInfo;
 	OverlayElement *mRenderedNodesInfo;
 	OverlayElement *mNumObjectsInfo;
@@ -89,4 +91,7 @@
 	RayQueryExecutor *mRayQueryExecutor;
 	TerrainContentGenerator *mTerrainContentGenerator;
+
+	bool mUseOptimization;
+	bool mShowOctree;
 };
 
