Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 499)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 502)
@@ -1,5 +1,5 @@
 #############################################################################
 # Makefile for building: preprocessor
-# Generated by qmake (2.00a) (Qt 4.1.0) on: st 4. I 19:53:26 2006
+# Generated by qmake (2.00a) (Qt 4.1.0) on: ?t 5. I 09:42:49 2006
 # Project:  preprocessor.pro
 # Template: app
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 492)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 502)
@@ -344,5 +344,5 @@
 
   /** Get a viewcell containing the specified point */
-  ViewCell *GetViewCell(const Vector3 &point) { return NULL; }
+  ViewCell *GetViewCell(const Vector3 &point);
 
 protected:
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 495)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 502)
@@ -2676,4 +2676,8 @@
 BspTree::GetViewCell(const Vector3 &point)
 {
+  if (mRoot == NULL)
+	return NULL;
+  
+
   stack<BspNode *> nodeStack;
   nodeStack.push(mRoot);
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 501)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 502)
@@ -610,26 +610,28 @@
 		"#RssSamples\n" <<rssSamples<<endl;
 	  
-	ComputeRenderError();
-
-	mVssRays.PrintStatistics(mStats);
-	mViewCellsManager->PrintPvsStatistics(mStats);
-
-	VssRayContainer selectedRays;
-	int desired = Max(
-					  mViewCellsManager->GetPostProcessSamples(),
-					  mViewCellsManager->GetVisualizationSamples());
-
-	mVssRays.SelectRays(desired, selectedRays);
-	
-	//-- post process view cells
-	mViewCellsManager->PostProcess(mObjects, selectedRays);
-	
-	//-- several visualizations and statistics
-	Debug << "view cells after post processing: " << endl;
-	mViewCellsManager->PrintStatistics(Debug);
-	
-	if (1) 
-	  mViewCellsManager->Visualize(mObjects, selectedRays);
-  }
+
+	  mVssRays.PrintStatistics(mStats);
+	  mViewCellsManager->PrintPvsStatistics(mStats);
+	  
+	  VssRayContainer selectedRays;
+	  int desired = Max(
+						mViewCellsManager->GetPostProcessSamples(),
+						mViewCellsManager->GetVisualizationSamples());
+	  
+	  mVssRays.SelectRays(desired, selectedRays);
+	  
+	  //-- post process view cells
+	  mViewCellsManager->PostProcess(mObjects, selectedRays);
+	  
+	  //-- several visualizations and statistics
+	  Debug << "view cells after post processing: " << endl;
+	  mViewCellsManager->PrintStatistics(Debug);
+	  
+	  if (1) 
+		mViewCellsManager->Visualize(mObjects, selectedRays);
+
+	  ComputeRenderError();
+	  
+	}
 
 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/default.env
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 497)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 502)
@@ -23,6 +23,6 @@
 	useGlRenderer true
 #	type sampling
-	type vss
-#	type rss
+#	type vss
+	type rss
 }
 
@@ -169,6 +169,6 @@
 	#type kdTree
 	#type vspKdTree
-	 type bspTree
-	# type vspBspTree
+	type bspTree
+	#type vspBspTree
 	
 	#type sceneDependent
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h	(revision 500)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h	(revision 502)
@@ -24,5 +24,5 @@
   int frames;
   int errorFreeFrames;
-  
+
   PvsRenderStatistics() { Reset(); }
   
@@ -61,5 +61,6 @@
   
   int mFrame;
-  
+  bool mWireFrame;
+
   QWaitCondition mRenderingFinished;
   
@@ -76,5 +77,5 @@
   void RenderMesh(Mesh *m);
   void SetupMaterial(Material *m);
-  void SetupCamera();
+  virtual void SetupCamera();
   void RandomViewPoint();
   
@@ -119,5 +120,6 @@
 	makeCurrent();
 	InitGL();
-	
+	doneCurrent();
+
   }
   
@@ -142,4 +144,9 @@
 public:
 
+  // point of the last mouse click used for movement in the scene
+  Vector3 mousePoint;
+
+  bool mTopView;
+  
   GlRendererWidget(SceneGraph *sceneGraph,
 				   ViewCellsManager *viewcells,
@@ -147,8 +154,10 @@
 				   ):
 	GlRenderer(sceneGraph, viewcells), QGLWidget(parent, shareWidget, f)
-  {}
+  {
+	mTopView = false;
+  }
 
-  Vector3 mousePoint;
-  
+  virtual void SetupCamera();
+
   void initializeGL() {
 	InitGL();
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 501)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 502)
@@ -1035,4 +1035,12 @@
 		exporter->ExportPolygons(cell);
 	}
+}
+
+ViewCell *
+BspViewCellsManager::GetViewCell(const Vector3 &point)
+{
+  if (!mBspTree)
+	return NULL;
+  return mBspTree->GetViewCell(point);
 }
 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp	(revision 497)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp	(revision 502)
@@ -26,4 +26,5 @@
   //  timerId = startTimer(10);
   mFrame = 0;
+  mWireFrame = false;
 }
 
@@ -81,5 +82,9 @@
   
   for (i=0; i < mesh->mFaces.size(); i++) {
-	glBegin(GL_POLYGON);
+	if (mWireFrame)
+	  glBegin(GL_POLYGON);
+	else
+	  glBegin(GL_LINE_LOOP);
+
 	Face *face = mesh->mFaces[i];
 	for (int j = 0; j < face->mVertexIndices.size(); j++) {
@@ -309,4 +314,10 @@
   // now render im1
   if (viewcell) {
+	if (mTopView) {
+	  mWireFrame = true;
+	  RenderMeshInstance(viewcell);
+	  mWireFrame = false;
+	}
+	
 	// init ortographic projection
 	glMatrixMode(GL_PROJECTION);
@@ -388,5 +399,4 @@
 
   makeCurrent();
-
   SetupProjection(GetWidth(), GetHeight());
   
@@ -481,2 +491,25 @@
   mFrame++;
 }
+
+
+void
+GlRendererWidget::SetupCamera()
+{
+  if (!mTopView)
+	GlRenderer::SetupCamera();
+  else {
+	float dist = Magnitude(mSceneGraph->GetBox().Diagonal())*0.05;
+	Vector3 pos = mViewPoint - dist*Vector3(mViewDirection.x,
+											1,
+											mViewDirection.y);
+	
+	Vector3 target = mViewPoint + dist*mViewDirection;
+	Vector3 up(0,1,0);
+	
+	glLoadIdentity();
+	gluLookAt(mViewPoint.x, mViewPoint.y, mViewPoint.z,
+			  target.x, target.y, target.z,
+			  up.x, up.y, up.z);
+  }
+
+}
