Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 879)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 882)
@@ -13,5 +13,5 @@
 namespace GtpVisibilityPreprocessor {
 
-class ViewCell;
+class ViewCellLeaf;
 //class BspViewCell;
 class Plane3;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp	(revision 863)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp	(revision 882)
@@ -2069,5 +2069,5 @@
 int VspKdTree::CastLineSegment(const Vector3 &origin,
 							   const Vector3 &termination,
-							   vector<ViewCell *> &viewcells)
+							   ViewCellContainer &viewcells)
 {
 	int hits = 0;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp	(revision 881)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp	(revision 882)
@@ -30,5 +30,5 @@
 int ViewCell::sMailId = 21843194198;
 int ViewCell::sReservedMailboxes = 1;
-int ViewCell::sLastUpdated = 0;
+
 
 //int upperPvsLimit = 120;
@@ -39,5 +39,7 @@
 
 // pvs penalty can be different from pvs size
-inline static float EvalPvsPenalty(const int pvs, const int lower, const int upper)
+inline static float EvalPvsPenalty(const int pvs, 
+								   const int lower, 
+								   const int upper)
 {
 	// clamp to minmax values
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h	(revision 881)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h	(revision 882)
@@ -12,5 +12,5 @@
 namespace GtpVisibilityPreprocessor {
 
-class ViewCell;
+class ViewCellLeaf;
 //class BspViewCell;
 class Plane3;
@@ -23,4 +23,5 @@
 class ViewCellsManager;
 class ViewCellsTree;
+class ViewCell;
 class ViewCellLeaf;
 
@@ -374,7 +375,7 @@
 public:
 	BspLeaf();
-	BspLeaf(ViewCell *viewCell);
+	BspLeaf(ViewCellLeaf *viewCell);
 	BspLeaf(BspInterior *parent);
-	BspLeaf(BspInterior *parent, ViewCell *viewCell);
+	BspLeaf(BspInterior *parent, ViewCellLeaf *viewCell);
 
 	~BspLeaf();
@@ -386,9 +387,9 @@
 	/** Returns pointer of view cell.
 	*/
-	ViewCell *GetViewCell() const;
+	ViewCellLeaf *GetViewCell() const;
 
 	/** Sets pointer to view cell.
 	*/
-	void SetViewCell(ViewCell *viewCell);
+	void SetViewCell(ViewCellLeaf *viewCell);
 
 	/// Rays piercing this leaf.
@@ -404,5 +405,5 @@
 	
 	/// if NULL this does not correspond to feasible viewcell
-	ViewCell *mViewCell;
+	ViewCellLeaf *mViewCell;
 };
 
@@ -426,5 +427,5 @@
 		int mDepth;
 		/// the view cell associated with this subdivsion
-		ViewCell *mViewCell;
+		ViewCellLeaf *mViewCell;
 		/// rays piercing this node
 		BoundedRayContainer *mRays;
@@ -459,5 +460,5 @@
 						 PolygonContainer *polys, 
 						 const int depth, 
-						 ViewCell *viewCell,
+						 ViewCellLeaf *viewCell,
 						 BoundedRayContainer *rays,
 						 int pvs,
@@ -598,5 +599,5 @@
 	/** Construct geometry of view cell.
 	*/
-	void ConstructGeometry(ViewCell *vc, BspNodeGeometry &geom) const;
+	void ConstructGeometry(ViewCell* vc, BspNodeGeometry &geom) const;
 
 			
@@ -721,5 +722,5 @@
 		(i.e., possibly more than one leaf).
 	*/
-	void InsertViewCell(ViewCell *viewCell);
+	void InsertViewCell(ViewCellLeaf *viewCell);
 	/** Inserts polygons down the tree. The polygons are filtered until a leaf is reached,
 		then further subdivided.
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 879)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 882)
@@ -34,7 +34,7 @@
 
 // pvs penalty can be different from pvs size
-inline float EvalPvsPenalty(const int pvs, 
-							const int lower,
-							const int upper)
+inline static float EvalPvsPenalty(const int pvs, 
+								   const int lower,
+								   const int upper)
 {
 	// clamp to minmax values
@@ -269,6 +269,6 @@
 
 int VspBspTree::AddToPolygonSoup(const ViewCellContainer &viewCells,
-							  PolygonContainer &polys,
-							  int maxObjects)
+								 PolygonContainer &polys,
+								 int maxObjects)
 {
 	int limit = (maxObjects > 0) ?
@@ -1147,5 +1147,5 @@
   RayInfoContainer::const_iterator it, it_end = rays.end();
   
-  ViewCell *vc = leaf->GetViewCell();
+  ViewCellLeaf *vc = leaf->GetViewCell();
   
   // add contributions from samples to the PVS
@@ -2589,5 +2589,5 @@
 			if (!onlyValid || node->TreeValid())
 			{
-				ViewCell *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell();
+				ViewCellLeaf *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell();
 
 				ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc);
@@ -3260,5 +3260,5 @@
 int VspBspTree::CastLineSegment(const Vector3 &origin,
 								const Vector3 &termination,
-								vector<ViewCell *> &viewcells)
+								ViewCellContainer &viewcells)
 {
 	int hits = 0;
@@ -3755,5 +3755,5 @@
 	nodeStack.push(mRoot);
   
-	ViewCell *viewcell = NULL;
+	ViewCellLeaf *viewcell = NULL;
   
 	while (!nodeStack.empty())  
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 878)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 882)
@@ -629,5 +629,5 @@
 int KdTree::CastLineSegment(const Vector3 &origin,
 							const Vector3 &termination,
-							vector<ViewCell *> &viewcells)
+							ViewCellContainer &viewcells)
 {
 	int hits = 0;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp	(revision 873)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp	(revision 882)
@@ -178,5 +178,5 @@
 
 
-BspLeaf::BspLeaf(ViewCell *viewCell): 
+BspLeaf::BspLeaf(ViewCellLeaf *viewCell): 
 mViewCell(viewCell)
 {
@@ -190,15 +190,15 @@
 
 
-BspLeaf::BspLeaf(BspInterior *parent, ViewCell *viewCell): 
+BspLeaf::BspLeaf(BspInterior *parent, ViewCellLeaf *viewCell): 
 BspNode(parent), mViewCell(viewCell), mPvs(NULL)
 {
 }
 
-ViewCell *BspLeaf::GetViewCell() const
+ViewCellLeaf *BspLeaf::GetViewCell() const
 {
 	return mViewCell;
 }
 
-void BspLeaf::SetViewCell(ViewCell *viewCell)
+void BspLeaf::SetViewCell(ViewCellLeaf *viewCell)
 {
 	mViewCell = viewCell;
@@ -482,5 +482,5 @@
 
 
-void BspTree::InsertViewCell(ViewCell *viewCell)
+void BspTree::InsertViewCell(ViewCellLeaf *viewCell)
 {
 	PolygonContainer *polys = new PolygonContainer();
@@ -540,6 +540,6 @@
 				
 				// extract view cells associated with the split polygons
-				ViewCell *frontViewCell = GetOrCreateOutOfBoundsCell();
-				ViewCell *backViewCell = GetOrCreateOutOfBoundsCell();
+				ViewCellLeaf *frontViewCell = GetOrCreateOutOfBoundsCell();
+				ViewCellLeaf *backViewCell = GetOrCreateOutOfBoundsCell();
 			
 				BspTraversalData frontData(interior->GetFront(), 
@@ -1097,10 +1097,10 @@
 		if (DotProd((*it)->GetNormal(), splitPlane.mNormal) > 0)
 		{
-			backData.mViewCell = dynamic_cast<ViewCell *>((*it)->mParent);
+			backData.mViewCell = dynamic_cast<ViewCellLeaf *>((*it)->mParent);
 			foundBack = true;
 		}
 		else
 		{
-			frontData.mViewCell = dynamic_cast<ViewCell *>((*it)->mParent);
+			frontData.mViewCell = dynamic_cast<ViewCellLeaf *>((*it)->mParent);
 			foundFront = true;
 		}
@@ -2082,5 +2082,5 @@
 int BspTree::CastLineSegment(const Vector3 &origin,
 							 const Vector3 &termination,
-							 vector<ViewCell *> &viewcells)
+							 ViewCellContainer &viewcells)
 {
 	int hits = 0;
@@ -2197,5 +2197,5 @@
 		if (node->IsLeaf()) 
 		{
-			ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell;
+			ViewCellLeaf *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell;
 
 			if (!viewCell->Mailed()) 
@@ -2629,5 +2629,5 @@
     BoundedRayContainer::const_iterator it, it_end = rays.end();
 
-	ViewCell *vc = leaf->GetViewCell();
+	ViewCellLeaf *vc = leaf->GetViewCell();
 
 	// add contributions from samples to the PVS
@@ -3273,5 +3273,5 @@
   nodeStack.push(mRoot);
   
-  ViewCell *viewcell = NULL;
+  ViewCellLeaf *viewcell = NULL;
   
   while (!nodeStack.empty())  {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp	(revision 863)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp	(revision 882)
@@ -34,7 +34,7 @@
 
 // pvs penalty can be different from pvs size
-inline float EvalPvsPenalty(const int pvs, 
-							const int lower,
-							const int upper)
+inline static float EvalPvsPenalty(const int pvs, 
+								   const int lower,
+								   const int upper)
 {
 	// clamp to minmax values
@@ -2646,5 +2646,5 @@
 			if (!onlyValid || node->TreeValid())
 			{
-				ViewCell *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell();
+				ViewCellLeaf *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell();
 
 				ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 881)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 882)
@@ -1872,6 +1872,6 @@
 void ViewCellsManager::SetViewCellsActive()
 {
-	++ ViewCell::sLastUpdated;
-
+	// collect leaf view cells and set the pointers to the currently
+	// active view cells
 	ViewCellContainer::const_iterator it, it_end = mViewCells.end();
 	for (it = mViewCells.begin(); it != it_end; ++ it)
