Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh	(revision 1654)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh	(revision 1658)
@@ -13,6 +13,7 @@
 #SCENE=vsposp_typical
 #SCENE=soda5_vsposp
-SCENE=soda_vsposp
-#SCENE=vsposp_vienna
+#SCENE=soda_vsposp
+#SCENE=vienna_vsposp
+SCENE=vsposp_citymodel
 #SCENE=soda5
 #SCENE=cube
@@ -62,12 +63,12 @@
  echo "$SCENE $METHOD"
 
- $PROGRAM $ENVIRONMENT \
- -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
- -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
- -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
- -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
- -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
- -hierarchy_construction_type=2 \
- -hierarchy_construction_recompute_split_on_repair=true
+# $PROGRAM $ENVIRONMENT \
+# -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+# -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+# -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
+# -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
+# -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
+# -hierarchy_construction_type=2 \
+# -hierarchy_construction_recompute_split_on_repair=true
 
 sh movefiles.sh $LOG_PREFIX-$METHOD
@@ -80,12 +81,12 @@
   echo "$SCENE $METHOD"
 
- $PROGRAM $ENVIRONMENT \
-  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
-  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
-  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
-  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
-  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
-  -hierarchy_construction_type=0 \
-  -bvh_term_max_leaves=$NODES
+# $PROGRAM $ENVIRONMENT \
+#  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+#  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+#  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
+#  -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
+#  -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
+#  -hierarchy_construction_type=0 \
+#  -bvh_term_max_leaves=$NODES
 
 sh movefiles.sh $LOG_PREFIX-$METHOD
@@ -94,4 +95,23 @@
 
 NODES=10000
+
+  METHOD=sequential-$NODES
+  echo "$SCENE $METHOD"
+
+# $PROGRAM $ENVIRONMENT \
+#  -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+#  -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+#  -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \
+ # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \
+ # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \
+ # -hierarchy_construction_type=0 \
+#  -bvh_term_max_leaves=$NODES
+
+sh movefiles.sh $LOG_PREFIX-$METHOD
+
+
+############################################################################
+
+NODES=30000
 
   METHOD=sequential-$NODES
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1655)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1658)
@@ -226,24 +226,20 @@
 bool Preprocessor::LoadBinaryObj(const string filename,
 								 SceneGraphNode *root,
-								 const bool loadMeshes,
 								 vector<FaceParentInfo> *parents)
 {
-	ifstream samplesIn(fileName, ios::binary);
+	//ifstream samplesIn(filename, ios::binary);
+	igzstream samplesIn(filename.c_str());
+	
 	if (!samplesIn.is_open())
 		return false;
 
-
+	cout << "binary obj dump available, loading " << filename.c_str() << endl;
 	// table associating indices with vectors
 	map<int, Vector3> hashTable;
+
 	// table for vertices
 	VertexContainer vertices; 
 	FaceContainer faces;
 
-	char str[100];
-	int meshGrouping;
-	Environment::GetSingleton()->GetIntValue("ObjParser.meshGrouping", meshGrouping);
-
-	int nMaxFaces = meshGrouping;
-
 	while (1)
 	{
@@ -271,4 +267,46 @@
 	
 	return true;
+}
+
+
+bool Preprocessor::ExportBinaryObj(const string filename, SceneGraphNode *root)
+{
+	//ifstream samplesIn(filename, ios::binary);
+	ogzstream samplesOut(filename.c_str());
+	if (!samplesOut.is_open())
+		return false;
+
+	ObjectContainer::const_iterator oit, oit_end = root->mGeometry.end();
+
+	for (oit = root->mGeometry.begin(); oit != oit_end; ++ oit)
+	{
+		Intersectable *obj = *oit;
+
+		if (obj->Type() == Intersectable::TRIANGLE_INTERSECTABLE)
+		{
+			Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem();
+
+			samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3));
+			samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 1), sizeof(Vector3));
+			samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 2), sizeof(Vector3));
+		}
+		else
+		{
+			cout << "not implemented intersectable type " << obj->Type() << endl;
+		}
+	}
+
+	return true;
+}
+
+static string ReplaceSuffix(string filename, string a, string b)
+{
+	string result = filename;
+
+	int pos = (int)filename.rfind(a, (int)filename.size() - 1);
+	if (pos == filename.size() - a.size()) {
+		result.replace(pos, a.size(), b);
+	}
+	return result;
 }
 
@@ -295,49 +333,77 @@
 		&mFaceParents : NULL;
 
-	if (files == 1) {
-		
+	if (files == 1) 
+	{
 		if (strstr(filename.c_str(), ".x3d"))
 		{
 			parser = new X3dParser;
-		}
-		else
-		{
-		  if (strstr(filename.c_str(), ".ply") || strstr(filename.c_str(), ".plb"))
-		  {
-			  parser = new PlyParser;
-		  }
-		  else if (strstr(filename.c_str(), ".obj"))
-		  {
-			  // hack: load binary dump
-			  string binFile = ReplaceSuffix(filename, ".obj", ".bin");
 			
-			  const bool loaded = 
-				  LoadBinaryObj(binFile, mSceneGraph->GetRoot(), mLoadMeshes, fi);
-				
-			  if (loaded)
-				return true;
-
-              parser = new ObjParser;
-		  }
-		  else 
-		  {
-			  parser = new UnigraphicsParser;
-		  }
-		}
-
-		cout << filename << endl;
-		
-		result = parser->ParseFile(filename, 
+			result = parser->ParseFile(filename, 
+									   mSceneGraph->GetRoot(),
+									   mLoadMeshes,
+									   fi);
+			delete parser;
+		}
+		else if (strstr(filename.c_str(), ".ply") || strstr(filename.c_str(), ".plb"))
+		{
+			parser = new PlyParser;
+
+			result = parser->ParseFile(filename, 
+									   mSceneGraph->GetRoot(),
+									   mLoadMeshes,
+									   fi);
+			delete parser;
+		}
+		else if (strstr(filename.c_str(), ".obj"))
+		{
+			// hack: load binary dump
+			string binFile = ReplaceSuffix(filename, ".obj", ".bin");
+
+			if (!mLoadMeshes)
+			{
+				result = LoadBinaryObj(binFile, mSceneGraph->GetRoot(), fi);
+			}
+
+			if (!result)
+			{
+				cout << "no binary dump available or loading full meshes, parsing file" << endl;
+				parser = new ObjParser;
+		
+				result = parser->ParseFile(filename, 
 								   mSceneGraph->GetRoot(),
 								   mLoadMeshes,
 								   fi);
-
-		// only works for triangles
-		ExportBinaryObj(binFile):
-
-		delete parser;
-
+						
+				// only works for triangles
+				if (!mLoadMeshes)
+				{
+					cout << "exporting binary obj to " << binFile << "... " << endl;
+					ExportBinaryObj(binFile, mSceneGraph->GetRoot());
+					cout << "finished" << endl;
+				}
+
+				delete parser;
+			}
+			else if (1)
+			{
+				ExportBinaryObj("../data/test.bin", mSceneGraph->GetRoot());
+				//Exporter *exporter = Exporter::GetExporter("dummy.wrl");
+				//exporter->ExportGeometry(mSceneGraph->GetRoot()->mGeometry);
+			}
+		}
+		else 
+		{
+			parser = new UnigraphicsParser;
+			result = parser->ParseFile(filename, 
+									   mSceneGraph->GetRoot(),
+									   mLoadMeshes,								  
+									   fi);
+			delete parser;
+		}
+		
+		cout << filename << endl;
 	} 
-	else {
+	else 
+	{
 		vector<string>::const_iterator fit, fit_end = filenames.end();
 		
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 1613)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 1658)
@@ -208,7 +208,13 @@
 protected:
 
+	bool LoadBinaryObj(const string filename,
+					   SceneGraphNode *root,
+					   vector<FaceParentInfo> *parents);
+
+	bool ExportBinaryObj(const string filename, SceneGraphNode *root);
+
+
 	void SetupRay(Ray &ray, const Vector3 &point, const Vector3 &direction) const;
 
-	// matt: previously was a signal
 	void EvalPvsStat();
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1640)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1658)
@@ -46,5 +46,4 @@
 // DLL function signature
 typedef GlRendererWidget *(*importFunction)(Preprocessor *);
-
 
 
@@ -142,5 +141,5 @@
 		else if (strstr(strippedFilename.c_str(), ".obj"))
 		{
-			kdFilename += ReplaceSuffix(strippedFilename, ".dat", suffix);
+			kdFilename += ReplaceSuffix(strippedFilename, ".obj", suffix);
 		}
 		else
