Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp	(revision 3285)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp	(revision 3286)
@@ -157,31 +157,15 @@
 	CreateIdSortedList2(bvh->GetStaticRoot(), nodes);
 	//CreateIdSortedList(bvh, nodes);
-/*	ofstream outstream("test.log");
-
-	BvhNode *f = ((BvhInterior *)bvh->GetStaticRoot())->GetFront();
-	BvhNode *b = ((BvhInterior *)bvh->GetStaticRoot())->GetBack();
-
-	outstream << "front: " << f->GetFirstEntity() << " " << f->GetLastEntity() << endl;
-	outstream << "back: " << b->GetFirstEntity() << " " << b->GetLastEntity() << endl;
-
-	for (size_t i = 0; i < nodes.size(); ++ i)
-	{
-		BvhNode *n = nodes[i];
-		//if (nodes[i]->GetId() >= nodes.size()) cout << "id " << nodes[i]->GetId() << endl;
-		if (n->IsVirtualLeaf())
-		{
-			int geometrySize;
-			AxisAlignedBox3 box;
-			SceneEntity **ent = bvh->GetGeometry(n, geometrySize);
-			box = SceneEntity::ComputeBoundingBox(ent, geometrySize);
-
-			outstream << n->GetFirstEntity() << " " << n->GetLastEntity() << " " << n->GetBox() << " " << box << endl;
-		}
-	}
-*/		
+
+	const int tenpercent = number / 10;
+	int j = 0;
+
 	for (int i = 0; i < number; ++ i) 
 	{
-		if ((i % number / 10) ==  (number / 10 - 1))
-			cout << 100 * (i + 1) / 100 << "percent loaded" << endl;
+		if ((i % tenpercent) == (tenpercent - 1))
+		{
+			j += 10;
+			cout << j << " percent of the view cells loaded" << endl;
+		}
 
 		fread(&entries, sizeof(int), 1, fw);
@@ -196,10 +180,7 @@
 	
 			BvhNode *node = nodes[objectId];
-			//if (i == 100) outstream << "t " << time << " ";
 			mViewCells[i]->mPvs.AddEntry(bvh, node, time);
 		}
 	}
-
-	//outstream.close();
 
 	return true;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3285)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3286)
@@ -157,4 +157,6 @@
 
 float shotRays = .0f;
+/// the visibility solution is initialized at this number of rays shot that 
+int visibilitySolutionInitialState = 0;
 
 
@@ -480,4 +482,5 @@
 		env.GetFloatParam(string("viewCellsScaleFactor"), viewCellsScaleFactor);
 		env.GetFloatParam(string("skyDomeScaleFactor"), skyDomeScaleFactor);
+		env.GetIntParam(string("visibilitySolutionInitialState"), visibilitySolutionInitialState);
 		
 		//env.GetStringParam(string("modelPath"), model_path);
@@ -1192,4 +1195,5 @@
 		if (!walkThroughPlayer->ReadNextFrame(camera)) 
 		{
+			cout << "reached end of walkthrough" << endl;
 			currentReplayFrame = -1;
 			replayPath = false;
@@ -1216,7 +1220,12 @@
 	{
 		if (!walkThroughRecorder)
+		{
 			walkThroughRecorder = new WalkThroughRecorder(walkThroughSuffix + ".log");
-		
-		if ((Distance(oldPos, camera->GetPosition()) > 1e-6f) ||
+		}
+
+		// question: check if player has moved more than a minimum distance?
+
+		if (0 || 
+			(Distance(oldPos, camera->GetPosition()) > 1e-6f) ||
 			(DotProd(oldDir, camera->GetDirection()) < 1.0f - 1e-6f))
 		{
@@ -1239,4 +1248,5 @@
 			LoadVisibilitySolution();
 			applicationTimer.Start();
+			shotRays = visibilitySolutionInitialState;
 		}
 
@@ -1824,5 +1834,5 @@
 			cout << "recording frames on replaying" << endl;
 		else
-			cout << "finished recording frames on replaying" << endl;
+			cout << "not recording frames on replaying" << endl;
 		break;
 	case GLUT_KEY_LEFT:
@@ -2375,5 +2385,6 @@
 		}
 
-		glColor3f(1.0f, 1.0f, 1.0f);
+		glColor3f(0.0f, 1.0f, 0.0f);
+
 		static char *alg_str[] = {
 			"Frustum Cull"
@@ -2384,5 +2395,4 @@
 		};
 	
-#if 0
 		if (!showAlgorithmTime)
 		{
@@ -2390,20 +2400,21 @@
 			{			
 				sprintf(msg[7], "%s:  %6.1f fps", alg_str[renderMode], fps);		
-				myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color);
+				myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f);
 			}
+
+			int mrays = (int)shotRays / 1000000;
+			sprintf(msg[7], "%s:  %04d M rays", alg_str[renderMode], mrays);	
+			myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 60.0f);
 		}
 		else
 		{
 			sprintf(msg[7], "%s:  %6.1f ms", alg_str[renderMode], rTime);
-			myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color);
-		}
-#else
-		int mrays = (int)shotRays / 1000000;
-		sprintf(msg[7], "%s:  %04d M rays", alg_str[renderMode], mrays);	
-		//myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color);
-		myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f);//, top_color, bottom_color);
-#endif
-	}
-
+			myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f);
+		}
+
+		glColor3f(1.0f, 1.0f, 1.0f);
+	}
+
+	glColor3f(1, 1, 1);
 	glDisable(GL_BLEND);
 	glDisable(GL_TEXTURE_2D);
@@ -2664,12 +2675,13 @@
 	viewCell = viewCellsTree->GetViewCell(camera->GetPosition());
 
-	// assume 60 FPS
-	const float raysPerMs = pvsTotalSamples / pvsTotalTime;
-	const float scale = renderTime * raysPerMs;
-
-	cout << "rays per sec: " << raysPerMs << endl;
-
-	//const float elapsedAlgorithmTime = applicationTimer.Elapsedms(false);
-	//int numTriangles = 0;
+	const float elapsedAlgorithmTime = applicationTimer.Elapsedms(false);
+
+	// assume 60 FPS, total time is in secs
+	const float raysPerMs = 2.0f * pvsTotalSamples / (pvsTotalTime * 1000.0f);
+	//shotRays = visibilitySolutionInitialState + elapsedAlgorithmTime * raysPerMs;
+	//shotRays += 1000 * raysPerMs / 60.0f;
+
+	//cout << "totalt: " << pvsTotalTime << endl;
+	//cout << "rays per ms: " << raysPerMs << endl;
 
 	SceneEntity::SetCurrentVisibleId(globalVisibleId);
@@ -2679,15 +2691,11 @@
 		PvsEntry entry = viewCell->mPvs.GetEntry(i);
 #ifdef USE_TIMESTAMPS
-		if ((entry.mTimeStamp < 0.0f) || (entry.mTimeStamp <= shotRays))
-#else
-		if (1)
+		if (!((entry.mTimeStamp < 0.0f) || (entry.mTimeStamp <= shotRays)))
+			continue;
 #endif
-		{
-			entry.mEntity->SetVisibleId(globalVisibleId);
-			//numTriangles += entry.mEntity->CountNumTriangles();
-		}
-	}
-
-	shotRays += scale;
+		entry.mEntity->SetVisibleId(globalVisibleId);
+		//numTriangles += entry.mEntity->CountNumTriangles();
+	}
+
 	++ globalVisibleId;
 }
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3285)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3286)
@@ -21,8 +21,11 @@
 shadowSize=4096
 # the filenames given to recorded frames (+ number.bmp)
-recordedFramesSuffix=frames/vienna_frame
+#recordedFramesSuffix=frames/vienna_frame
+recordedFramesSuffix=frames_100_pgv/vienna_frame
+#recordedFramesSuffix=frames_50_spgvu/vienna_frame
 # the filename for the statistics
 statsFilename=mystats
-walkThroughSuffix=walkthrough_pp_1
+#walkThroughSuffix=walkthrough_pp_1
+walkThroughSuffix=walkthrough_vienna
 #walkThroughSuffix=path_pp
 
@@ -30,5 +33,5 @@
 usePvs=0
 
-# if using pvs, this specifies the name of the visibility solutin
+# if using pvs, this specifies the name of the visibility solution
 #visibilitySolution=vienna_full-8x3-pgv
 #visibilitySolution=vienna_full-8x3-spgvu
@@ -37,4 +40,6 @@
 #visibilitySolution=mypompeii-2x1-obvh-pgv
 visibilitySolution=myvienna-3x1-obvh-pgv
+#visibilitySolution=myvienna-3x1-obvh-refu
+#visibilitySolution=myvienna-3x1-obvh-spgvu
 
 viewCellsScaleFactor=1.0f
@@ -42,4 +47,7 @@
 
 skyDomeScaleFactor=80.0f
+
+#visibilitySolutionInitialState=50000000
+visibilitySolutionInitialState=100000000
 
 
@@ -61,7 +69,8 @@
 # move speed
 #keyForwardMotion=5.0f
-#keyRotation=0.5f
+keyRotation=0.5f
 keyForwardMotion=20.0f
-keyRotation=1.5f
+#keyRotation=1.5f
+keyForwardMotion=30.0f
 
 # initial camera position
@@ -81,5 +90,9 @@
 #lightDirection=-0.8f 1.0f -0.7f
 #lightDirection=-0.3f 0.2f -0.7f
-lightDirection=-0.14002 0.812842 -0.565404
+#lightDirection=-0.14002 0.812842 -0.565404
+#lightDirection=-0.77596 -0.614785 -0.141158
+#lightDirection=-0.785914 -0.583277 -0.20525
+lightDirection=0.509293 0.784034 -0.35484
+
 
 #####################
@@ -153,2 +166,7 @@
 #useSkylightForIllum=1
 #skyDomeScaleFactor=1000.0f
+
+
+camPosition=1145.31 413.602 186.678
+camDirection=-0.917729 -0.397207 -0
+lightDirection=0.509293 0.784034 -0.35484
