Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj	(revision 660)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj	(revision 685)
@@ -65,5 +65,5 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;..\include;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\src;&quot;$(CG_INC_PATH)&quot;;&quot;$(GTPDIR)\NonGTP\Xerces&quot;;&quot;$(GTPDIR)\NonGTP\Devil\include&quot;;&quot;$(GTPDIR)\NonGTP\Zlib\include&quot;"
+				AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;..\include;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\src;&quot;$(CG_INC_PATH)&quot;;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
 				RuntimeLibrary="2"
Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env	(revision 666)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env	(revision 685)
@@ -177,5 +177,5 @@
 	# samples used for view cell construction
 	Construction {
-		samples 1000000
+		samples 100000
 		samplesPerPass 200000
 	}
@@ -219,5 +219,5 @@
 		refine false
 		compress false
-		merge false
+		merge true
 	}
 
@@ -230,11 +230,12 @@
 		colorCode Random
 		exportRays false
-		exportGeometry false
+		exportGeometry true
 		exportMergedViewCells false
 		useClipPlane true
 		clipPlaneAxis 1
-	}
-
-	showVisualization false	
+		clipPlanePos 0.35
+	}
+
+	showVisualization true	
 	evaluateViewCells false
 	
@@ -302,6 +303,6 @@
 VspBspTree {
 	Construction {
-		samples 800000
-		epsilon 0.0005
+		samples 200000
+		epsilon 0.00005
 		randomize false
 		renderCostWeight 1.0
@@ -350,5 +351,5 @@
 		minGlobalCostRatio      0.0000001
 #		minGlobalCostRatio      0.0001
-		maxViewCells		20000
+		maxViewCells		10000
 	
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 683)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 685)
@@ -1826,5 +1826,5 @@
 		
 		// clamp because of possible precision issues
-		if (0 && 
+		if (1 && 
 			(!splitSuccessFull || (pFront <= 0) || (pBack <= 0) || 
 			!geomFront.Valid() || !geomBack.Valid()))
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 682)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 685)
@@ -1282,5 +1282,5 @@
 					optBool,
 					"view_cells_merge_empty=",
-					"false");
+					"true");
 
 	RegisterOption("ViewCells.evaluateViewCells",
@@ -1604,4 +1604,8 @@
 				   "true");
 
+	RegisterOption("Preprocessor.computeVisibility",
+				   optBool,
+				   "preprocessor_compute_visibility=",
+				   "true");
 
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 675)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 685)
@@ -30,4 +30,5 @@
   environment->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes);
   environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish);
+  environment->GetBoolValue("Preprocessor.computeVisibility", mComputeVisibility);
   Debug << "load polygons as meshes: " << mLoadPolygonsAsMeshes << endl;
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 677)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 685)
@@ -13,4 +13,5 @@
 #include "Beam.h"
 #include "GlRenderer.h"
+#include "ViewCellBsp.h"
 
 bool use2dSampling = false;
@@ -47,4 +48,5 @@
 }
 
+
 VssPreprocessor::~VssPreprocessor()
 {
@@ -52,4 +54,5 @@
 	DEL_PTR(mViewSpaceBox);
 }
+
 
 void
@@ -155,5 +158,5 @@
 		// cast again to ensure that there is no objectA
 		SetupRay(ray, pointB, direction);
-		ray.mFlags |= Ray::CULL_BACKFACES;
+		ray.mFlags |= Ray::CULL_BACKFACESw;
 		
 		if (mKdTree->CastRay(ray)) 
@@ -317,5 +320,5 @@
   vssRays.SelectRays(number, rays);
   
-  exporter->ExportRays(rays, RgbColor(1, 0, 0));
+  //exporter->ExportRays(rays, RgbColor(1, 0, 0));
 
   delete exporter;
@@ -401,5 +404,5 @@
   }
 }
-#include "ViewCellBsp.h"
+
 
 void VssPreprocessor::TestBeamCasting(VssTree *tree, 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp	(revision 678)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp	(revision 685)
@@ -1135,6 +1135,24 @@
 void X3dExporter::ExportGeometry(const ObjectContainer &objects)
 {
+#if 0
 	for (int j = 0; j < objects.size(); ++ j)
 		ExportIntersectable(objects[j]);
+#else
+	// hack
+	PolygonContainer polys;
+	for (int j = 0; j < objects.size(); ++ j){
+		polys.push_back(new Polygon3(dynamic_cast<MeshInstance *>(objects[j])->GetMesh()->mVertices));
+	}
+
+	Mesh dummyMesh;
+	PolygonContainer::const_iterator it, it_end = polys.end();
+
+	for (it = polys.begin(); it != it_end; ++ it)
+	  {
+		(*it)->AddToMesh(dummyMesh);
+	  }
+	ExportMesh(&dummyMesh);
+	CLEAR_CONTAINER(polys);
+#endif
 }
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/default.env
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/default.env	(revision 677)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/default.env	(revision 685)
@@ -23,9 +23,10 @@
 	useGlRenderer true
 #	type sampling
-	type vss
-#	type rss
+#	type vss
+	type rss
 	detectEmptyViewSpace true
 	pvsRenderErrorSamples 10000
 	quitOnFinish false
+	computeVisibility false
 }
 
@@ -39,5 +40,5 @@
 	loadInitialSamples  false
 	storeInitialSamples false
-	useViewSpaceBox true
+	useViewSpaceBox false
 	enlargeViewSpace true
 }
@@ -75,7 +76,7 @@
 RssPreprocessor {
 	samplesPerPass 100000
-	initialSamples 100000
-	vssSamples 100
-	vssSamplesPerPass 100
+	initialSamples 500000
+	vssSamples 5000000
+	vssSamplesPerPass 500000
 	useImportanceSampling true
 
@@ -179,6 +180,6 @@
 	maxStaticMemory	40
 
-	exportToFile true
-	loadFromFile false
+	exportToFile false
+	loadFromFile true
 
 	#type kdTree
@@ -213,5 +214,5 @@
 		refine false
 		compress false
-		merge false
+		merge true
 	}
 
@@ -245,5 +246,7 @@
 #	filename ../scripts/viewcells_vienna.xml
 #	filename ../scripts/viewcells_atlanta.xml
-	filename ../scripts/viewcells_soda5.xml
+#	filename ../scripts/viewcells_soda5-2.xml
+#	filename ../data/soda/soda5-viewcells.xml
+	filename ../scripts/viewcells_atlanta.xml
 }
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 658)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 685)
@@ -159,4 +159,5 @@
   bool mQuitOnFinish;
   bool mLoadPolygonsAsMeshes;
+  bool mComputeVisibility;
 
 protected:
Index: GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp	(revision 599)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp	(revision 685)
@@ -20,6 +20,6 @@
 PreprocessorThread::Main()
 {
-     
-  if (1) {
+  
+  if (mPreprocessor->mComputeVisibility) {
     mPreprocessor->ComputeVisibility();
 	//	mPreprocessor->ExportPreprocessedData("scene.vis");
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 684)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 685)
@@ -1754,6 +1754,4 @@
 								   const bool createMesh)
 {
-	CreateMesh(viewCell);
-
 	float area = 0;
 	float volume = 0;
@@ -1772,4 +1770,5 @@
 		area += geom.GetArea();
 		volume += geom.GetVolume();
+		CreateMesh(*it);
 	}
 
@@ -3592,4 +3591,5 @@
 		vm->FinalizeViewCells(true);
 
+		vm->mViewCellsTree->AssignRandomColors();
 		Debug << (int)vm->mViewCells.size() << " view cells loaded" << endl;
 	}
@@ -3670,6 +3670,4 @@
 									  const bool createMesh)
 {
-	CreateMesh(viewCell);
-
 	float area = 0;
 	float volume = 0;
@@ -3688,4 +3686,5 @@
 		area += geom.GetArea();
 		volume += geom.GetVolume();
+		CreateMesh(*it);
 	}
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 608)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 685)
@@ -123,4 +123,6 @@
 		RenderViewCell(*it);
 	  }
+	} else {
+	  //	  cerr<<"Empty viewcell mesh\n";
 	}
   }
@@ -732,9 +734,15 @@
 
   
-  RenderErrors();
-  RenderInfo();
-
-    if (mRenderViewCells) 
+  if (!mRenderViewCells) {
+	RenderErrors();
+	RenderInfo();
+  } else {
 	RenderViewCells();
+
+	mWireFrame = true;
+	RenderScene();
+	mWireFrame = false;
+	RenderInfo();
+  }
 
   mFrame++;
@@ -816,5 +824,5 @@
   vl->addWidget(slider);
   slider->show();
-  slider->setRange(1, 10000);
+  slider->setRange(1, 5000);
   slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
   slider->setValue(500);
@@ -946,4 +954,5 @@
   SetupCamera();
   glEnable(GL_CULL_FACE);
+  //glDisable(GL_CULL_FACE);
   glCullFace(GL_FRONT);
   double eq[4];
