Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 904)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 931)
@@ -15,4 +15,6 @@
 #include "VssPreprocessor.h"
 #include "RssPreprocessor.h"
+#include "BoundingBoxConverter.h"
+
 
 namespace GtpVisibilityPreprocessor {
@@ -1858,5 +1860,5 @@
 
 
-bool ViewCellsManager::ExportViewCells(const string filename, const bool exportPvs)
+bool ViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects)
 {
 	return false;
@@ -1956,7 +1958,4 @@
 										 IndexedBoundingBoxContainer &boxes) const
 {
-	// HACK: needed only for lower_bound algorithm to find the 
-	// intersected objects
-
 	Vector3 bmin, bmax;
 	int id;
@@ -2021,6 +2020,44 @@
 }
 
+
+float ViewCellsManager::GetFilterWidth() 
+{
+	return mFilterWidth;
+}
+
+
+float ViewCellsManager::GetAbsFilterWidth() 
+{
+	return Magnitude(mViewSpaceBox.Size()) * mFilterWidth;
+}
+
+
+bool ViewCellsManager::ExportBoundingBoxes(ofstream &xmlstream, 
+										   const ObjectContainer &objects) const
+{
+	//-- export the view cells and the pvs
+	xmlstream << "<BoundingBoxes>" << endl;
+
+	ObjectContainer::const_iterator oit, oit_end = objects.end();
+
+	for (oit = objects.begin(); oit != oit_end; ++ oit)
+	{
+			MeshInstance *mi = dynamic_cast<MeshInstance *>(*oit);
+			const AxisAlignedBox3 box = mi->GetBox();
+
+			//-- the bounding boxes
+			xmlstream << "<BoundingBox" << " id=\"" << mi->GetId() << "\""
+				      << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\""
+					  << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl;
+	}
+
+	xmlstream << "</BoundingBoxes>" << endl;
+
+	return true;
+}
+
+
 /**********************************************************************/
-/*                   BspViewCellsManager implementation               */
+/*                 BspViewCellsManager implementation                 */
 /**********************************************************************/
 
@@ -2282,9 +2319,9 @@
 		char filename[100];
 		environment->GetStringValue("ViewCells.filename", filename);
-		ExportViewCells(filename, mExportPvs);
+		ExportViewCells(filename, mExportPvs, objects);
 	}
 	
 	// export bounding boxes
-	if (mExportBboxesForPvs)
+	if (0 && mExportBboxesForPvs)
 	{
 		char filename[100];
@@ -2729,5 +2766,5 @@
 
 
-bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs)
+bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects)
 {
 	cout << "exporting view cells to xml ... ";
@@ -3974,5 +4011,5 @@
 		char filename[100];
 		environment->GetStringValue("ViewCells.filename", filename);
-		ExportViewCells(filename, mExportPvs);
+		ExportViewCells(filename, mExportPvs, objects);
 	}
 
@@ -4687,5 +4724,6 @@
 
 ViewCellsManager *ViewCellsManager::LoadViewCells(const string filename, 
-												  ObjectContainer *objects)
+												  ObjectContainer *objects,
+												  BoundingBoxConverter *bconverter)
 {
 	ViewCellsParser parser;
@@ -4695,5 +4733,7 @@
 	Debug << "vc filename: " << filename << endl;
 
-	if (parser.ParseFile(filename, &vm, objects))
+	//BoundingBoxConverter bconverter;
+
+	if (parser.ParseFile(filename, &vm, objects, bconverter))
 	{
 		//vm->PrepareLoadedViewCells();
@@ -4719,6 +4759,7 @@
 
 
-
-bool VspBspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs)
+bool VspBspViewCellsManager::ExportViewCells(const string filename, 
+											 const bool exportPvs, 
+											 const ObjectContainer &objects)
 {
 	cout << "exporting view cells to xml ... ";
@@ -4737,5 +4778,5 @@
 		   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl;
 
-
+	ExportBoundingBoxes(stream, objects);
 
 	//-- the type of the view cells hierarchy
@@ -4750,5 +4791,5 @@
 
 
-	//-- export the hierarchy
+	//-- export the spatial hierarchy
 	stream << "<Hierarchy>" << endl;
 	mVspBspTree->Export(stream);
