Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 607)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 609)
@@ -213,5 +213,5 @@
 	/** Returns render cost of a single view cell given the render cost of an object.
 	*/
-	virtual float GetRendercost(ViewCell *viewCell, float objRendercost) const ;
+	float GetRendercost(ViewCell *viewCell, float objRendercost) const;
 
 	/** Returns container of loaded / generated view cells.
@@ -293,15 +293,12 @@
 							 int maxPvsSize) const;
 
-  /** set valid viewcells in the range of pvs. sorts the viewcells
+
+	/** set valid viewcells in the range of pvs. sorts the viewcells
 	  according to the pvs and then pickups those in the ranges */
-  
-  void
-  SetValidityPercentage(
-						const float minValid,
-						const float maxValid
-						);
-
-  int
-  CountValidViewcells() const;
+
+    
+	void SetValidityPercentage(const float minValid,	const float maxValid);
+
+    int CountValidViewcells() const;
 
 	/** Returns maximal allowed pvs size.
@@ -352,18 +349,16 @@
 										vector<MergeCandidate> &candidates) = 0;
 
-	 
-	void CollectViewCells(const int n) 
-	{
-		mNumActiveViewCells = n;
-		mViewCells.clear();
-		CollectViewCells();
-	}
-
-	bool EqualToSpatialNode(ViewCell *viewCell) { return false;} // implemented in subclasses
-
-
-
+	
+  
+  void CollectViewCells(const int n) {
+	mNumActiveViewCells = n;
+	mViewCells.clear();
+	CollectViewCells();
+  }
+
+
+  virtual bool EqualToSpatialNode(ViewCell *viewCell) const { return false;}
 protected:
-	
+
 
 	/**
@@ -606,5 +601,5 @@
 
 	float GetProbability(ViewCell *viewCell);
-
+	
 
 	void CreateMesh(ViewCell *vc);
@@ -672,5 +667,5 @@
 
 	float GetProbability(ViewCell *viewCell);
-	
+
 
 	void CreateMesh(ViewCell *vc);
@@ -732,5 +727,4 @@
 	float GetProbability(ViewCell *viewCell);
 	
-	
 	ViewCell *GetViewCell(const Vector3 &point) const;
 
@@ -756,10 +750,9 @@
 	void CollectMergeCandidates(const VssRayContainer &rays, vector<MergeCandidate> &candidates);
 
-	bool EqualToSpatialNode(ViewCell *viewCell);
+	bool EqualToSpatialNode(ViewCell *viewCell) const;
 
 protected:
 
-	bool EqualToSpatialNode(ViewCell *viewCell, BspNode **node);
-
+	BspNode *GetSpatialNode(ViewCell *viewCell) const;
 	/** HACK
 	*/
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp	(revision 607)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp	(revision 609)
@@ -430,4 +430,5 @@
 
 	tQueue.push(tData);
+
 
 	mTotalCost = tData.mPvs * tData.mProbability / mBox.GetVolume();
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h	(revision 608)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h	(revision 609)
@@ -199,6 +199,6 @@
 	bool mIsActive;
 
+	
 protected:
-
 
 	/// the potentially visible objects
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 607)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 609)
@@ -699,5 +699,5 @@
 	int axis = 0;
 
-	const float factor = 0.35;
+	const float factor = 0.65;
 	Vector3 point = mViewSpaceBox.Min() +  mViewSpaceBox.Size() * factor;
 
@@ -2613,12 +2613,11 @@
 
 
-bool VspBspViewCellsManager::EqualToSpatialNode(ViewCell *viewCell)
-{
-	BspNode *node;
-	return EqualToSpatialNode(viewCell, &node);
-}
-
-
-bool VspBspViewCellsManager::EqualToSpatialNode(ViewCell *viewCell, BspNode **node)
+bool VspBspViewCellsManager::EqualToSpatialNode(ViewCell *viewCell) const
+{
+	return GetSpatialNode(viewCell) != NULL;
+}
+
+
+BspNode *VspBspViewCellsManager::GetSpatialNode(ViewCell *viewCell) const
 {
 	if (!viewCell->IsLeaf())
@@ -2626,7 +2625,6 @@
 		BspViewCell *bspVc = dynamic_cast<BspViewCell *>(viewCell);
 
-		*node = bspVc->mLeaf;
-        return true;
-	}
+		return bspVc->mLeaf;
+ 	}
 	else
 	{
@@ -2635,22 +2633,19 @@
 		// cannot be node of binary tree
 		if (interior->mChildren.size() != 2)
-			return false;
+			return NULL;
 
 		ViewCell *left = interior->mChildren[0];
 		ViewCell *right = interior->mChildren[1];
 
-		BspNode *leftNode;
-		BspNode *rightNode;
-
-		if (EqualToSpatialNode(left, &leftNode) && EqualToSpatialNode(right, &rightNode))
-		{
-			*node = leftNode->GetParent();
-			return leftNode->IsSibling(rightNode);	
-		}
-
-		*node = NULL;
-
-		return false;
-	}
+		BspNode *leftNode = GetSpatialNode(left);
+		BspNode *rightNode = GetSpatialNode(right);
+
+		if (leftNode && rightNode && leftNode->IsSibling(rightNode))
+		{
+			return leftNode->GetParent(); 
+		}
+	}
+
+	return NULL;
 }
 
@@ -2691,5 +2686,6 @@
 
 
-	// view cells already finished before post processing step (i.e. because they were loaded)
+	// view cells already finished before post processing step 
+	// (i.e. because they were loaded)
 	if (mViewCellsFinished)
 	{
@@ -2790,4 +2786,10 @@
 {
 	return VSP_BSP;
+}
+
+
+void VspBspViewCellsManager::CreateMergeHierarchy()
+{
+	
 }
 
