Index: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCManager.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCManager.cpp	(revision 699)
+++ GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCManager.cpp	(revision 721)
@@ -17,82 +17,5 @@
 
 Manager::Manager() 
-{
-   // Change it when the texture generation will be included...
-   //mOgreRoot = new Ogre::Root();
-   if (Ogre::Root::getSingletonPtr() == NULL)
-   {
-		mOgreRoot = new Ogre::Root("", "ogre.cfg", "Ogre.log");  
-		Ogre::LogManager::getSingleton().logMessage("OgreRoot created in LBBC");
-   }
-   else
-   {	
-	   mOgreRoot = Ogre::Root::getSingletonPtr();
-	   Ogre::LogManager::getSingleton().logMessage("OgreRoot assigned in LBCC");
-   }
-   
-   mDefaultHardwareBufferManager = new Ogre::DefaultHardwareBufferManager();
-   mMeshSerializer = new Ogre::MeshSerializer();
-   mXMLMeshSerializer = new Ogre::XMLMeshSerializer();
-   mMath = new Ogre::Math();
-   loadResources();   
-}
-
-void Manager::loadResources()
-{
-	// Load resource paths from config file
-	Ogre::ConfigFile cf;
-    cf.load("resources.cfg");
-    // Go through all sections & settings in the file
-	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
-
-	Ogre::String secName, typeName, archName;
-    while (seci.hasMoreElements())
-    {
-        secName = seci.peekNextKey();
-		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
-		Ogre::ConfigFile::SettingsMultiMap::iterator i;
-        for (i = settings->begin(); i != settings->end(); ++i)
-        {
-            typeName = i->first;
-            archName = i->second;
-			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
-        }
-    }
-	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-}
-
-void Manager::initRenderWindow()
-{
-    // Change it when the texture generation will be included...
-	/*
-	// Render system.
-	Ogre::LogManager::getSingleton().logMessage("Creating window...");
-	//mOgreRoot->showConfigDialog();
-	// Set parameters of render system (window size, etc.)
-	mOgreRoot->restoreConfig();
-	
-	mWnd = mOgreRoot->initialise(true);
-	mWnd->resize(512,512);
-
-	// Camera.
-	mScene = mOgreRoot->getSceneManager(Ogre::ST_GENERIC);
-	mRSys = mOgreRoot->getRenderSystem();
-	Ogre::LogManager::getSingleton().logMessage("Creating default camera...");
-	mCam = mScene->createCamera("SubMain Camera");
-	mCam->setPosition(-1, 22, 72);
-	mCam->lookAt(0, 22, 0);
-	mCam->setNearClipDistance(0.5);
-	// Viewports.
-	Ogre::LogManager::getSingleton().logMessage("Creating default viewort...");
-	mView = mWnd->addViewport(mCam);
-	mView->setBackgroundColour(Ogre::ColourValue(1.0f,1.0f,1.0f,0));
-	// All set up, activate.
-	Ogre::LogManager::getSingleton().logMessage("Setting up...");
-	//mWnd->setActive(true);
-	mWnd->setActive(false);	
-	mFrameListener = new ExampleFrameListener(mWnd,mCam,false,false);
-	mFrameListener->showDebugOverlay(false);
-	mOgreRoot->addFrameListener(mFrameListener);
-	*/
+{   
 }
 
@@ -103,22 +26,4 @@
 void Manager::shutdown()
 {
-	mOgreRoot->shutdown();
-	delete mOgreRoot;
-	delete mMeshSerializer;
-	delete mXMLMeshSerializer;
-	delete mMath;
-	// Not necessary if we have a RenderWindow...
-	delete mDefaultHardwareBufferManager;	
-	// Change it when the texture generation will be included...
-	//mWnd->destroy();
-	// Only necessary if we have a RenderWindow...
-	//delete mFrameListener;
-	//delete mScene;
-	//delete mRSys;
-	//delete mCam;
-	//delete mView;
-	//delete mWnd;
-	
-	
 }
 
@@ -127,8 +32,17 @@
 }
 
-Ogre::Mesh* Manager::loadMesh(Ogre::String name)
+Ogre::Mesh* Manager::loadMesh(Ogre::String folderName, Ogre::String fileName)
 {	
-	Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().load(name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);	
-	return meshPtr.getPointer();
+	//std::ifstream ifs;
+	//ifs.open(Ogre::String(folderName + fileName).c_str(), std::ios_base::in | std::ios_base::binary);
+	//Ogre::DataStreamPtr stream(new Ogre::FileStreamDataStream(folderName + fileName, &ifs, false));
+	//Ogre::MeshPtr mesh = OBA::OgreBase::getSingleton().getMeshManager()->create(fileName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+	//OBA::OgreBase::getSingleton().getMeshSerializer()->importMesh(stream, mesh.getPointer());
+
+	Ogre::ResourceGroupManager::getSingleton().addResourceLocation(folderName, "FileSystem", fileName, false);
+
+	Ogre::MeshPtr mesh = OBA::OgreBase::getSingleton().getMeshManager()->load(fileName, fileName);
+
+	return mesh.getPointer();
 }
 
@@ -149,5 +63,6 @@
 	}
 
-    mXMLMeshSerializer->importMesh(name, colourElementType, newMesh.getPointer());
+    OBA::OgreBase::getSingleton().getXMLMeshSerializer()->importMesh(name, colourElementType, newMesh.getPointer());
+
 	return newMesh.getPointer();
 }
@@ -156,5 +71,5 @@
 {
 	Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(name);
-	mMeshSerializer->exportMesh(meshPtr.getPointer(),name);
+	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(meshPtr.getPointer(),name);
 }
 
@@ -162,15 +77,5 @@
 {
 	Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(name);
-	mXMLMeshSerializer->exportMesh(meshPtr.getPointer(),name + ".xml");
-}
-
-Ogre::MeshSerializer* Manager::getMeshSerializer(void)
-{
-	return mMeshSerializer;
-}
-
-Ogre::XMLMeshSerializer* Manager::getXMLMeshSerializer(void)
-{
-	return mXMLMeshSerializer;
+	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(meshPtr.getPointer(),name + ".xml");
 }
 
