Index: trunk/src/lib/collision_detection/bv_tree.h
===================================================================
--- trunk/src/lib/collision_detection/bv_tree.h	(revision 5678)
+++ trunk/src/lib/collision_detection/bv_tree.h	(revision 5684)
@@ -40,4 +40,5 @@
 
   virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length) = 0;
+  virtual void spawnBVTree(int depth, const modelInfo& modInfo) = 0;
   virtual void flushTree() = 0;
 
Index: trunk/src/lib/collision_detection/bv_tree_node.h
===================================================================
--- trunk/src/lib/collision_detection/bv_tree_node.h	(revision 5678)
+++ trunk/src/lib/collision_detection/bv_tree_node.h	(revision 5684)
@@ -27,4 +27,5 @@
 
   virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length ) = 0;
+  virtual void spawnBVTree(const int depth, const modelInfo& modInfo) = 0;
 
   virtual BoundingVolume* getBV(int index) const = 0;
Index: trunk/src/lib/collision_detection/obb_tree.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree.cc	(revision 5678)
+++ trunk/src/lib/collision_detection/obb_tree.cc	(revision 5684)
@@ -42,4 +42,10 @@
 }
 
+OBBTree::OBBTree(int depth, const modelInfo& modInfo)
+{
+  this->init();
+  this->spawnBVTree(depth, modInfo);
+}
+
 
 
@@ -74,4 +80,18 @@
   this->rootNode->setTreeRef(this);
   this->rootNode->spawnBVTree(--depth, verticesList, length);
+}
+
+
+void OBBTree::spawnBVTree(int depth, const modelInfo& modInfo)
+{
+  if( unlikely(this->rootNode != NULL))
+  {
+    PRINTF(2)("The BVTree has already been spawned, flushing and respawning again...\n");
+    this->flushTree();
+  }
+  OBBTreeNode* node = new OBBTreeNode();
+  this->rootNode = node;
+  this->rootNode->setTreeRef(this);
+  this->rootNode->spawnBVTree(--depth, modInfo);
 }
 
Index: trunk/src/lib/collision_detection/obb_tree.h
===================================================================
--- trunk/src/lib/collision_detection/obb_tree.h	(revision 5678)
+++ trunk/src/lib/collision_detection/obb_tree.h	(revision 5684)
@@ -22,8 +22,10 @@
     OBBTree();
     OBBTree(int depth, sVec3D *verticesList, const int length);
+    OBBTree(int depth, const modelInfo& modInfo);
     virtual ~OBBTree();
     void init();
 
     virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length);
+    virtual void spawnBVTree(int depth, const modelInfo& modInfo);
     virtual void flushTree();
 
Index: trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 5678)
+++ trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 5684)
@@ -96,4 +96,68 @@
 
 
+/**
+ *  creates a new BVTree or BVTree partition
+ * @param depth: how much more depth-steps to go: if == 1 don't go any deeper!
+ * @param modInfo: model informations from the abstrac model
+ * 
+ * this function creates the Bounding Volume tree from a modelInfo struct and bases its calculations
+ * on the triangle informations (triangle soup not polygon soup)
+ */
+void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modInfo)
+{
+  int length = 0;
+  sVec3D* verticesList;
+  
+  PRINT(3)("\n");
+  this->treeIndex = this->obbTree->getID();
+  PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length);
+  this->depth = depth;
+
+
+  this->bvElement = new OBB();
+  this->bvElement->vertices = verticesList;
+  this->bvElement->numOfVertices = length;
+  PRINTF(3)("Created OBBox\n");
+  this->calculateBoxCovariance(this->bvElement, modInfo);
+  PRINTF(3)("Calculated attributes1\n");
+  this->calculateBoxEigenvectors(this->bvElement, modInfo);
+  PRINTF(3)("Calculated attributes2\n");
+  this->calculateBoxAxis(this->bvElement,modInfo);
+  PRINTF(3)("Calculated attributes3\n");
+
+  /* if this is the first node, the vertices data are the original ones of the model itself, so dont delete them in cleanup */
+  if( this->treeIndex == 1)
+    this->bvElement->bOrigVertices = true;
+
+  if( likely( this->depth > 0))
+  {
+    this->forkBox(this->bvElement);
+
+
+//     if(this->tmpLen1 > 2)
+//     {
+//       OBBTreeNode* node1 = new OBBTreeNode();
+//       this->nodeLeft = node1;
+//       this->nodeLeft->spawnBVTree(depth - 1, this->tmpVert1, this->tmpLen1);
+//     }
+//     else
+//     {
+//       PRINTF(3)("Aboarding tree walk: less than 3 vertices left\n");
+//     }
+// 
+//     if( this->tmpLen2 > 2)
+//     {
+//       OBBTreeNode* node2 = new OBBTreeNode();
+//       this->nodeRight = node2;
+//       this->nodeRight->spawnBVTree(depth - 1, this->tmpVert2, this->tmpLen2);
+//     }
+//     else
+//     {
+//       PRINTF(3)("Abording tree walk: less than 3 vertices left\n");
+//     }
+
+  }
+}
+
 
 /**
@@ -101,4 +165,6 @@
  * @param depth: how much more depth-steps to go: if == 1 don't go any deeper!
  * @param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle
+ * 
+ * this function creates an Bounding Volume tree from a vertices soup (no triangle data)
  */
 void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
@@ -151,8 +217,10 @@
       PRINTF(3)("Abording tree walk: less than 3 vertices left\n");
     }
-
-  }
-}
-
+  }
+}
+
+
+void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo)
+{}
 
 
@@ -346,4 +414,6 @@
 
 
+void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo)
+{}
 
 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length)
@@ -394,4 +464,8 @@
 //   PRINTF(0)("eigenvector: %f, %f, %f\n", box->axis[2].x, box->axis[2].y, box->axis[2].z);
 }
+
+
+void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo)
+{}
 
 
Index: trunk/src/lib/collision_detection/obb_tree_node.h
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.h	(revision 5678)
+++ trunk/src/lib/collision_detection/obb_tree_node.h	(revision 5684)
@@ -29,4 +29,5 @@
 
     virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);
+    virtual void spawnBVTree(const int depth, const modelInfo& modInfo);
 
     BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }
@@ -44,4 +45,10 @@
     void calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length);
     void calculateBoxAxis(OBB* box, sVec3D* verticesList, int length);
+    
+    void calculateBoxCovariance(OBB* box, const modelInfo& modInfo);
+    void calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo);
+    void calculateBoxAxis(OBB* box, const modelInfo& modInfo);
+
+    
     void forkBox(OBB* box);
 
