Index: /trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env	(revision 329)
+++ /trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env	(revision 330)
@@ -9,7 +9,7 @@
 #	filename vienna.x3d
 #	filename ../data/vienna/vienna-simple.x3d
-#	filename ../data/vienna/vienna-buildings.x3d
+	filename ../data/vienna/vienna-buildings.x3d
 #	filename ../data/vienna/viewcells-25-sel.x3d
-	filename ../data/atlanta/atlanta2.x3d
+#	filename ../data/atlanta/atlanta2.x3d
 #	filename ../data/soda/soda.dat
 #	filename ../data/soda/soda5.dat
@@ -56,10 +56,10 @@
 
 Sampling {
-	totalSamples	1000000
+	totalSamples	5000
 	samplesPerPass  20
 }
 
 ViewCells {
-	# hierarchy kdTree
+	#hierarchy kdTree
 	hierarchy bspTree
 	# hierarchy sceneDependent
@@ -69,6 +69,6 @@
 	
 #	filename ../data/atlanta/atlanta_viewcells_large.x3d
-#	filename ../data/vienna/viewcells-25-sel.x3d
-	filename ../data/vienna/viewcells-25.x3d
+	filename ../data/vienna/viewcells-25-sel.x3d
+#	filename ../data/vienna/viewcells-25.x3d
 #	filename ../data/vienna/viewcells-large-sel.x3d
 }
@@ -79,5 +79,5 @@
 	#	input fromViewCells
 	#	input fromSceneGeometry
-		samples 50000
+		samples 3000
 		sideTolerance 0.002
 	}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 329)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 330)
@@ -672,5 +672,5 @@
 
 	long startTime = GetTime();
-	cout << "**** Contructing tree using scene geometry ****\n";
+	cout << "**** Contructing bsp tree ****\n";
 
 	while (!tStack.empty()) 
@@ -831,5 +831,5 @@
 	// partition rays
 	interior->SplitRays(rays, frontRays, backRays);
-	Debug << "jdfjfj43" << endl;
+	
 	// split polygons with split plane
 	mStat.splits +=interior->SplitPolygons(polys, 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp	(revision 329)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp	(revision 330)
@@ -57,5 +57,4 @@
 	  }
 	
-	  Debug << "do2" << endl;
 	  p->BuildBspTree();
 	  p->Export("vc_bsptree.x3d", false, false, true);
@@ -64,5 +63,5 @@
 	  bool exportSplits = false;
 	  environment->GetBoolValue("BspTree.exportSplits", exportSplits);
-Debug << "do3" << endl;
+
 	  // export the bsp splits
 	  if (exportSplits)
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 329)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 330)
@@ -151,5 +151,5 @@
 	// cast ray to KD tree to find intersection with other objects
 	mKdTree->CastRay(ray);
-	cout << "k";
+	
 	if (mViewCellsType == BSP_VIEW_CELLS)
 	{
@@ -157,5 +157,4 @@
 		if (mBspTree)
 		{
-			cout << "uhhhhhhh year" << endl;
 			mBspTree->CastRay(ray);
 		
@@ -171,5 +170,4 @@
 	else
 	{
-		cout << "z" << endl;
 		if (ray.leaves.size()) {
 			sampleContributions += AddNodeSamples(object, ray);
@@ -308,5 +306,6 @@
 		cout << "totalSamples: "  << totalSamples;
 		for (i = 0; i < objects.size(); i++) {
-			printf("\nsampling object %d of %d, samples %d\n", i, (int)objects.size(), passSamples);
+			
+			Debug << "\nsampling object " << i << " of " << (int)objects.size() << " sample " << passSamples << endl;
 
 			KdNode *nodeToSample = NULL;
@@ -373,7 +372,9 @@
 			int sampleContributions;
 			
+			long startTime = GetTime();
+
 			if (viewcellSample) {
 				nodeToSample = mKdTree->GetRandomLeaf(Plane3(normal, point));
-				
+					
 				for (int k=0; k < mSamplesPerPass; k++) {
 					if (nodeToSample) {
@@ -396,7 +397,20 @@
 					// construct a ray
 					SetupRay(ray, point, direction);
-					 cout << "s";
+					
 					sampleContributions = CastRay(object, ray);
-					cout << "r";
+
+					// CORR matt: put inside loop
+					if ( i < pvsOut )
+						rays[i].push_back(ray);
+		
+					if (!ray.intersections.empty()) {
+						// check whether we can add this to the rays
+						for (int j = 0; j < pvsOut; j++) {
+							if (objects[j] == ray.intersections[0].mObject) {
+								rays[j].push_back(ray);
+							}
+						}
+					}
+
 					if (mViewCellsType == BSP_VIEW_CELLS) 
 					{
@@ -435,19 +449,8 @@
 				//				object->GetRandomVisibleMesh(Plane3(normal, point));
 			}
-		
-			// NOTE: should be inside loop
-			if ( i < pvsOut )
-				rays[i].push_back(ray);
-		
-			if (!ray.intersections.empty()) {
-					// check whether we can add this to the rays
-				for (int j = 0; j < pvsOut; j++) {
-					if (objects[j] == ray.intersections[0].mObject) {
-						rays[j].push_back(ray);
-					}
-				}
-			}
-		
-			passSamples++;
+			long t = TimeDiff(startTime, GetTime());
+			Debug << "pass time: " << t << endl;
+		
+			passSamples += mSamplesPerPass;
 		
 			if (sampleContributions) {
@@ -456,6 +459,7 @@
 			}
 		}
-		cout << "pass samples: " << passSamples << endl;
-		totalSamples += passSamples;
+	
+		// CORR matt: must add pass samples
+		totalSamples += passSamples; // totalSamples ++;
 		
 		//    if (pass>10)
@@ -588,4 +592,7 @@
 					if (!objects[j]->Mailed())
 					{
+						//if (j == 2198)m.mDiffuseColor = RgbColor(1, 0, 1);
+						//else m.mDiffuseColor = RgbColor(1, 1, 0);
+						exporter->SetForcedMaterial(m);
 						exporter->ExportIntersectable(objects[j]);
 						objects[j]->Mail();
