Index: trunk/VUT/work/TestCulling/SceneContentGenerator.cpp
===================================================================
--- trunk/VUT/work/TestCulling/SceneContentGenerator.cpp	(revision 82)
+++ trunk/VUT/work/TestCulling/SceneContentGenerator.cpp	(revision 85)
@@ -101,4 +101,8 @@
 	mMaxPos = maxPos;
 }
-
+//-----------------------------------------------------------------------
+int SceneContentGenerator::GetObjectCount()
+{
+	return mCount;
+}
 } // namespace Ogre
Index: trunk/VUT/work/TestCulling/TestCullingApplication.cpp
===================================================================
--- trunk/VUT/work/TestCulling/TestCullingApplication.cpp	(revision 84)
+++ trunk/VUT/work/TestCulling/TestCullingApplication.cpp	(revision 85)
@@ -39,4 +39,9 @@
 }*/
 //-----------------------------------------------------------------------
+TestCullingApplication::~TestCullingApplication()
+{
+	delete mSceneContentGenerator;
+}
+//-----------------------------------------------------------------------
 void TestCullingApplication::createScene(void)
 {
@@ -48,6 +53,6 @@
 	//l->setPosition(20,80,50);
 
-	SceneContentGenerator contentGenerator(mSceneMgr);
-	contentGenerator.GenerateScene(330, "robot.mesh");
+	mSceneContentGenerator = new SceneContentGenerator(mSceneMgr);
+	mSceneContentGenerator->GenerateScene(330, "robot.mesh");
 
 	// Create a skybox
@@ -60,5 +65,5 @@
 }
 //-----------------------------------------------------------------------
-void TestCullingApplication::setupGui( void )
+void TestCullingApplication::setupGui()
 {
 	 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE);
@@ -74,7 +79,8 @@
 }
 //-----------------------------------------------------------------------
-void TestCullingApplication::createFrameListener(void)
-{
-	mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer);
+void TestCullingApplication::createFrameListener()
+{
+	mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, 
+		mGUIRenderer, mSceneContentGenerator);
 	mFrameListener->showDebugOverlay(true);
 	mRoot->addFrameListener(mFrameListener);
@@ -91,5 +97,8 @@
 /***********************************************/
 //-----------------------------------------------------------------------
-MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer)
+MouseQueryListener::MouseQueryListener(RenderWindow* win, Camera* cam, 
+									   SceneManager *sceneManager, 
+									   CEGUI::Renderer *renderer,
+									   SceneContentGenerator *sceneContentGenerator)
         : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 
 		mShutdownRequested(false)
@@ -102,4 +111,6 @@
 	mSceneMgr = sceneManager;
 
+	mSceneContentGenerator = sceneContentGenerator;
+
     // Reduce move speed
 	mMoveSpeed = 50;
@@ -107,5 +118,5 @@
 
 	mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;
-	mThreshold = 0;
+	mVisibilityThreshold = 0;
     
 	// Register this so that we get mouse events.
@@ -135,4 +146,6 @@
 	mRenderedNodesInfo->setCaption(": 0");
 	mNumObjectsInfo->setCaption(": 0");
+
+	setAlgorithm(mCurrentAlgorithm);
 
     pOver->show();
@@ -170,5 +183,5 @@
     if (e->getButtonID() & InputEvent::BUTTON0_MASK)
     {
-		CEGUI::MouseCursor::getSingleton().show( );
+		CEGUI::MouseCursor::getSingleton().show();
         mLMouseDown = false;
     }
@@ -176,5 +189,5 @@
     else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
     {
-        CEGUI::MouseCursor::getSingleton().show( );
+        CEGUI::MouseCursor::getSingleton().show();
         mRMouseDown = false;
     }
@@ -209,5 +222,5 @@
         timeDelay -= evt.timeSinceLastFrame;
 
-    KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());
+    KEY_PRESSED(KC_SPACE, 0.3, nextAlgorithm());
 
 	KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10));
@@ -222,16 +235,23 @@
 void MouseQueryListener::changeThreshold(int incr)
 {
-	mThreshold += incr; if(mThreshold < 0) mThreshold = 0;
-	
-	char str[100]; sprintf(str,": %d", mThreshold);
-
-	mSceneMgr->setOption("Threshold", &mThreshold); 
+	mVisibilityThreshold += incr; 
+	if(mVisibilityThreshold < 0) mVisibilityThreshold = 0;
+	
+	char str[100]; sprintf(str,": %d", mVisibilityThreshold);
+
+	mSceneMgr->setOption("Threshold", &mVisibilityThreshold); 
 	mThresholdInfo->setCaption(str);
 }
 //-----------------------------------------------------------------------
-void MouseQueryListener::changeAlgorithm()
-{
-    mCurrentAlgorithm = ++mCurrentAlgorithm % GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS,
-
+void MouseQueryListener::nextAlgorithm()
+{
+	mCurrentAlgorithm = ++mCurrentAlgorithm % 
+		GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS,
+
+	setAlgorithm(mCurrentAlgorithm);
+}
+//-----------------------------------------------------------------------
+void MouseQueryListener::setAlgorithm(int algorithm)
+{
 	mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]);
 	mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm);
@@ -258,5 +278,5 @@
 	mRenderedNodesInfo->setCaption(str);
 
-	sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount()); 
+	sprintf(str,": %d", mSceneContentGenerator->GetObjectCount()); 
 	mNumObjectsInfo->setCaption(str);
 }
Index: trunk/VUT/work/TestCulling/SceneContentGenerator.h
===================================================================
--- trunk/VUT/work/TestCulling/SceneContentGenerator.h	(revision 82)
+++ trunk/VUT/work/TestCulling/SceneContentGenerator.h	(revision 85)
@@ -34,5 +34,6 @@
 	void SetMinPos(Vector3 minPos);
 	void SetMaxPos(Vector3 maxPos);
-	
+	int GetObjectCount();
+
 protected:
 
Index: trunk/VUT/work/TestCulling/TestCullingApplication.h
===================================================================
--- trunk/VUT/work/TestCulling/TestCullingApplication.h	(revision 84)
+++ trunk/VUT/work/TestCulling/TestCullingApplication.h	(revision 85)
@@ -6,5 +6,5 @@
 #include "ExampleApplication.h"
 #include "VisibilityEnvironment.h"
-
+#include "SceneContentGenerator.h"
 
 Real timeDelay = 0;
@@ -30,5 +30,5 @@
 
     MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 
-			CEGUI::Renderer *renderer);
+			CEGUI::Renderer *renderer, SceneContentGenerator *sceneContentGenerator);
 
 
@@ -60,5 +60,6 @@
 	void keyClicked(KeyEvent* e);
 
-	void changeAlgorithm();
+	void nextAlgorithm();
+	void setAlgorithm(int algorithm);
 	void changeThreshold(int incr);
 	void changeStats();
@@ -72,5 +73,5 @@
 	bool mShutdownRequested;
 	int mCurrentAlgorithm;
-	int mThreshold;
+	int mVisibilityThreshold;
 
 	OverlayElement *mAlgorithmInfo;
@@ -82,4 +83,6 @@
 	OverlayElement *mRenderedNodesInfo;
 	OverlayElement *mNumObjectsInfo;
+
+	SceneContentGenerator *mSceneContentGenerator;
 };
 
@@ -87,22 +90,12 @@
 class TestCullingApplication : public ExampleApplication
 {
+public:
+	~TestCullingApplication();
+
 protected:
-	void createScene(void);
-	void createFrameListener(void);
-	void setupGui(void);
-	/** generates a the scene hierarchy with random values 
-	@param number of objects to generate
-	*/
-	void GenerateScene(int numObjects);
-
-	/** generates a new scene object 
-	@param tranlationRatio ratio between minimal and maximal possible translation
-	@param rotationRatio ratio between minimal and maximal possible rotation
-	@idx the index of the new object
-	@entName the name of the object entity
-	*/
-	void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 
-							 const int idx, const String &entName);
-
+	void createScene();
+	void createFrameListener();
+	void setupGui();
+	
 	//virtual void createCamera(void);
 
@@ -116,4 +109,6 @@
 	Vector3 mMaxAngle;
 
+	SceneContentGenerator *mSceneContentGenerator;
+
 private:
 	void chooseSceneManager(void);
