Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna	(revision 2706)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna	(revision 2709)
@@ -5,11 +5,11 @@
 
 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+"
-COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000 -view_cells_import_random_viewcells+"
+COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=300000000 -view_cells_import_random_viewcells+"
 
 
 #SCENE=../data/vienna/vienna_cropped.obj
 #SCENE=../data/vienna/city_full.obj
-#SCENE=../data/vienna/city_full_hp.obj
-SCENE=../data/vienna/vienna_rep.obj
+SCENE=../data/vienna/city_full_hp.obj
+#SCENE=../data/vienna/vienna_rep.obj
 
 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz
@@ -31,8 +31,20 @@
 #DISTRIBUTIONS=spatial
 
-$COMMAND -preprocessor=combined \
+# $COMMAND -preprocessor=combined \
+# -scene_filename=$SCENE \
+# -view_cells_filename=$VIEWCELLS \
+# -rss_distributions=$DISTRIBUTIONS \
+# -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \
+# -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \
+# -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \
+# -preprocessor_detect_empty_viewspace+ \
+# -preprocessor_use_vbos- \
+# -preprocessor_ray_cast_method=1 \
+# -view_cells_random_viewpoint_list=$VIEWPOINTS \
+# demo1.env
+
+$COMMAND -preprocessor=sampling \
 -scene_filename=$SCENE \
 -view_cells_filename=$VIEWCELLS \
--rss_distributions=$DISTRIBUTIONS \
 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \
 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \
@@ -40,6 +52,8 @@
 -preprocessor_detect_empty_viewspace+ \
 -preprocessor_use_vbos- \
--preprocessor_ray_cast_method=3 \
+-preprocessor_ray_cast_method=1 \
 -view_cells_random_viewpoint_list=$VIEWPOINTS \
 demo1.env
 
+
+
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h	(revision 2702)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h	(revision 2709)
@@ -76,4 +76,7 @@
 	virtual void UpdateBox();
 
+	bool HasChanged() { return mHasChanged; }
+
+	void SetHasChanged(bool hasChanged) {mHasChanged = hasChanged;}
 	SceneGraphLeafIntersectable *GetIntersectable() { return mIntersectable; }
 
@@ -85,5 +88,4 @@
 	ObjectContainer mGeometry;
 
-
 protected:
 
@@ -91,4 +93,6 @@
 
 	bool mIsDynamic;
+	bool mHasChanged;
+
 	Matrix4x4 mTrafo;
 };
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp	(revision 2702)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp	(revision 2709)
@@ -278,5 +278,5 @@
 
 
-SceneGraphLeaf::SceneGraphLeaf(): mIsDynamic(false)
+SceneGraphLeaf::SceneGraphLeaf(): mIsDynamic(false), mHasChanged(true)
 {
 	mTrafo = IdentityMatrix();
@@ -286,5 +286,5 @@
 
 
-SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): mIsDynamic(isDynamic)
+SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): mIsDynamic(isDynamic), mHasChanged(true)
 {
     mTrafo = IdentityMatrix();
@@ -294,4 +294,5 @@
 void SceneGraphLeaf::ApplyTransform(const Matrix4x4 &trafo)
 {
+	mHasChanged = true;
 	mTrafo = trafo * mTrafo;
 }
@@ -300,4 +301,5 @@
 void SceneGraphLeaf::LoadTransform(const Matrix4x4 &m)
 {
+	mHasChanged = true;
 	mTrafo = m;
 }
@@ -334,5 +336,6 @@
 	mTrafo = copy.mTrafo;
 	mIsDynamic = copy.mIsDynamic;
-}
-
-}
+	mHasChanged = true;
+}
+
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2708)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2709)
@@ -58,5 +58,6 @@
 mGlobalLinesRenderer(NULL),
 mUseHwGlobalLines(false),
-mTotalRaysCast(0)
+mTotalRaysCast(0),
+mSynchronize(false)
 {
 	Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer);
@@ -665,5 +666,5 @@
 		// load scene objects which are the entities used as pvs entries
 		ObjectContainer pvsObjects;
-		if (0) LoadObjects(buf, pvsObjects, mObjects);
+		if (1) LoadObjects(buf, pvsObjects, mObjects);
 
 		const bool finalizeViewCells = true;
@@ -746,5 +747,4 @@
 
 	mViewCellsManager->SetRenderer(mRenderSimulator);
-	
 	mViewCellsManager->SetPreprocessor(this);
 
@@ -838,6 +838,5 @@
 	
     Vector3 origin, termination;
-	// HACK: needed only for lower_bound algorithm to find the 
-	// intersected objects
+	// HACK: needed only for lower_bound algorithm to find the intersected objects
 	MeshInstance sObj(NULL);
 	MeshInstance tObj(NULL);
@@ -1452,6 +1451,5 @@
 Preprocessor::ComputeRenderError()
 {
-  // compute rendering error
-	
+  // compute rendering error	
   if (renderer && renderer->mPvsStatFrames) {
 	
@@ -1596,9 +1594,15 @@
 	mDynamicObjects.push_back(leaf);
 
-	// add to scene graph
-	mSceneGraph->GetRoot()->mChildren.push_back(leaf);
-
-	if (mRayCaster)
-		mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation());
+	// tell ray caster to update
+	ScheduleUpdateDynamicObjects();
+
+	if (0) 
+	{
+		// add to scene graph
+		mSceneGraph->GetRoot()->mChildren.push_back(leaf);
+		// add to ray caster
+		if (mRayCaster)
+			mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation());
+	}
 	// $$ JB in order to compile
 	//return leaf;
@@ -1646,4 +1650,25 @@
 
 		leaf->UpdateBox();
+
+		float offs = -leaf->GetOriginalBox().Min().y;
+
+		// scale so pivot is always on bottom
+		for (it = leaf->mGeometry.begin(); it != it_end; ++ it)
+		{
+			TriangleIntersectable *tri = static_cast<TriangleIntersectable *>(*it);
+
+			Triangle3 t = tri->GetItem();
+
+			// hack: scale object appropriately
+			t.mVertices[0].y += offs;
+			t.mVertices[1].y += offs;
+			t.mVertices[2].y += offs;
+
+			tri->SetItem(t);
+		}
+
+		leaf->UpdateBox();
+
+
 		cout<<"Dynamic object loaded successfully: " << leaf->GetBox() << endl;
 
@@ -1709,4 +1734,10 @@
 
 
+void Preprocessor::ObjectRemoved(SceneGraphLeaf *leaf)
+{
+	ObjectMoved(leaf);
+}
+
+
 void Preprocessor::UpdateDynamicObjects()
 {
@@ -1716,21 +1747,20 @@
 		preprocessor->mRayCaster->DeleteDynamicObjects();
 	
-		for (size_t i=0; i < mDynamicObjects.size(); ++ i) 
+		for (size_t i = 0; i < mDynamicObjects.size(); ++ i) 
 		{
 			SceneGraphLeaf *l = mDynamicObjects[i];
-		  
-			cout<<"Updating dynamic objects in ray caster..."<<endl;
-		  
-			mRayCaster->AddDynamicObjecs(l->mGeometry, l->GetTransformation());
-			
-			cout<<"done."<<endl;
-			
-			cerr<<"Updating affected PVSs..."<<endl;
-			preprocessor->ObjectMoved(l);
-			cerr<<"done."<<endl;	  
+
+			UpdateObjectInRayCaster(l);
+
+			if (l->HasChanged())
+			{
+				cout<<"Updating affected PVSs..."<<endl;
+				preprocessor->ObjectMoved(l);
+				cout<<"done."<<endl;	
+				l->SetHasChanged(false);
+			}
 		}
         
 		mUpdateDynamicObjects = false;
-	
 	}
 }
@@ -1739,7 +1769,15 @@
 void Preprocessor::ScheduleUpdateDynamicObjects()
 {
-		mUpdateDynamicObjects = true;
-}
-
-
-}
+	mUpdateDynamicObjects = true;
+}
+
+
+void Preprocessor::UpdateObjectInRayCaster(SceneGraphLeaf *l)
+{
+	cout<<"Updating dynamic objects in ray caster..."<<endl;
+
+	mRayCaster->AddDynamicObjecs(l->mGeometry, l->GetTransformation());
+	cout<<"done."<<endl;
+}
+
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp	(revision 2707)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp	(revision 2709)
@@ -50,10 +50,13 @@
 QtGlDebuggerWidget *debuggerWidget = NULL;
 
-const static int SAMPLES_INCR = 2000000;
 
 
 static SimpleRayContainer sViewPointsList;
 static SimpleRayContainer::const_iterator sViewPointsListIt;
-
+static int sCurrentSamples = 0;
+static int sNextSamplesThreshold[] = {10000000, 50000000, 100000000, 250000000};
+//static int sNextSamplesThreshold[] = {100000000, 200000000};
+static int sNumReplays = 4;
+static int sCurrentSamplesThreshold = 0;
 
 
@@ -125,9 +128,11 @@
 									   KdTree *tree):
 QGLPixelBuffer(QSize(w, h), 
-			   QGLFormat(QGL::StencilBuffer | 
+			   QGLFormat(QGL::SampleBuffers)
+			   /*,|
+						 QGL::StencilBuffer | 
 						 QGL::DepthBuffer | 
 						 QGL::DoubleBuffer |
 						 QGL::Rgba)
-						 ),
+						 */),
 GlRendererBuffer(sceneGraph, viewcells, tree)
 {
@@ -190,5 +195,5 @@
 
 // reimplemented here so that we can snap the error windows
-float QtGlRendererBuffer::GetPixelError(int &pvsSize)
+float QtGlRendererBuffer::GetPixelError(int &pvsSize, int pass)
 {
 	MakeLive();
@@ -237,12 +242,28 @@
 
 	// use shading
-	if (mSnapErrorFrames)
-	{
+	if (1)//mSnapErrorFrames)
+	{
+		glEnable(GL_NORMALIZE);
+
+		// mat_specular and mat_shininess are NOT default values
+	GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f};
+	GLfloat mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
+	GLfloat mat_specular[] = {0.3f, 0.3f, 0.3f, 1.0f};
+	GLfloat mat_shininess[] = {1.0f};
+
+	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
+	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
+	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
+	glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
+
 		GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0};
+		//GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0};
 		GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0};
 		GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0};
 
+		glEnable(GL_LIGHTING);
 		//GLfloat light_position[] =  {278.0f, 548.8f,279.0f, 1.0f};
-		GLfloat light_position[] =  {0.f,0.f,0.f, 1.0f};
+		//GLfloat light_position[] =  {0.f, 0.f, 0.f, 1.0f};
+		GLfloat light_position[] =  {0.f, 0.0f, 0.f, 1.0f};
 
 		glEnable(GL_LIGHT0); 
@@ -252,21 +273,22 @@
 		glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
 		glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
-
-		glEnable(GL_LIGHTING);
 		glLightfv (GL_LIGHT0, GL_POSITION, light_position);
 
 		glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
-		glEnable(GL_COLOR_MATERIAL);
+		//glEnable(GL_COLOR_MATERIAL);
+
+		GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f};
+		glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
 
 		glShadeModel(GL_SMOOTH);
 	}
 
-	glDisable(GL_ALPHA_TEST);
+	//glDisable(GL_ALPHA_TEST);
 		
 	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 
-	//glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE);
-	glColor3f(0, 1, 0);
+	glColor3f(0.6f, 0.6f, 0.6f);
+	//glColor3f(0, 1, 0);
 
 	glDepthFunc(GL_LESS);
@@ -274,4 +296,7 @@
 	glEnable(GL_DEPTH_TEST);
 
+	glFrontFace(GL_CCW);
+	glCullFace(GL_BACK);
+
 	glStencilFunc(GL_EQUAL, 0x0, 0x1);
 	glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 
@@ -301,4 +326,5 @@
 	query->BeginQuery();
 
+	// current frame has to be increased at each rendering pass
 	++ mCurrentFrame;
 
@@ -317,9 +343,11 @@
 
 	// some error happened
-	if (pixelCount > pixelThres) 
+	if (1) // pixelCount > pixelThres) 
 	{
 		cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize 
 			 << " e " << pixelCount << " vp " << mViewPoint << " vd " << mViewDirection << endl;
 	
+		format().setSampleBuffers(true);
+		cout << "here3 " << format().sampleBuffers() << endl;
 		if (mSnapErrorFrames) 
 		{
@@ -327,16 +355,19 @@
 			//glReadBuffer(GL_FRONT);
 
-
 			//////////////
 			//-- output error visualization
 
 			char filename[256];
-			//sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels);
-			sprintf(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount);
+			sprintf(filename, "error-frame-%04d-%05d.bmp", pass, mFrame);
+			//sprintf(filename, "error-frame-%05d-%0.5f.png", mFrame, pErrorPixels);
+			//sprintf_s(filename, "error-frame-%05d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount);
+
 			QImage im = toImage();
 			string str = mSnapPrefix + filename;
 			QString qstr(str.c_str());
 
-			im.save(qstr, "PNG");
+			//im.save(qstr, "PNG");
+			// use bmp for lossless storage (for video)
+			im.save(qstr, "BMP");
 
 			if (0)
@@ -367,5 +398,5 @@
 
 				im = toImage();
-				sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount);
+				sprintf_s(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount);
 				str = mSnapPrefix + filename;
 				qstr = str.c_str();
@@ -433,38 +464,16 @@
 	//glEnable(GL_FOG);
 	//glFogi(GL_FOG_MODE, GL_EXP);
+	//glFogf(GL_FOG_DENSITY, .2f);
 	glFogi(GL_FOG_MODE, GL_LINEAR);
-
-//	glFogf(GL_FOG_DENSITY, .2f);
 	glFogf(GL_FOG_START, 50.f);
 	glFogf(GL_FOG_END, 500.f);
 
-	GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0};
-    GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0};
-    GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0};
-    GLfloat light_position[] =  //{278.0f, 548.8f,279.0f, 1.0f };
-    { 0.f,0.f,0.f,1.0f };
-
-    /*glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
-    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
-    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
-*/
-    glEnable(GL_LIGHT0); 
-
+	
+	// mat_specular and mat_shininess are NOT default values
 	GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f};
-	
-	// mat_specular and mat_shininess are NOT default values
 	GLfloat mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
 	GLfloat mat_specular[] = {0.3f, 0.3f, 0.3f, 1.0f};
 	GLfloat mat_shininess[] = {1.0f};
 
-/*	GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};
-	GLfloat light_diffuse[] = {0.4f, 0.4f, 0.4f, 1.0f};
-	GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f};
-
-	GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f};
-*/
-
-	// default Material
 	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
 	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
@@ -472,31 +481,38 @@
 	glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
 
-	// a light
+
+	glEnable(GL_LIGHTING);
+
+	// a light	
+	GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0};
+    GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0};
+    GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0};
+    GLfloat light_position[] =  {0.f, .0f, 0.f, 1.0f};
+    //GLfloat light_position[] =  {600.0f, 250.0f, -500.f, 1.0f};
+    //GLfloat light_position[] = {278.0f, 548.8f,279.0f, 1.0f};
+
 	glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
 	glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
 	glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
 
-	/*glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);
+	glLightfv(GL_LIGHT0, GL_POSITION, light_position);
+
+	//glDisable(GL_LIGHT0);
+	glEnable(GL_LIGHT0);
+
+	glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);
 	glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse);
 	glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular);
-*/
-	//glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
-
-	glEnable(GL_LIGHTING);
-	glEnable(GL_LIGHT0);
-//	glEnable(GL_LIGHT1);
-
-	// set position of the light
-	/*GLfloat infinite_light[] = {  1.0, 0.8, 1.0, 0.0  };
-	glLightfv (GL_LIGHT0, GL_POSITION, infinite_light);
-
+		
 	// set position of the light2
 	GLfloat infinite_light2[] = {  -0.3, 1.5, 1.0, 0.0  };
 	glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2);
-*/
-	glLightfv (GL_LIGHT0, GL_POSITION, light_position);
-
-	glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
-	// glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR);
+	//glEnable(GL_LIGHT1);
+
+	GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f};
+	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+
+	glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+	//glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
 	glEnable(GL_COLOR_MATERIAL);
 
@@ -568,13 +584,16 @@
 	dit, dit_end = p->mDynamicObjects.end();
 
-	for (dit = p->mDynamicObjects.begin(); dit != dit_end; ++ dit)
-	{
-		glColor3f(0, 1, 0);
+	int i = 0;
+	for (dit = p->mDynamicObjects.begin(); dit != dit_end; ++ dit, ++ i)
+	{
+		if (i == mCurrentDynamicObjectIdx)
+			glColor3f(1, 0, 1);
+		else
+			glColor3f(0, 1, 0);
+
 		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 		_RenderDynamicObject(*dit);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 	}
-
-	//_RenderDynamicObject(mPendingDynamicObject);
 }
 
@@ -692,6 +711,4 @@
 			mWireFrame = false;
 		}
-		
-		//mCurrentPvsCost = viewcell->GetPvs().EvalPvsCost();
 	} 
 	else 
@@ -722,5 +739,4 @@
 
 	glEnable(GL_STENCIL_TEST); 
-
 	glDisable(GL_LIGHTING);
 
@@ -770,4 +786,5 @@
 			cout << "stopping replay" << endl;
 			mReplayMode = false;
+			GetPreprocessor()->mSynchronize = false;
 		}
 		else
@@ -781,10 +798,38 @@
 		}
 
-
 		updateGL();
-	}
-
-	if (timerEvent->timerId() == mUpdateTimerId)
+
+		// output the current frame buffer
+		if (mExportFrameBuffer)
+		{
+			const int dist = sViewPointsListIt - sViewPointsList.begin();
+
+			char filename[200];
+			sprintf(filename, "error-frame-%04d-%05d.bmp", sCurrentSamples, dist);
+			//QPixmap img = renderPixmap(0, 0, true);
+			QImage im = grabFrameBuffer();
+
+			string str = mSnapPrefix + filename;
+			QString qstr(str.c_str());
+
+			//im.save(qstr, "PNG");
+			// use bmp for lossless storage (for video)
+			im.save(qstr, "BMP");
+		}
+	}
+	else if (timerEvent->timerId() == mUpdateTimerId)
+		// update pvss from time to time
 		update();
+
+	// grab frame buffer after a certain number of samples
+	if (!mReplayMode && 
+		(sCurrentSamplesThreshold < sNumReplays) && 
+		((GetPreprocessor()->mCurrentSamples > sNextSamplesThreshold[sCurrentSamplesThreshold])))
+	{
+		++ sCurrentSamplesThreshold;
+		cout << "replaying at total samples: " << GetPreprocessor()->mCurrentSamples << endl;
+		ReplayViewPoints();
+	}
+
 }
 
@@ -803,5 +848,4 @@
 		{
 			Vector3 pt = Unproject(x, y);
-			cout << "unproject: " << pt << endl;
 
 			mPlacer->PlaceObject(pt);
@@ -813,6 +857,9 @@
 			SceneGraphLeaf *newObj = new SceneGraphLeaf(*leaf);
 
-			mViewCellsManager->GetPreprocessor()->RegisterDynamicObject(newObj);
-			//mPendingDynamicObjects.push_back();
+			// make current object
+			// the object is added at the end of the vector
+			mCurrentDynamicObjectIdx = (int)GetPreprocessor()->mDynamicObjects.size();
+
+			GetPreprocessor()->RegisterDynamicObject(newObj);
 		}
 	}
@@ -828,5 +875,5 @@
 	mousePoint.y = y;
 
-	if (e->modifiers() & Qt::AltModifier) 
+	if (e->modifiers() & Qt::ShiftModifier) 
 	{
 		const Vector3 pt = Unproject(x, y);
@@ -834,9 +881,8 @@
 		int idx = FindDynamicObject(x, y);
 		
-		Preprocessor *p = GetPreprocessor();
-
-		swap(p->mDynamicObjects[idx], p->mDynamicObjects.back());
-		p->mDynamicObjects.pop_back();
-		//preprocessor->ScheduleUpdateDynamicObjects();
+		if (idx >= 0)
+		{
+			mCurrentDynamicObjectIdx = idx;
+		}
 	}
 }
@@ -865,5 +911,4 @@
 		mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY / 2.0;
 	}
-#if 0// DYNAMIC_OBJECTS_HACK
 	else if (e->modifiers() & Qt::AltModifier)
 	{
@@ -896,6 +941,6 @@
 			case 2:
 				{
-				  // tm = RotationXMatrix(diffx) * RotationYMatrix(diffy);
-				  tm = RotationYMatrix(diffx);
+					// tm = RotationXMatrix(diffx) * RotationYMatrix(diffy);
+					tm = RotationYMatrix(diffx);
 				}
 				break;
@@ -911,5 +956,4 @@
 		}
 	}
-#endif
 	else
 	{
@@ -1043,5 +1087,5 @@
 			break;
 
-		if (sscanf(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) {
+		if (sscanf_s(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) {
 			text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z);
 			text = QInputDialog::getText(this,
@@ -1053,5 +1097,5 @@
 			if (!ok)
 				break;
-			if (sscanf(text.toAscii(), "%f %f %f", &mViewDirection.x,
+			if (sscanf_s(text.toAscii(), "%f %f %f", &mViewDirection.x,
 				&mViewDirection.y, &mViewDirection.z) == 3) {
 					updateGL();
@@ -1075,8 +1119,7 @@
 									   QWidget * parent,
 									   const QGLWidget * shareWidget,
-									   Qt::WFlags f
-									   )
-									   :
-GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget, f)
+									   Qt::WFlags f):
+GlRendererWidget(sceneGraph, viewcells, tree), 
+QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget, f)
 {
 	mPreprocessorThread = NULL;
@@ -1139,5 +1182,8 @@
 	mPlacer = new ObjectPlacer();
 
-	//mPendingDynamicObject = NULL;
+	mCurrentDynamicObjectIdx = -1;
+
+	//mExportFrameBuffer = true;
+	mExportFrameBuffer = false;
 
 	SetSceneCut(1000);
@@ -1200,5 +1246,5 @@
 	connect(mControlWidget,	SIGNAL(SetShowRays(bool)), this, SLOT(SetShowRays(bool)));
 
-#if 0
+#if 1
 	connect(mControlWidget, SIGNAL(SetTranslation(bool)), this, SLOT(SetTranslation(bool)));
 	connect(mControlWidget, SIGNAL(SetRotation(bool)), this, SLOT(SetRotation(bool)));
@@ -1206,10 +1252,11 @@
 #endif
 	connect(mControlWidget, SIGNAL(UpdateDynamicObjects()), this, SLOT(UpdateDynamicObjects()));
+	connect(mControlWidget, SIGNAL(DeleteDynamicObject()), this, SLOT(DeleteDynamicObject()));
 
 	setWindowTitle("PVS Visualization");
 
 	// setting the main window size here
-	resize(800, 600);
-	//resize(640, 400);
+	//resize(800, 600);
+	resize(640, 480);
 	
 	mControlWidget->show();
@@ -1428,7 +1475,5 @@
 		filter = mViewCellsManager->GetMaxFilterSize();
 
-	glColor3f(0.0f, 0.0f, 1.0f);
-
-#if REMOVE_TEMPORARY
+#if 0 //REMOVE_TEMPORARY
 	s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f)",
 		mFrame,
@@ -1447,10 +1492,13 @@
 		filter,
 		mPvsSize,
-		mRenderError*100.0f);
+		mRenderError * 100.0f);
 
 	renderText(20, 40, s);
 #endif
 
-	QFont font40; font40.setPointSize(30);
+	glDisable(GL_LIGHTING);
+	//qglColor(QColor(0, 255, 0));
+	glColor3f(0, 1, 0);
+	QFont font40; font40.setPointSize(25);
 	//s.sprintf("PVS: %04d", mPvsSize);
 	//renderText(20, 40, s, font40);
@@ -1461,7 +1509,12 @@
 	//renderText(290, 70, s, font40);
 
-	s.sprintf("PVS TRI: %07d", (int)mCurrentPvsCost);
-	renderText(290, 70, s, font40);
+	s.sprintf("PVS TRI: %08d", (int)mCurrentPvsCost);
 	//renderText(290, 70, s, font40);
+	renderText(325, 40, s, font40);
+	s.sprintf("error: %3.3f %", mRenderError * 100.0f);
+	renderText(20, 40, s, font40);
+
+	//renderText(290, 70, s, font40);
+	glEnable(GL_LIGHTING);
 
 }
@@ -1809,5 +1862,6 @@
 			importance = rcCost / maxRcCost;
 		}
-if (importance > 1.0f) importance = 1.0f;
+		
+		if (importance > 1.0f) importance = 1.0f;
 		// c = RgbColor(importance, 1.0f - importance, 0.0f);
 		c = RainbowColorMapping(importance);
@@ -1962,4 +2016,7 @@
 	connect(button, SIGNAL(clicked()), SIGNAL(UpdateDynamicObjects()));
 	
+	button = new QPushButton("Delete", groupBox);
+	vbox2->addWidget(button);
+	connect(button, SIGNAL(clicked()), SIGNAL(DeleteDynamicObject()));
 	
 	groupBox->setLayout(vbox2);
@@ -2538,8 +2595,6 @@
 	// set up the pbuffer context
 	mRenderBuffer->makeCurrent();
-	
 	// generate a texture that has the same size/format as the pbuffer
 	dynamicTexture = mRenderBuffer->generateDynamicTexture();
-
 	// bind the dynamic texture to the pbuffer - this is a no-op under X11
 	mRenderBuffer->bindToDynamicTexture(dynamicTexture);
@@ -2627,6 +2682,11 @@
 	{
 		cout << "replaying " << (int)sViewPointsList.size() << " view points " << endl;
-
+		
 		mReplayMode = true;
+		
+		if (mExportFrameBuffer)
+			GetPreprocessor()->mSynchronize = true;
+
+		sCurrentSamples = GetPreprocessor()->mCurrentSamples;
 		sViewPointsListIt = sViewPointsList.begin();
 	}
@@ -2662,7 +2722,9 @@
 int QtGlRendererWidget::FindDynamicObject(float x, float y) 
 { 
+
+	if (GetPreprocessor()->mDynamicObjects.empty())
+		return -1;
+
 	makeCurrent();
-	// we need to lock the rendering context 
-	//glw.lockGLContext(); 
 	
 	// this is the same as in every OpenGL picking example 
@@ -2715,18 +2777,14 @@
 	glPopMatrix();
 
-	int hits;
+	int hits = glRenderMode(GL_RENDER);
+
 	// finally release the rendering context again 
-	if ((hits = glRenderMode(GL_RENDER)) < 0) 
+	if (!hits) 
 	{ 
 		cout << "no object picked" << endl;
-		//glw.unlockGLContext(); 
 		return -1; 
 	} 
 
-
 	//processHits(hits, buffer);
-
-	
-	//glw.unlockGLContext(); 
 	
 	// Each hit takes 4 items in the buffer. 
@@ -2743,3 +2801,26 @@
 
 
-}
+void QtGlRendererWidget::DeleteDynamicObject()
+{
+	Preprocessor *p = GetPreprocessor();
+
+	if ((mCurrentDynamicObjectIdx < 0) ||
+		(mCurrentDynamicObjectIdx >= p->mDynamicObjects.size()))
+		return;
+
+	cout << "deleting object" << endl;
+
+	SceneGraphLeaf *l = p->mDynamicObjects[mCurrentDynamicObjectIdx];
+
+	// tell the preprocessor that an object was deleted
+	p->ObjectRemoved(l);
+
+	swap(p->mDynamicObjects[mCurrentDynamicObjectIdx], p->mDynamicObjects.back());
+	p->mDynamicObjects.pop_back();
+
+	delete l;
+
+	mCurrentDynamicObjectIdx = -1;
+}	
+
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h	(revision 2704)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h	(revision 2709)
@@ -72,5 +72,5 @@
 	void RenderPvs(const ObjectPvs &pvs);
 
-	float GetPixelError(int &pvsSize);
+	float GetPixelError(int &pvsSize, int pass);
 
 	int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
@@ -114,4 +114,5 @@
   void ReplayViewPoints();
   void UpdateDynamicObjects();
+  void DeleteDynamicObject();
   void ComputeVisibility();
   void StopComputation();
@@ -246,5 +247,8 @@
 	ObjectPlacer *mPlacer;
 
-	//DynamicObjectsContainer mPendingDynamicObjects;
+	int mCurrentDynamicObjectIdx;
+
+	bool mExportFrameBuffer;
+
 	DynamicObjectsContainer mDynamicPvsObjects;
 
@@ -334,4 +338,5 @@
 	void ReplayViewPoints();
 	void UpdateDynamicObjects();
+	void DeleteDynamicObject();
 	void UpdateAllPvs();
 	void ComputeVisibility();
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp	(revision 2705)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp	(revision 2709)
@@ -52,5 +52,4 @@
 	// set viewer size here
 	return QSize(512, 320);
-
 	//return QSize(512, 384);
 	//return QSize(640, 480);
@@ -68,5 +67,5 @@
 
 	GLfloat light_ambient[]  = {0.2f, 0.2f, 0.2f, 1.0f};
-	GLfloat light_diffuse[]  = {0.4f, 0.4f, 0.4f, 1.0f};
+	GLfloat light_diffuse[]  = {0.6f, 0.6f, 0.6f, 1.0f};
 	GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f};
 
@@ -82,10 +81,4 @@
 	glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2);
 
-	// default material
-	/*glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
-	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
-	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
-	glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
-*/
 	// a light
 	glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 2702)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 2709)
@@ -200,7 +200,17 @@
 	void RegisterDynamicObject(SceneGraphLeaf *leaf);
 	
+	void UpdateObjectInRayCaster(SceneGraphLeaf *l);
+	
+	void ScheduleUpdateDynamicObjects();
+	void UpdateDynamicObjects();
+	/** Notify the preprocessor that an object has been deleted
+	*/
+	virtual void ObjectRemoved(SceneGraphLeaf *object);
+
 
 
 	/////////////////////////
+
+	bool mSynchronize;
 
 	/// scene graph loaded from file
@@ -277,13 +287,11 @@
 	RayCaster *mRayCaster;
 
-	int mGenericStats[2];
-
-	void ScheduleUpdateDynamicObjects();
-	void UpdateDynamicObjects();
-
-	/// triangle pvs for gvs 
+	// triangle pvs for gvs 
 	// hack: should be in gvspreprocessor but pulled 
 	// out here for visualization purpose
 	ObjectContainer mTrianglePvs;
+
+	// generic stats vector that can be used for anything
+	int mGenericStats[2];
 
 	//std::vector<int> mDummyBuffer;
@@ -309,5 +317,5 @@
 	*/
 	virtual void ObjectMoved(SceneGraphLeaf *object);
-
+	
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 2666)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 2709)
@@ -12,5 +12,5 @@
 #include "SamplingStrategy.h"
 #include "RayCaster.h"
-
+#include <windows.h>
 
 
@@ -94,5 +94,10 @@
   while (samples < mTotalSamples) {
 	for (int i=0; i < mSamplesPerPass;) {
-	  
+	   while (mSynchronize)
+	   {
+		   // hack: sleep during walthrough computation
+		   Sleep(1000);
+	   }
+
 	  mRayCaster->InitPass();
 	  
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GtpVisibility05.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GtpVisibility05.vcproj	(revision 2705)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GtpVisibility05.vcproj	(revision 2709)
@@ -898,4 +898,8 @@
 				</File>
 				<File
+					RelativePath=".\SepPlanesBox3.h"
+					>
+				</File>
+				<File
 					RelativePath=".\SimpleRay.h"
 					>
@@ -1081,4 +1085,8 @@
 				<File
 					RelativePath=".\SceneGraph.cpp"
+					>
+				</File>
+				<File
+					RelativePath=".\SepPlanesBox3.cpp"
 					>
 				</File>
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2706)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2709)
@@ -447,7 +447,5 @@
 
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
 	glEnable(GL_NORMALIZE);
-
 	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 
@@ -916,5 +914,5 @@
 		{
 			char filename[256];
-			sprintf(filename, "snap/frame-%04d-%d.png", mFrame, i);
+			sprintf_s(filename, "snap/frame-%04d-%d.png", mFrame, i);
 			//		  QImage im = toImage();
 			//		  im.save(filename, "PNG");
@@ -923,11 +921,7 @@
 		// evaluate the sample
 		if (useOcclusionQueries) 
-		{
 			EvalQueryWithOcclusionQueries();
-		}
 		else 
-		{
 			EvalQueryWithItemBuffer();
-		}
 	}  
 
@@ -1452,5 +1446,5 @@
 	for (int i = 0; i < depthMapSize * depthMapSize; ++ i)
 	{
-		//todo glGetTexImage()
+		// TODO (use glGetTexImage())
 	}
 }
@@ -1506,5 +1500,5 @@
 			int pvsSize;
 
-			mPvsErrorBuffer[i].mError = GetPixelError(pvsSize);
+			mPvsErrorBuffer[i].mError = GetPixelError(pvsSize, 0);
 			mPvsErrorBuffer[i].mPvsSize = pvsSize;
 
@@ -1566,4 +1560,5 @@
 {
 	mPvsStat.Reset();
+	++ mPvsStat.pass;
 
 	SetupProjection(GetWidth(), GetHeight());
@@ -1591,5 +1586,5 @@
 		{
 			// compute the pixel error
-			mPvsErrorBuffer[i].mError = GetPixelError(pvsSize);
+			mPvsErrorBuffer[i].mError = GetPixelError(pvsSize, mPvsStat.pass);
 			mPvsErrorBuffer[i].mPvsSize = pvsSize;
 
@@ -1700,5 +1695,5 @@
 
 
-float GlRenderer::GetPixelError(int &pvsSize)
+float GlRenderer::GetPixelError(int &pvsSize, int pass)
 {
 	return -1.0f;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h	(revision 2707)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h	(revision 2709)
@@ -306,12 +306,12 @@
 		// the last part should not be more than log of the sorted part. this
 		// way we can achieve logarithmic behaviour for insertion and find
-		const int n = mEntries.size();
+		const int n = (int)mEntries.size();
 		const int dirtySize = n - mLastSorted;
 
 		const double LOG2E = 1.442695040f;
 
-		const float logN = (float)log((float) Max(1, n))/LOG2E;
-		const float logS = (float)log((float) Max(1, mLastSorted))/LOG2E;
-		const float logD = (float)log((float) Max(1, dirtySize))/LOG2E;
+		const float logN = log((float) Max(1, n))/ (float)LOG2E;
+		const float logS = log((float) Max(1, mLastSorted))/ (float)LOG2E;
+		const float logD = log((float) Max(1, dirtySize))/ (float)LOG2E;
 
 		if (8*(n + 2*dirtySize*logD) <
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SepPlanesBox3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SepPlanesBox3.cpp	(revision 2707)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SepPlanesBox3.cpp	(revision 2709)
@@ -87,5 +87,5 @@
   Vector3 centerOrig = origBox.Center();
   Vector3 centerShad = shadBox.Center();
-  const float eps = 1e-3;
+  const float eps = 1e-3f;
   int cnt = 0;
   
@@ -111,5 +111,5 @@
       // if (cnt == 17) { cout << "Problem " << endl; }
       
-      int centerFlag = pl.Side(pointBACKSIDE, 1e-6);
+      int centerFlag = pl.Side(pointBACKSIDE, 1e-6f);
       if (centerFlag == Plane3:: INTERSECTS)
 	continue; // plane crosses the center of the box!
@@ -141,5 +141,5 @@
   // test all edges of the axis aligned box
   Vector3 a,b;
-  const float eps = 1e-3;
+  const float eps = 1e-3f;
   Vector3 centerShad = shadBox.Center();
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2707)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2709)
@@ -171,5 +171,5 @@
 
 	
-	TestSepAxis();
+	//TestSepAxis();
 	
 	Environment::GetSingleton()->Parse(argc, argv, USE_EXE_PATH);
@@ -333,7 +333,9 @@
 		// NOTE: render texture should be power of 2 and square
 		// renderer must be initialised
-		// $$matt
+		const float w = 640;
+		const float h = 480;
+
 		QtGlRendererBuffer *glbuf = 
-			new QtGlRendererBuffer(1024, 1024,
+			new QtGlRendererBuffer(w, h,
 								   preprocessor->mSceneGraph,
 								   preprocessor->mViewCellsManager,
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp	(revision 2680)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp	(revision 2709)
@@ -13,5 +13,5 @@
 #include "CombinedPreprocessor.h"
 #include "RayCaster.h"
-
+#include <windows.h> 
 
 
@@ -79,4 +79,10 @@
 
   for (mCurrentSamples =0; mCurrentSamples < mTotalSamples; mCurrentSamples += mSamplesPerPass, mPass++) {
+	  while (mSynchronize)
+	  {
+		  // hack: sleep during walthrough computation
+		  Sleep(1000);
+	  }
+
 	mRayCaster->InitPass();
 	
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2702)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2709)
@@ -42,6 +42,7 @@
   int frames;
   int errorFreeFrames;
-
-  PvsRenderStatistics() { Reset(); }
+  int pass;
+
+  PvsRenderStatistics(): pass(0) { Reset(); }
   
   void Reset() 
@@ -169,5 +170,9 @@
   virtual bool ValidViewPoint();
   
-  virtual float GetPixelError(int &pvsSize);
+  /** Gets the pixel error of the current view point. 
+     returns the size of the pvs for the current view point. pass returns the 
+	 current pass of the evaluation.
+	 */
+  virtual float GetPixelError(int &pvsSize, int pass);
   
   virtual void EvalPvsStat();
@@ -185,6 +190,6 @@
   virtual void InitGL();
 
-  virtual int GetWidth() const { return 0; }
-  virtual int GetHeight() const { return 0; }
+  virtual int GetWidth() const {return 0;}
+  virtual int GetHeight() const {return 0;}
 
   unsigned int GetId(const unsigned char r, 
