Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp	(revision 1824)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp	(revision 1832)
@@ -27,5 +27,4 @@
 
 
-#define CAMERA_VIEW_WIDTH 0.5f
   
 class ViewCellsManager;
@@ -305,5 +304,5 @@
 {
   if (!mTopView) {
-	int ww = w*CAMERA_VIEW_WIDTH;
+	int ww = w;
 	int hh = h;
 	glViewport(0, 0, ww, hh);
@@ -313,5 +312,5 @@
 	glMatrixMode(GL_MODELVIEW);
   } else {
-	int ww = w*CAMERA_VIEW_WIDTH;
+	int ww = w;
 	int hh = h;
 	glViewport(0, 0, ww, hh);
@@ -323,15 +322,4 @@
 }
 
-void
-QtGlRendererWidget::SetupManipulatorProjection(const int w, const int h, const float angle)
-{
-  int ww = w*(1.0f - CAMERA_VIEW_WIDTH);
-  int hh = h;
-  glViewport(w - ww, 0, ww, hh);
-  glMatrixMode(GL_PROJECTION);
-  glLoadIdentity();
-  gluPerspective(angle, ww/(float)hh, 0.1f, 1000.0f);
-  glMatrixMode(GL_MODELVIEW);
-}
 
 
@@ -380,5 +368,7 @@
 #endif
 	  } else
-			pvs = viewcell->GetPvs();
+		pvs = viewcell->GetPvs();
+
+	  emit PvsUpdated();
 	}
 
@@ -584,32 +574,13 @@
   int diffy = -(mousePoint.y - y);
   
-  if (x < width()*CAMERA_VIEW_WIDTH) {
-	if (e->modifiers() & Qt::ControlModifier) {
-	  mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY/2.0;
-	  mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY/2.0;
-	} else {
-	  mViewPoint += mViewDirection*((mousePoint.y - y)*MOVE_SENSITIVITY);
-	  float adiff = TURN_ANGLE*(x - mousePoint.x)*-TURN_SENSITIVITY;
-	  float angle = atan2(mViewDirection.x, mViewDirection.z);
-	  mViewDirection.x = sin(angle+adiff);
-	  mViewDirection.z = cos(angle+adiff);
-	}
+  if (e->modifiers() & Qt::ControlModifier) {
+	mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY/2.0;
+	mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY/2.0;
   } else {
-	float W = width()*(1.0f-CAMERA_VIEW_WIDTH);
-	float H = height();
-	int xx = x - width()*CAMERA_VIEW_WIDTH;
-	int mxx = mousePoint.x - width()*CAMERA_VIEW_WIDTH;
-    if (e->modifiers() & Qt::ControlModifier) {
-	  mManipulatorScale = mManipulatorScale * (1.0 + (((float) (-diffy)) / H));
-	} else {
-	  float quat[4];
-	  trackball(quat,
-				(2.0 * mxx - W) / W,
-				(H - 2.0 * mousePoint.y) / H,
-				(2.0 * xx - W) / W,
-				(H - 2.0 * y) / H
-				);
-	  add_quats(quat, mManipulatorLastQuat, mManipulatorLastQuat);
-	}
+	mViewPoint += mViewDirection*((mousePoint.y - y)*MOVE_SENSITIVITY);
+	float adiff = TURN_ANGLE*(x - mousePoint.x)*-TURN_SENSITIVITY;
+	float angle = atan2(mViewDirection.x, mViewDirection.z);
+	mViewDirection.x = sin(angle+adiff);
+	mViewDirection.z = cos(angle+adiff);
   }
   
@@ -651,37 +622,6 @@
   }
 
-  mFrame++;
-
-  if (1) {
-	// render into the right side of the window buffer
-	SetupManipulatorProjection(width(), height());
-	SetupManipulator();
-	
-	
-	if (mRenderViewCells) 
-	  RenderViewCells();
-	
-	RenderPvs();
-	
-	if (0) {
-	  mWireFrame = true;
-	  RenderScene();
-	  mWireFrame = false;
-	}
-	
-	if (mShowRays) {
-	  RssPreprocessor *p = (RssPreprocessor *)mViewCellsManager->GetPreprocessor();
-	  if (p->mRssTree) {
-		VssRayContainer rays;
-		p->mRssTree->CollectRays(rays, 10000);
-		RenderRays(rays);
-	  }
-	}
-
-	if (mShowRenderCost) 
-	  RenderRenderCost();
-
-	RenderInfo();
-  }
+  RenderInfo();
+
   mFrame++;
   
@@ -727,24 +667,4 @@
 }
 
-void
-QtGlRendererWidget::SetupManipulator()
-{
-  float m[4][4];
-
-  glLoadIdentity();
-  gluLookAt(0.0, 0.0, 30.0,  /* eye is at (0,0,30) */
-			0.0, 0.0, 0.0,      /* center is at (0,0,0) */
-			0.0, 1.0, 0.);      /* up is in positive Y direction */
-  
-  build_rotmatrix(m, mManipulatorLastQuat);
-  glMultMatrixf(&m[0][0]);
-  
-  float scale = mManipulatorScale*20.0f/Magnitude(mSceneGraph->GetBox().Diagonal());
-  glScalef(scale, scale, scale);
-  
-  Vector3 t = -mSceneGraph->GetBox().Center();
-  glTranslatef(t.x, t.y, t.z);
-  
-}
 
 void
@@ -797,6 +717,5 @@
   mRenderVisibilityEstimates = false;
   mTransferFunction = 0.2f;
-  mManipulatorScale = 1.0f;
-  trackball(mManipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f);
+
   bool tmp;
 
@@ -990,42 +909,5 @@
 QtGlRendererWidget::RenderInfo()
 {
-
-  // $$JB temporal hack for two windows separation
-  if (1) {
-
-	// model view 
-	glPushMatrix();
-	glLoadIdentity();
-	
-	// init ortographic projection
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	
-	glLoadIdentity();
-	gluOrtho2D(0, 1.0f, 0, 1.0f);
-	
-	float w = 0.01f;
-	float h = 1.0f;
-	float px = 0.0f;
-	float py = 0.0f;
-	
-	glColor3f(0.8f, 0.8f, 0.8f);
-	glBegin(GL_QUADS);
-	
-	glVertex3f(px+w, py, 0);
-	glVertex3f(px+w, py+h + w, 0);
-	glVertex3f(px, py+h, 0);
-	glVertex3f(px, py, 0);
-	glEnd();
-	
-	// projection
-	glPopMatrix();
-	
-	glMatrixMode(GL_MODELVIEW);
-	// model view
-	glPopMatrix();
-  }
-
-
+  
   QString s;
   int vc = 0;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h	(revision 1824)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h	(revision 1832)
@@ -147,6 +147,4 @@
   float mTransferFunction;
 
-  float mManipulatorLastQuat[4];
-  float mManipulatorScale;
   
   QtRendererControlWidget *mControlWidget;
@@ -169,7 +167,4 @@
 
   virtual void SetupCamera();
-  // setup a transformation for manipulator
-  void
-  SetupManipulator();
 
   void initializeGL() {
@@ -204,7 +199,4 @@
   virtual void
   SetupCameraProjection(const int w, const int h, const float angle = 70.0f);
-
-  virtual void
-  SetupManipulatorProjection(const int w, const int h, const float angle = 70.0f);
 
   void
@@ -310,5 +302,6 @@
   }
 
-
+  signals:
+  void PvsUpdated();
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1830)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1832)
@@ -32,5 +32,6 @@
 
 // $$JB HACK
-#define USE_KD_PVS 0
+#define USE_KD_PVS 1
+
 #define KD_PVS_AREA (1e-5f)
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Renderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Renderer.h	(revision 860)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Renderer.h	(revision 1832)
@@ -26,5 +26,5 @@
 	void SetViewCellsManager(ViewCellsManager *vcm);
 
-protected:
+public:
 	ViewCellsManager *mViewCellsManager;
 	SceneGraph *mSceneGraph;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Makefile	(revision 1824)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Makefile	(revision 1832)
@@ -1,5 +1,5 @@
 #############################################################################
 # Makefile for building: preprocessor
-# Generated by qmake (2.00a) (Qt 4.1.2) on: út 28. XI 19:46:06 2006
+# Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 30. XI 15:32:50 2006
 # Project:  preprocessor.pro
 # Template: app
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h	(revision 1715)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h	(revision 1832)
@@ -446,8 +446,8 @@
   
   void AddRay(const RayInfo &data) {
-	mValidPvs = false;
+		mValidPvs = false;
     rays.push_back(data);
-	mTotalRays++;
-	data.mRay->Ref();
+		mTotalRays++;
+		data.mRay->Ref();
   }
 	
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp	(revision 1715)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp	(revision 1832)
@@ -211,10 +211,10 @@
    
    float cosTheta = 1.0f - 2*r1;
-  float sinTheta = sqrt(1 - sqr(cosTheta));
-  float fi = 2.0f*M_PI*r2;
-  
-  Vector3 dir(sinTheta*sin(fi),
-			  cosTheta,
-			  sinTheta*cos(fi));
+	 float sinTheta = sqrt(1 - sqr(cosTheta));
+	 float fi = 2.0f*M_PI*r2;
+  
+	 Vector3 dir(sinTheta*sin(fi),
+							 cosTheta,
+							 sinTheta*cos(fi));
   
   return dir;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp	(revision 1829)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp	(revision 1832)
@@ -2864,9 +2864,9 @@
 	
 	// $$ 
-	// sumWeights = leaf->mTotalRays;
+	sumWeights = leaf->mTotalRays;
 
 	//$$ test 30.11. 2006 
 	// normalize per volume of the cell not the number of rays!
-	sumWeights = spatialArea*dirArea;
+	// sumWeights = spatialArea*dirArea;
 	
 	if (sumWeights != 0.0f) {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1785)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1832)
@@ -40,4 +40,5 @@
 #include "QtPreprocessorThread.h"
 #include "QtGlRenderer.h"
+#include "QtGlViewer.h"
 #endif
 
@@ -295,5 +296,4 @@
 		if (!rendererWidget) 
 		{
-		  
 		  if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
 			QMessageBox::information(0, "OpenGL pbuffers", 
@@ -303,12 +303,16 @@
 		  }
 		  
-		  
 		  rendererWidget = new QtGlRendererWidget(preprocessor->mSceneGraph,
-												  preprocessor->mViewCellsManager,
-												  preprocessor->mKdTree);
-
-		  ((QtGlRendererWidget *)rendererWidget)->SetThread((QtPreprocessorThread *)pt);
+																							preprocessor->mViewCellsManager,
+																							preprocessor->mKdTree);
+			
+		  //((QtGlRendererWidget *)rendererWidget)->SetThread((QtPreprocessorThread *)pt);
 		  rendererWidget->Show();
-		  guiSupported = true; 
+
+			QtGlViewer *viewer = new QtGlViewer(NULL,
+																					(QtGlRendererWidget *)
+																					rendererWidget);
+			viewer->show();
+			guiSupported = true; 
 		}
 
@@ -321,7 +325,7 @@
 		  preprocessor->renderer = 
 			new QtGlRendererBuffer(512, 512,
-								   preprocessor->mSceneGraph,
-								   preprocessor->mViewCellsManager,
-								   preprocessor->mKdTree);
+														 preprocessor->mSceneGraph,
+														 preprocessor->mViewCellsManager,
+														 preprocessor->mKdTree);
 		  //		preprocessor->Getrenderer->makeCurrent();
 		}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 1824)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 1832)
@@ -154,4 +154,8 @@
   inline void SetSnapPrefix(const string &pref) { mSnapPrefix = pref; }
 
+public:
+  int mFrame;
+  bool mWireFrame;
+	
 protected:
 
@@ -171,6 +175,4 @@
   HaltonSequence halton;
   
-  int mFrame;
-  bool mWireFrame;
   
   bool mDetectEmptyViewSpace;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro	(revision 1757)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro	(revision 1832)
@@ -85,5 +85,5 @@
 # Input
 HEADERS += Halton.h VssRay.h VssPreprocessor.h RssTree.h GlRenderer.h \
-PreprocessorThread.h Preprocessor.h Beam.h
+PreprocessorThread.h Preprocessor.h Beam.h QtGlViewer.h
 
 
@@ -107,5 +107,5 @@
 InternalRayCaster.cpp IntelRayCaster.cpp \
 RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp \
-Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp
+Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp QtGlViewer.cpp
 
 
