Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2547)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2569)
@@ -437,5 +437,5 @@
 										 ViewCellContainer &viewCells);
 	float ComputeRenderCost(const int tri, const int obj); //const
-	/** Sets pvs size of view cell as a scalar. Used when storing pvs only in the leaves
+	/** Sets pvs size of a view cell as a scalar. Used when storing pvs only in the leaves
 		of the hierarchy.
 	*/
@@ -443,4 +443,8 @@
 							 const float pvsCost, 
 							 const int entriesInPvs) const;
+	/** Sets render cost of a view cell as a scalar.
+	*/
+	void UpdateScalarPvsCost(ViewCell *vc, const float pvsCost) const;
+
 	/** Returns bounding box of a view cell.
 	*/
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp	(revision 2567)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp	(revision 2569)
@@ -845,5 +845,5 @@
 	mUseTransparency = false;
 
-	mTransferFunction = 0.2f;
+	mTransferFunction = 1.0f;
 	mIndexBufferSize = 0;
 
@@ -866,4 +866,9 @@
 	mShowPiercingRays = false;
 	mShowWeightedRays = false;
+	mShowWeightedCost = false;
+
+	mShowDistanceWeightedPvs = true;
+	mShowDistanceWeightedTriangles = false;
+	mShowWeightedTriangles = false;
 
 	mSpatialFilterSize = 0.01;
@@ -909,4 +914,9 @@
 	connect(mControlWidget, SIGNAL(SetShowPiercingRays(bool)), this, SLOT(SetShowPiercingRays(bool)));
 	connect(mControlWidget, SIGNAL(SetShowWeightedRays(bool)), this, SLOT(SetShowWeightedRays(bool)));
+	connect(mControlWidget, SIGNAL(SetShowWeightedCost(bool)), this, SLOT(SetShowWeightedCost(bool)));
+
+	connect(mControlWidget, SIGNAL(SetShowDistanceWeightedTriangles(bool)), this, SLOT(SetShowDistanceWeightedTriangles(bool)));
+	connect(mControlWidget, SIGNAL(SetShowDistanceWeightedPvs(bool)), this, SLOT(SetShowDistanceWeightedPvs(bool)));
+	connect(mControlWidget, SIGNAL(SetShowWeightedTriangles(bool)), this, SLOT(SetShowWeightedTriangles(bool)));
 
 	connect(mControlWidget,
@@ -1154,5 +1164,4 @@
 {
 	mHidingCost = (float)number / 1000.0f;
-	//cout << "hiding cost " << mHidingCost << endl;
 }
 
@@ -1161,14 +1170,56 @@
 QtGlRendererWidget::SetTopDistance(int number)
 {
-	mTopDistance = number/1000.0f;
+	mTopDistance = number / 1000.0f;
 	updateGL();
 }
 
-void
-QtGlRendererWidget::SetTransparency(int number)
-{
-	mTransparency = number/1000.0f;
+void QtGlRendererWidget::SetTransparency(int number)
+{
+	mTransparency = number / 1000.0f;
 	updateGL();
 }
+
+
+float QtGlRendererWidget::ComputeRenderCost(ViewCell *vc)
+{
+	ObjectPvs basePvs;
+	
+	basePvs = vc->CopyPvs();
+	ObjectPvsIterator pit = basePvs.GetIterator();
+
+	float renderCost = 0;
+
+	//cout << "cost vis: " << mShowDistanceWeightedPvs << " " << " " << mShowDistanceWeightedTriangles << " " << mShowWeightedTriangles << endl;
+	
+	// first mark all objects from this pvs
+	while (pit.HasMoreEntries()) 	
+	{
+		if (mShowDistanceWeightedPvs)
+		{
+			KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next());
+			const AxisAlignedBox3 box = kdObj->GetBox();
+
+			const float dist = SqrDistance(vc->GetBox().Center(), box.Center());
+			renderCost += 1.0f / dist;
+		}
+		else if (mShowDistanceWeightedTriangles)
+		{
+			KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next());
+			const AxisAlignedBox3 box = kdObj->GetBox();
+
+			const float dist = SqrDistance(vc->GetBox().Center(), box.Center());
+			renderCost += kdObj->ComputeNumTriangles() / dist;
+		}
+		else //if (mShowWeightedTriangles)
+		{
+			KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next());
+			renderCost += kdObj->ComputeNumTriangles();
+		}
+		//if (pit.Next()->Mail();
+	}
+
+	return renderCost;
+}
+
 
 void
@@ -1198,7 +1249,9 @@
 
 	ViewCellContainer &viewcells = mViewCellsManager->GetViewCells();
+	
 	int maxPvs = -1;
 	int maxPiercingRays = 1; // not zero for savety
 	float maxRelativeRays = Limits::Small; // not zero for savety
+	float maxRcCost = Limits::Small;
 
 	for (i = 0; i < viewcells.size(); ++ i) 
@@ -1206,21 +1259,39 @@
 		ViewCell *vc = viewcells[i];
 
-		//const int p = vc->GetPvs().CountObjectsInPvs();
-		const int p = vc->GetPvs().GetSize();
-		if (p > maxPvs)
-			maxPvs = p;
-
-		const int piercingRays = vc->GetNumPiercingRays();
-		
-		if (piercingRays > maxPiercingRays)
-			maxPiercingRays = piercingRays;
-
-		const float relativeArea = vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea();
-
-		if ((float)piercingRays / relativeArea > maxRelativeRays)
-			maxRelativeRays = (float)piercingRays / relativeArea;
-	}
-
-	if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays)
+		if (mShowPvsSizes) // pv
+		{
+			//const int p = vc->GetPvs().CountObjectsInPvs();
+			const int p = vc->GetPvs().GetSize();
+			if (p > maxPvs)
+				maxPvs = p;
+		}
+		else if (mShowPiercingRays) // relative number of rays
+		{
+			const int piercingRays = vc->GetNumPiercingRays();
+
+			if (piercingRays > maxPiercingRays)
+				maxPiercingRays = piercingRays;
+		} 
+		else if (mShowWeightedRays)
+		{
+			const int piercingRays = vc->GetNumPiercingRays();
+
+			const float relativeArea = 
+				vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea();
+
+			if ((float)piercingRays / relativeArea > maxRelativeRays)
+				maxRelativeRays = (float)piercingRays / relativeArea;
+		}
+		else if (mShowWeightedCost)
+		{
+			const float rcCost = ComputeRenderCost(vc);
+			mViewCellsManager->UpdateScalarPvsCost(vc, rcCost);
+
+			if (rcCost > maxRcCost)
+				maxRcCost = rcCost;
+		}
+	}
+
+	if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays && !mShowWeightedCost)
 	{
 		for (i = 0; i < viewcells.size(); ++ i) 
@@ -1237,5 +1308,5 @@
 			glColor3f(c.r, c.g, c.b);
 
-			if (!mHideByCost || (mHidingCost < vc->GetNumPiercingRays() / (float)maxPiercingRays)) 
+			if (!mHideByCost || (mHidingCost < (vc->GetNumPiercingRays() / (float)maxPiercingRays))) 
 			{
                 RenderViewCell(vc);
@@ -1269,5 +1340,4 @@
 
 				const float dist = SqrDistance(mDummyViewPoint, vc->GetBox().Center());
-
 				vc->SetDistance(dist);
 			}
@@ -1285,5 +1355,4 @@
 			if (mShowPiercingRays)
 			{
-				// importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs);
 				importance = mTransferFunction *
 					((float)vc->GetNumPiercingRays() / (float)maxPiercingRays);
@@ -1291,5 +1360,4 @@
 			else if (mShowWeightedRays) // relative number of rays
 			{
-				// importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs);
 				float relativeArea = vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea();
 
@@ -1301,22 +1369,15 @@
 			else if (mShowPvsSizes) // pvs size
 			{
-				//importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs);
 				importance = mTransferFunction *
 					((float)vc->GetPvs().GetSize() / (float)maxPvs);
 			} // weighted render cost
-		/*	else
+			else if (mShowWeightedCost)
 			{
-				ObjectPvs basePvs = viewCell->GetPvs();
-				ObjectPvsIterator pit = basePvs.GetIterator();
-
-				// first mark all objects from this pvs
-				while (pit.HasMoreEntries()) 	
-				{
-					if (pit.Next()->Mail();
-				}
-			}*/
+				const float rcCost = mTransferFunction * vc->GetTrianglesInPvs();
+				importance = rcCost / maxRcCost;
+			}
 
 			// c = RgbColor(importance, 1.0f - importance, 0.0f);
-			c = RainbowColorMapping(5.0f * importance);
+			c = RainbowColorMapping(importance);
 
 			glColor4f(c.r, c.g, c.b, 1.0f - mTransparency);
@@ -1362,4 +1423,83 @@
 }
 
+
+QGroupBox *QtRendererControlWidget::CreateVisualizationPanel(QWidget *parent)
+{
+	QRadioButton *rb1, *rb2, *rb3, *rb4, *rb5;
+	
+	// Create a check box to be in the group box
+	rb1 = new QRadioButton("piercing rays", parent);
+	rb1->setText("piercing rays");
+	//vl->addWidget(rb1);
+	connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool)));
+
+	rb2 = new QRadioButton("pvs size", parent);
+	rb2->setText("pvs size");
+	connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool)));
+
+	rb3 = new QRadioButton("wireframe", parent);
+	rb3->setText("wireframe");
+	
+	rb4 = new QRadioButton("weighted rays", parent);
+	rb4->setText("weighted rays");
+	connect(rb4, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedRays(bool)));
+	
+	rb5 = new QRadioButton("pvs cost", parent);
+	rb5->setText("pvs cost");
+	connect(rb5, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedCost(bool)));
+
+	QGroupBox *groupBox = new QGroupBox("Visualization options");
+
+	QVBoxLayout *vbox2 = new QVBoxLayout;
+    
+	vbox2->addWidget(rb3);
+	vbox2->addWidget(rb1);
+	vbox2->addWidget(rb2);
+	vbox2->addWidget(rb4);
+	vbox2->addWidget(rb5);
+	
+	rb3->setChecked(true);
+
+	vbox2->addStretch(1);
+	groupBox->setLayout(vbox2);
+
+	return groupBox;
+}
+
+
+
+QGroupBox *QtRendererControlWidget::CreateRenderCostPanel(QWidget *parent)
+{
+	QRadioButton *rb1, *rb2, *rb3;
+	
+	// Create a check box to be in the group box
+	rb1 = new QRadioButton("triangles", parent);
+	rb1->setText("triangles");
+	//vl->addWidget(rb1);
+	connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedTriangles(bool)));
+
+	rb2 = new QRadioButton("distance weighted pvs", parent);
+	rb2->setText("distance weighted");
+	connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowDistanceWeightedPvs(bool)));
+
+	rb3 = new QRadioButton("distance weighted triangles", parent);
+	rb3->setText("distance weighted triangles");
+	connect(rb3, SIGNAL(toggled(bool)), SIGNAL(SetShowDistanceWeightedTriangles(bool)));
+
+	QGroupBox *groupBox = new QGroupBox("Render cost options");
+
+	QVBoxLayout *vbox2 = new QVBoxLayout;
+    
+	vbox2->addWidget(rb1);
+	vbox2->addWidget(rb2);
+	vbox2->addWidget(rb3);
+	
+	rb2->setChecked(true);
+
+	vbox2->addStretch(1);
+	groupBox->setLayout(vbox2);
+
+	return groupBox;
+}
 
 QtRendererControlWidget::QtRendererControlWidget(QWidget * parent, Qt::WFlags f):
@@ -1459,10 +1599,4 @@
 	connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRenderCost(bool)));
 
-	/*cb = new QCheckBox("Show render cost", hbox);
-	hlayout->addWidget(cb);
-	cb->setChecked(false);
-	connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool)));
-	*/
-
 	cb = new QCheckBox("Show rays", hbox);
 	hlayout->addWidget(cb);
@@ -1470,49 +1604,22 @@
 	connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool)));
 
-	/*cb = new QCheckBox("Show piercing rays", hbox);
-	hlayout->addWidget(cb);
-	cb->setChecked(false);
-	connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool)));
-	*/
-
-
-	QRadioButton *rb1, *rb2, *rb3, *rb4;
-
-	// Create a check box to be in the group box
-	
-	rb1 = new QRadioButton("piercing rays", hbox);
-	rb1->setText("piercing rays");
-	//vl->addWidget(rb1);
-	connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool)));
-
-	rb2 = new QRadioButton("render cost", hbox);
-	rb2->setText("render cost");
-	//vl->addWidget(rb2);
-	connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool)));
-
-	rb3 = new QRadioButton("wireframe", hbox);
-	rb3->setText("wireframe");
-	
-	rb4 = new QRadioButton("weighted rays", hbox);
-	rb4->setText("weighted rays");
-	connect(rb4, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedRays(bool)));
-
-	//vl->addWidget(rb2);
-	//connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool)));
-
-	QGroupBox *groupBox = new QGroupBox("Visualization options");
-
-	QVBoxLayout *vbox2 = new QVBoxLayout;
-    
-	vbox2->addWidget(rb3);
-	vbox2->addWidget(rb1);
-	vbox2->addWidget(rb2);
-	vbox2->addWidget(rb4);
-	rb3->setChecked(true);
-
-	vbox2->addStretch(1);
-	groupBox->setLayout(vbox2);
-
-	vl->addWidget(groupBox, 0, 0);
+
+	//////////////////
+
+	QHBoxLayout *vh = new QHBoxLayout;
+
+	QGroupBox *myBox = new QGroupBox("Visualization");
+
+	myBox->setLayout(vh);
+
+	vl->addWidget(myBox, 0, 0);
+
+	QGroupBox *groupBox = CreateVisualizationPanel(hbox);
+
+	vh->addWidget(groupBox, 0, 0);
+
+	QGroupBox *groupBox2 = CreateRenderCostPanel(hbox);
+
+	vh->addWidget(groupBox2, 0, 0);
 
 	//////////////////////////////////
@@ -1680,5 +1787,6 @@
 
 
-	if (0) {
+	if (0) 
+	{
 		vbox = new QGroupBox("PVS Errors", this);
 		layout()->addWidget(vbox);
@@ -1699,5 +1807,4 @@
 		connect(button, SIGNAL(clicked(void)), SLOT(FocusNextPvsErrorFrame(void)));
 	}
-
 	
 	//mHidingCost = 0.1f;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h	(revision 2566)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h	(revision 2569)
@@ -83,4 +83,6 @@
   QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0);
 
+  QGroupBox *CreateVisualizationPanel(QWidget *parent);
+
   public slots:
 
@@ -88,4 +90,8 @@
   void UpdatePvsErrorItem(int i,
 						  GlRendererBuffer::PvsErrorEntry &);
+
+  
+  QGroupBox *CreateRenderCostPanel(QWidget *parent);
+
 
   signals:
@@ -116,4 +122,6 @@
   void SetShowPiercingRays(bool);
   void SetShowWeightedRays(bool);
+  void SetShowWeightedCost(bool);
+ 
   void SetTopView(bool);
   void SetCutViewCells(bool);
@@ -122,4 +130,8 @@
   void SetHideByCost(bool);
   void SetUseTransparency(bool);
+
+  void SetShowDistanceWeightedTriangles(bool);
+  void SetShowWeightedTriangles(bool);
+  void SetShowDistanceWeightedPvs(bool);
 };
 
@@ -159,4 +171,10 @@
 	bool mUseTransparency;
 
+	bool mShowWeightedCost;
+
+	bool mShowDistanceWeightedTriangles;
+	bool mShowDistanceWeightedPvs;
+	bool mShowWeightedTriangles;
+
 	// some statistics
 	int mPvsSize;
@@ -352,4 +370,30 @@
 	}
 
+	void SetShowWeightedCost(bool b) 
+	{
+		mShowWeightedCost = b;
+		updateGL();
+	}
+
+	void SetShowDistanceWeightedPvs(bool b) 
+	{
+		mShowDistanceWeightedPvs = b;
+		updateGL();
+	}
+
+
+	void SetShowDistanceWeightedTriangles(bool b) 
+	{
+		mShowDistanceWeightedTriangles = b;
+		updateGL();
+	}
+	
+	void SetShowWeightedTriangles(bool b) 
+	{
+		mShowWeightedTriangles = b;
+		updateGL();
+	}
+
+
 	void _RenderPvs();
 
@@ -358,5 +402,5 @@
 	void _UpdatePvsIndices(KdNode *node, int &indexBufferSize);
 
-
+	float ComputeRenderCost(ViewCell *vc);
 
 	/////////
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp	(revision 2567)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp	(revision 2569)
@@ -125,4 +125,5 @@
 	glScalef(s, s, s);
 
+	// TODO: determine model matrix for establishing right rendering order for transparency
 	Vector3 t = -mRenderer->mSceneGraph->GetBox().Center();
 	glTranslatef(t.x, t.y, t.z);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2560)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2569)
@@ -3212,4 +3212,10 @@
 
 
+void ViewCellsManager::UpdateScalarPvsCost(ViewCell *vc, const float pvsCost) const
+{
+	vc->mPvsCost = pvsCost;
+}
+
+
 void
 ViewCellsManager::ApplyFilter(ViewCell *viewCell,
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp	(revision 2560)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp	(revision 2569)
@@ -159,5 +159,5 @@
 const ObjectPvs &ViewCell::GetPvs() const
 {
-  return mPvs;
+	return mPvs;
 }
 
@@ -165,5 +165,11 @@
 ObjectPvs &ViewCell::GetPvs()
 {
-  return mPvs;
+	return mPvs;
+}
+
+
+ObjectPvs ViewCell::CopyPvs()
+{
+	return mPvs;
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp	(revision 2569)
@@ -132,8 +132,56 @@
 
 
-KdIntersectable::KdIntersectable(KdNode *item, const AxisAlignedBox3 &box)  :
-  IntersectableWrapper<KdNode *>(item)
+KdIntersectable::KdIntersectable(KdNode *item, const AxisAlignedBox3 &box) :
+  IntersectableWrapper<KdNode *>(item), mNumTriangles(-1)
 {
-	mBox = box;
 }
+
+int KdIntersectable::ComputeNumTriangles()
+{
+	std::stack<KdNode *> tStack;
+	tStack.push(mItem);
+
+	if (mNumTriangles != -1)
+		return mNumTriangles;
+
+	mNumTriangles = 0;
+
+	while (!tStack.empty())
+	{
+		KdNode *node = tStack.top();
+		tStack.pop();
+
+		if (!node->IsLeaf()) 
+		{
+			KdInterior *kdInterior = static_cast<KdInterior *>(node);
+
+			tStack.push(kdInterior->mBack);
+			tStack.push(kdInterior->mFront);
+		} 
+		else 
+		{
+			KdLeaf *leaf = static_cast<KdLeaf *>(node);
+
+			int tri = 0;
+
+			for (size_t i = 0; i < leaf->mObjects.size(); ++ i)
+			{
+				TriangleIntersectable *obj = 
+					static_cast<TriangleIntersectable *>(leaf->mObjects[i]);
+				
+				// check if already rendered
+				if (!obj->Mailed())
+				{
+					obj->Mail();
+					++ tri;
+				}
+			}
+
+            mNumTriangles += tri;
+		}
+	}
+
+	return mNumTriangles;
 }
+
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h	(revision 2176)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h	(revision 2569)
@@ -242,5 +242,5 @@
 
 
-class MeshInstance : public Intersectable {
+class MeshInstance: public Intersectable {
 
 public:
@@ -277,12 +277,8 @@
 	virtual int Type() const { return MESH_INSTANCE; }
 
-	virtual int
-		CastRay(
-		Ray &ray,
-		const std::vector<int> &faces
-		);
-
-
-	virtual std::ostream &Describe(std::ostream &s) {
+	virtual int CastRay(Ray &ray, const std::vector<int> &faces);
+
+	virtual std::ostream &Describe(std::ostream &s) 
+	{
 		s<<"MeshInstance Id="<<GetId();
 		return mMesh->Describe(s);
@@ -290,10 +286,10 @@
 
 	/** Sets the material. this overrides the material from 
-	the mesh itself.
+		the mesh itself.
 	*/
 	void SetMaterial(Material *mat);
 
 	/** Returns the material of this mesh instance.
-	if not defined, returns the material of the mesh itself.
+		if not defined, returns the material of the mesh itself.
 	*/
 	Material *GetMaterial() const;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2543)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2569)
@@ -122,5 +122,5 @@
   delete splitCandidates;
 
-  float area = GetBox().SurfaceArea()*mKdPvsArea;
+  float area = GetBox().SurfaceArea() * mKdPvsArea;
 
   SetPvsTerminationNodes(area);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 2562)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 2569)
@@ -162,4 +162,7 @@
 	*/
 	const ObjectPvs &GetPvs() const;
+	/** Returns copy of pvs.
+	*/
+	ObjectPvs CopyPvs();
 	/** Returns reference to pvs.
 	*/
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2568)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2569)
@@ -354,4 +354,5 @@
 			if (1) // not working with vbo
 			{
+				cout << "starting the qt viewer" << endl;
 				QtGlViewer *viewer = 
 					new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h	(revision 2543)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h	(revision 2569)
@@ -162,4 +162,6 @@
 	KdIntersectable(KdNode *item, const AxisAlignedBox3 &box);
     
+	int ComputeNumTriangles();
+	
 	int Type() const
 	{
@@ -174,4 +176,8 @@
 	/// the bounding box of this intersectable
 	AxisAlignedBox3 mBox;
+
+protected:
+
+	int mNumTriangles;
 };
 
