Index: trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 159)
+++ trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 160)
@@ -40,5 +40,4 @@
 	//mShowBoundingBoxes = true;
 	//mShowBoxes = true;
-	//mShowBoxes = true;
 
 	// TODO: set maxdepth to reasonable value
Index: trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp	(revision 159)
+++ trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp	(revision 160)
@@ -12,7 +12,7 @@
 namespace Ogre {
 
-/*******************************************************/
-/*     SceneContentGenerator implementation            */
-/*******************************************************/
+/*************************************************************/
+/*           SceneContentGenerator implementation            */
+/*************************************************************/
 
 //-----------------------------------------------------------------------
@@ -23,6 +23,5 @@
 mMinAngle(Vector3(0.0f, 0.0f, 0.0f)),
 mMaxAngle(Vector3(360, 360, 360)),
-mScale(0.1, 0.1, 0.1)
-//, mObjectCount(0)
+mScale(0.1, 0.1, 0.1)//, mObjectCount(0)
 {
 }
@@ -36,9 +35,9 @@
 	Vector3 translationRatio;
 
-	int old_count = GetObjectCount();
+	int new_size = GetObjectCount() + numObjects;
 	int failed_attempts = 0; // counter used to avoid invinite loop
 
 	//-- create random values between zero and one
-	while ((GetObjectCount() < numObjects + old_count) && 
+	while ((GetObjectCount() <  new_size) && 
 		   (failed_attempts < MAX_FAILED_ATTEMPTS))
 	{
@@ -70,16 +69,17 @@
 	Entity *ent = mSceneMgr->createEntity(name, objName + ".mesh");
 		
-	SceneNode *currentObject = mSceneMgr->getRootSceneNode()->
+	SceneNode *node = mSceneMgr->getRootSceneNode()->
 		createChildSceneNode(String(name) + "Node", position);
 
 	//ent->setCastShadows(false);
-	currentObject->attachObject(ent);
-	currentObject->setScale(mScale);
-	currentObject->setOrientation(orientation);
-
-	//-- store pointer to object
-	mSceneObjects.push_back(currentObject);
-
-	return currentObject;
+	node->attachObject(ent);
+	node->setScale(mScale);
+	node->setOrientation(orientation);
+
+	// store pointer to node and object
+	mSceneNodes.push_back(node);
+	mEntities.push_back(ent);
+
+	return node;
 }
 //-----------------------------------------------------------------------
@@ -116,5 +116,5 @@
 int SceneContentGenerator::GetObjectCount()
 {
-	return (int)mSceneObjects.size();
+	return (int)mSceneNodes.size();
 }
 //-----------------------------------------------------------------------
@@ -129,5 +129,5 @@
 	std::vector<SceneNode *>::const_iterator it, it_end;
 
-	it_end = mSceneObjects.end();
+	it_end = mSceneNodes.end();
 
 	if(!ofstr.is_open())
@@ -136,5 +136,5 @@
 	char str[100];
 
-	for(it = mSceneObjects.begin(); it < it_end; ++it)
+	for(it = mSceneNodes.begin(); it < it_end; ++it)
 	{
 		SceneNode *node = (*it);
@@ -164,5 +164,5 @@
 		return false;
 
-	//mSceneObjects.clear(); // reset list of objects
+	//mSceneNodes.clear(); // reset list of objects
 
 	while (!ifstr.eof()) 
@@ -173,8 +173,4 @@
 			&orientation.w, &orientation.x, &orientation.y, &orientation.z,
 			&mScale.x, &mScale.y, &mScale.z);
-		
-		/*Vector3 rot(orientation.getYaw().valueDegrees(), 
-					orientation.getPitch().valueDegrees(), 
-					orientation.getRoll().valueDegrees());*/
 
 		GenerateSceneObject(position, orientation, objName);
@@ -187,4 +183,34 @@
 	return true;
 }
-
+//-----------------------------------------------------------------------
+SceneNodeList *SceneContentGenerator::GetGeneratedSceneNodes()
+{
+	return &mSceneNodes;
+}
+//-----------------------------------------------------------------------
+EntityList *SceneContentGenerator::GetGeneratedEntities()
+{
+	return &mEntities;
+}
+//-----------------------------------------------------------------------
+void SceneContentGenerator::RemoveGeneratedObjects()
+{
+	//-- destroy scene nodes and detach entities
+	while (!mSceneNodes.empty())
+	{
+		SceneNode *node = mSceneNodes.back();
+		mSceneNodes.pop_back();
+		
+		//node->detachAllObjects();
+		mSceneMgr->destroySceneNode(node->getName());
+	}
+	//-- remove and destroy entities
+	while (!mEntities.empty())
+	{
+		Entity *ent = mEntities.back();
+		mEntities.pop_back();
+		
+		mSceneMgr->removeEntity(ent);
+	}
+}
 } // namespace Ogre
