Index: /trunk/VUT/GtpVisibilityPreprocessor/include/ViewCellBsp.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/include/ViewCellBsp.h	(revision 221)
+++ /trunk/VUT/GtpVisibilityPreprocessor/include/ViewCellBsp.h	(revision 221)
@@ -0,0 +1,84 @@
+#ifndef _ViewCellBsp_H__
+#define _ViewCellBsp_H__
+
+#include "Containers.h"
+
+class ViewCell;
+class Plane3;
+
+namespace GtpVisibilityPreprocessor {
+  
+  class BspInterior;
+
+  /**
+     BspNode abstract class serving for interior and leaf node implementation
+  */
+  class BspNode 
+  {
+  public:
+	  /** Determines whether this node is a leaf or not
+	  @return true if leaf
+	  */
+	  virtual bool IsLeaf() const = 0;
+    
+	  /** Determines whether this node is a root
+	  @return true if root
+	  */
+	  virtual bool IsRoot() const;
+  
+  protected:
+
+	  void SplitPoly(Plane3 *plane, Mesh *viewcell);
+
+	  /// parent of this node
+	  BspInterior *mParent;
+  };
+
+  /** BSP interior node implementation */
+  class BspInterior : public BspNode 
+  {    
+	/** @return false since it is an interior node */
+	bool IsLeaf() const;
+
+	protected:
+	/// Splitting plane corresponding to this node
+	Plane3 mPlane;
+	/// back node
+	BspNode *mBack;
+	/// front node
+	BspNode *mFront;
+  };
+  
+  
+  /** BSP leaf node implementation */
+  class BspLeaf : public BspNode 
+  {
+  public:
+	  BspLeaf(ViewCell *viewCell = NULL);
+	  /** @return true since it is an interior node */
+	  virtual bool IsLeaf();
+
+  protected:
+	  /// polygonal representation of this viewcell
+	  /// if NULL this note does not correspond to feasible viewcell
+	  ViewCell *mViewCell;
+  };
+  
+  /** Implementation of the ViewCell BSP tree */
+  class BspTree 
+  {
+  public:
+	  /** Constructor takes a pointer to the cell corresponding to the whole
+	  viewspace */
+	  BspTree(ViewCell *cell);
+        
+  protected:
+	  /// Pointer to the root of the tree
+	  BspNode *mRoot;
+	  /// Pointer to the root cell of the viewspace */
+	  ViewCell *mRootCell;
+  };
+  
+}; // GtpVisibilityPreprocessor
+
+#endif
Index: /trunk/VUT/GtpVisibilityPreprocessor/include/Preprocessor.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/include/Preprocessor.h	(revision 74)
+++ /trunk/VUT/GtpVisibilityPreprocessor/include/Preprocessor.h	(revision 221)
@@ -68,5 +68,5 @@
     SceneGraph *mSceneGraph;
     /// BSP tree representing the viewcells
-    BSPTree *mViewCellBSPTree;
+    BspTree *mViewCellBspTree;
     /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
     KdTree *mKdTree;
Index: /trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj	(revision 219)
+++ /trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj	(revision 221)
@@ -256,5 +256,5 @@
 			</File>
 			<File
-				RelativePath="..\src\ViewCellBSP.h">
+				RelativePath="..\src\ViewCellBsp.h">
 			</File>
 			<File
@@ -315,5 +315,5 @@
 			</File>
 			<File
-				RelativePath="..\include\ViewCellBSP.h">
+				RelativePath="..\include\ViewCellBsp.h">
 			</File>
 		</Filter>
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h	(revision 221)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h	(revision 221)
@@ -0,0 +1,115 @@
+#ifndef _ViewCellBsp_H__
+#define _ViewCellBsp_H__
+
+#include "Mesh.h"
+class ViewCell;
+class Plane3;
+//class Mesh;
+
+//namespace GtpVisibilityPreprocessor {
+  
+class BspInterior;
+
+
+  /**
+     BspNode abstract class serving for interior and leaf node implementation
+  */
+  class BspNode 
+  {
+  public:
+	  /** Determines whether this node is a leaf or not
+	  @return true if leaf
+	  */
+	  virtual bool IsLeaf() const = 0;
+    
+	  /** Determines whether this node is a root
+	  @return true if root
+	  */
+	  virtual bool IsRoot() const;
+
+  protected:
+
+	  /// parent of this node
+	  BspInterior *mParent;
+  };
+
+  /** BSP interior node implementation */
+  class BspInterior : public BspNode 
+  {   
+  public:
+	  BspInterior(Plane3 plane): mPlane(plane) {}
+	  /** @return false since it is an interior node */
+	  bool IsLeaf() const;
+
+	  BspNode *GetBack() {return mBack;}
+	  BspNode *GetFront() {return mFront;}
+
+	  void ReplaceChildLink(BspNode *oldChild, BspNode *newChild);
+	  void SetupChildLinks(BspNode *b, BspNode *f);
+
+  protected:
+		
+	  /// Splitting plane corresponding to this node
+	  Plane3 mPlane;
+	  /// back node
+	  BspNode *mBack;
+	  /// front node
+	  BspNode *mFront;
+  };
+  
+  
+  /** BSP leaf node implementation */
+  class BspLeaf : public BspNode 
+  {
+  public:
+	  BspLeaf(ViewCell *viewCell = NULL);
+    
+	  /** @return true since it is an interior node */
+	  bool IsLeaf() const;
+
+  protected:
+   
+	  /// polygonal representation of this viewcell
+	  /// if NULL this note does not correspond to feasible viewcell
+	  ViewCell *mViewCell;
+  };
+  
+  /** Implementation of the ViewCell BSP tree */
+  class BspTree 
+  {
+  public:
+	  struct BspTraversalData
+	  {  
+		  BspNode *mNode;
+		  BspInterior *mParent;
+
+		  Mesh mViewCell;
+		  int mDepth;
+		      
+		  BspTraversalData() {}
+		  BspTraversalData(BspNode *n, BspInterior *p, const Mesh &m, const int d): 
+		  mNode(n), mParent(p), mViewCell(m), mDepth(d) {}
+      };
+	 
+	  /** Constructor takes a pointer to the cell corresponding to the whole
+	  viewspace */
+	  BspTree(ViewCell *cell);
+        
+  protected:
+
+	  Plane3 *SelectPlane(Mesh *viewcell);
+	  void Subdivide();
+	   
+	  BspNode *SubdivideNode(BspLeaf *leaf, BspInterior *parent, 
+							 Mesh *viewCell, const int depth, 
+							 Mesh &frontPolys, Mesh &backPolys);
+
+	  /// Pointer to the root of the tree
+	  BspNode *mRoot;
+	  /// Pointer to the root cell of the viewspace
+	  ViewCell *mRootCell;
+  };
+  
+//}; // GtpVisibilityPreprocessor
+
+#endif
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h	(revision 221)
@@ -79,5 +79,5 @@
   SceneGraph *mSceneGraph;
   /// BSP tree representing the viewcells
-  BSPTree *mViewCellBSPTree;
+  BspTree *mViewCellBspTree;
   /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
   KdTree *mKdTree;
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h	(revision 209)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h	(revision 221)
@@ -38,7 +38,8 @@
 	Rectangle3 &r1,
 	Rectangle3 &r2
-	) const;
+	) const
 
-	
+  {//TODO
+  }
   
 };
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h	(revision 220)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h	(revision 221)
@@ -6,5 +6,5 @@
 //namespace GtpVisibilityPreprocessor {
   
-class BSPInterior;
+class BspInterior;
 class BspPvs;
 /**
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 202)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 221)
@@ -8,7 +8,7 @@
 //namespace GtpVisibilityPreprocessor {
 /****************************************************************/
-/*                  class BSPNode implementation                */
+/*                  class BspNode implementation                */
 /****************************************************************/
-bool BSPNode::IsRoot() const 
+bool BspNode::IsRoot() const 
 {
 	return mParent == NULL;
@@ -16,13 +16,13 @@
 
 /****************************************************************/
-/*              class BSPInterior implementation                */
+/*              class BspInterior implementation                */
 /****************************************************************/
 
-bool BSPInterior::IsLeaf() const
+bool BspInterior::IsLeaf() const
 { 
 	return false; 
 }
 
-void BSPInterior::ReplaceChildLink(BSPNode *oldChild, BSPNode *newChild) 
+void BspInterior::ReplaceChildLink(BspNode *oldChild, BspNode *newChild) 
 {
 	if (mBack == oldChild)
@@ -36,5 +36,5 @@
 }
 
-void BSPInterior::SetupChildLinks(BSPNode *b, BSPNode *f) 
+void BspInterior::SetupChildLinks(BspNode *b, BspNode *f) 
 {
     mBack = b;
@@ -43,12 +43,12 @@
 
 /****************************************************************/
-/*                  class BSPLeaf implementation                */
+/*                  class BspLeaf implementation                */
 /****************************************************************/
 
-BSPLeaf::BSPLeaf(ViewCell *viewCell): mViewCell(viewCell) 
+BspLeaf::BspLeaf(ViewCell *viewCell): mViewCell(viewCell) 
 {
 }
 
-bool BSPLeaf::IsLeaf() const 
+bool BspLeaf::IsLeaf() const 
 { 
 	return true; 
@@ -56,19 +56,19 @@
 
 /****************************************************************/
-/*                  class BSPTree implementation                */
+/*                  class BspTree implementation                */
 /****************************************************************/
 
-BSPTree::BSPTree(ViewCell *cell) 
+BspTree::BspTree(ViewCell *cell) 
 {
 	mRootCell = cell;
-	mRoot = new BSPLeaf(mRootCell);
+	mRoot = new BspLeaf(mRootCell);
 }
 
   
-void BSPTree::Subdivide()
+void BspTree::Subdivide()
 {
-	BSPNode *currentNode = mRoot;
+	BspNode *currentNode = mRoot;
   
-	std::stack<BSPTraversalData> tStack;
+	std::stack<BspTraversalData> tStack;
 	//  stack<STraversalData> tStack;
 
@@ -77,5 +77,5 @@
 	while (!tStack.empty()) 
 	{
-	    BSPTraversalData data = tStack.top();
+	    BspTraversalData data = tStack.top();
 	    tStack.pop();
     
@@ -83,5 +83,5 @@
 		Mesh frontPolys;
 
-		BSPNode *node = SubdivideNode(dynamic_cast<BSPLeaf *>(data.mNode),
+		BspNode *node = SubdivideNode(dynamic_cast<BspLeaf *>(data.mNode),
 									  data.mParent,
 									  &data.mViewCell,
@@ -92,21 +92,21 @@
 		if (!node->IsLeaf())
 		{
-			BSPInterior *interior = dynamic_cast<BSPInterior *>(node);
+			BspInterior *interior = dynamic_cast<BspInterior *>(node);
 
 			// push the children on the stack
 			if (interior->GetBack())
-				tStack.push(BSPTraversalData(interior->GetBack(), interior, backPolys, data.mDepth+1));
+				tStack.push(BspTraversalData(interior->GetBack(), interior, backPolys, data.mDepth+1));
 			if (interior->GetFront())
-				tStack.push(BSPTraversalData(interior->GetFront(), interior, frontPolys, data.mDepth+1));
+				tStack.push(BspTraversalData(interior->GetFront(), interior, frontPolys, data.mDepth+1));
 		}
 	}
 }
 
-Plane3 *BSPTree::SelectPlane(Mesh *viewcell)
+Plane3 *BspTree::SelectPlane(Mesh *viewcell)
 {
 	return &viewcell->GetFacePlane(0);
 }
 
-BSPNode *BSPTree::SubdivideNode(BSPLeaf *leaf, BSPInterior *parent, 
+BspNode *BspTree::SubdivideNode(BspLeaf *leaf, BspInterior *parent, 
 								Mesh *viewCell, const int depth, 
 								Mesh &frontPolys, Mesh &backPolys)
@@ -119,5 +119,5 @@
 	// add the new nodes to the tree + select subdivision plane
 	Plane3 *plane = SelectPlane(viewCell);
-	BSPInterior *node = new BSPInterior(*plane); // ERROR!!
+	BspInterior *node = new BspInterior(*plane); // ERROR!!
   
 
@@ -128,6 +128,6 @@
 	}
   
-	BSPLeaf *back = new BSPLeaf(mRootCell);
-	BSPLeaf *front = new BSPLeaf(mRootCell);
+	BspLeaf *back = new BspLeaf(mRootCell);
+	BspLeaf *front = new BspLeaf(mRootCell);
 
 	// replace a link from node's parent
