Index: /branches/bsp_model/src/lib/graphics/importer/Makefile.am
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/Makefile.am	(revision 8087)
+++ /branches/bsp_model/src/lib/graphics/importer/Makefile.am	(revision 8088)
@@ -19,5 +19,7 @@
                            \
                            bsp_manager.cc \
-                           bsp_file.cc
+                           bsp_file.cc \
+                           bsp_tree_node.cc \
+                           bsp_tree_leaf.cc
 
 
@@ -45,3 +47,5 @@
 		\
 		bsp_manager.h \
-		bsp_file.h
+		bsp_file.h \
+		bsp_tree_node.h \
+		bsp_tree_leaf.h
Index: /branches/bsp_model/src/lib/graphics/importer/bsp_file.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/bsp_file.cc	(revision 8087)
+++ /branches/bsp_model/src/lib/graphics/importer/bsp_file.cc	(revision 8088)
@@ -1,15 +1,15 @@
 /*
    orxonox - the future of 3D-vertical-scrollers
- 
+
    Copyright (C) 2006 orx
- 
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
- 
+
    ### File Specific:
    main-programmer: bottac@ee.ethz.ch
-   
+
    Inspired by:
    Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
@@ -18,7 +18,9 @@
 */
 
+
 #include "bsp_file.h"
 #include "bsp_tree_node.h"
 #include <fstream>
+#include "file.h"
 #include <sys/stat.h>
 #include <string.h>
@@ -233,18 +235,18 @@
       PRINTF(4)("BSP FILE: Texture 0: %s. \n", &this->textures[8+ 72*i]);
     this->load_textures();
-    
+
     // Load the lightMaps
     this->glLightMapTextures = new GLuint[this->numLightMaps];
     for(int i = 0; i < this->numLightMaps; i++)
       this->glLightMapTextures[i] = this->loadLightMapToGL(this->lightMaps[i]);
-    
+
     //Create white texture for if no lightmap specified
     glGenTextures(1, &this->whiteLightMap);
     glBindTexture(GL_TEXTURE_2D, this->whiteLightMap);
-	//Create texture
+        //Create texture
     this->whiteTexture[0]=255;
     this->whiteTexture[1]=255;
     this->whiteTexture[2]=255;
-    
+
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
@@ -255,5 +257,5 @@
 
 
-  
+
     /* control the mipmap levels */
     glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);
@@ -271,8 +273,8 @@
                  (const GLvoid *)&(this->whiteTexture));
 
-   gluBuild2DMipmaps(	GL_TEXTURE_2D, GL_RGBA8, 1, 1,
+   gluBuild2DMipmaps(   GL_TEXTURE_2D, GL_RGBA8, 1, 1,
                       GL_RGB, GL_UNSIGNED_BYTE,(const GLvoid *) &(this->whiteTexture));
-    
-    
+
+
 
     // Get the number of patches
@@ -294,7 +296,7 @@
 
     PRINTF(0)("BSP FILE:NumberOfPatches: %i . \n", numPatches);
-    
+
     this->swapAllBspCoordinates();
-    
+
     // Do tesselation for all Faces of type 2
     for( int i = 0; i < this->numFaces; i++) {
@@ -310,6 +312,6 @@
     return -1;
   }
-  
-  
+
+
 
 }
@@ -343,5 +345,5 @@
   float z1 =(((plane *) this->planes) [planeIndex]).z;
   thisNode->leafIndex = 0;
-  thisNode->d	       = (((plane *) this->planes) [planeIndex]).d;
+  thisNode->d          = (((plane *) this->planes) [planeIndex]).d;
 
   thisNode->plane = Vector(x1,y1,z1);
@@ -389,15 +391,15 @@
   char ext [100];
   struct stat results;
- 
- 
+
+
   this->Materials = new AMat[this->numTextures];
   for(int i = 0 ; i < this->numTextures; i++) {
     PRINTF(0)("BSP FILE: Texture : %s. \n", &this->textures[8+ 72*i]);
-    
-    
+
+
     strcpy(fileName, &this->textures[8+ 72*i]);
     if(strlen(fileName) == 0)
     {
-     // 	Default Material
+     //         Default Material
       this->Materials[i].mat = new Material();
     this->Materials[i].mat->setDiffuse(0.1,0.1,1.0);
@@ -412,6 +414,6 @@
     this->Materials[i].animated = false;
      continue;
-    } 
-    
+    }
+
       // Check for mov
     strcpy(fileName, &this->textures[8+ 72*i]);
@@ -421,10 +423,10 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] = this->loadAVI(fileName);
       continue;
     }
-     
+
     // Check for avi
     strcpy(fileName, &this->textures[8+ 72*i]);
@@ -434,10 +436,10 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] = this->loadAVI(fileName);
       continue;
     }
-    
+
        // Check for mpg
     strcpy(fileName, &this->textures[8+ 72*i]);
@@ -447,10 +449,10 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] = this->loadAVI(fileName);
       continue;
     }
-    
+
     // Check for tga
     strcpy(fileName, &this->textures[8+ 72*i]);
@@ -460,5 +462,5 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] = this->loadMat(fileName);
@@ -471,5 +473,5 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)/*stat( absFileName.c_str() , &results) == 0*/) {
+    if(File(absFileName).exists()/*stat( absFileName.c_str() , &results) == 0*/) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] = this->loadMat(fileName);
@@ -481,5 +483,5 @@
     strncat (fileName, ext, strlen(fileName));
     absFileName = ResourceManager::getFullName(fileName);
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] =this->loadMat(fileName);
@@ -493,5 +495,5 @@
     strncat (fileName, ext, strlen(fileName));
     absFileName = ResourceManager::getFullName(fileName);
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] =this->loadMat(fileName);
@@ -499,5 +501,5 @@
     }
 
-   
+
 
     // Check for bmp
@@ -507,5 +509,5 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] =this->loadMat(fileName);
@@ -519,12 +521,12 @@
     absFileName = ResourceManager::getFullName(fileName);
 
-    if(ResourceManager::isFile(absFileName)) {
+    if(File(absFileName).exists()) {
       PRINTF(0)("BSP FILE: gefunden . \n");
       this->Materials[i] = this->loadMat(fileName);
       continue;
     }
-    
-    
-    // 	Default Material
+
+
+    //  Default Material
     this->Materials[i].mat = new Material();
     this->Materials[i].mat->setDiffuse(0.1,0.1,0.1);
@@ -538,5 +540,5 @@
     this->Materials[i].alpha = true;
     this->Materials[i].animated = false;
-    
+
   }
 }
@@ -551,5 +553,5 @@
   if(this->testSurf != NULL) {
     if(this->testSurf->format->Amask != 0 ) tmpAMat.alpha = true;
-    else 				       tmpAMat.alpha = false;
+    else                                       tmpAMat.alpha = false;
   } else   tmpAMat.alpha = false;
 
@@ -558,6 +560,6 @@
    tmp->setAmbient(1.0,1.0,1.0 );
   tmp->setSpecular(1.0,1.0,1.0);
-  //	tmp->setShininess(.5);
-  //	tmp->setTransparency(0.0);
+  //    tmp->setShininess(.5);
+  //    tmp->setTransparency(0.0);
 
   tmp->setDiffuseMap(mat);
@@ -580,6 +582,6 @@
   //tmp->setAmbient(1.0,1.0,1.0 );
   //tmp->setSpecular(1.0,1.0,1.0);
-  //	tmp->setShininess(.5);tmpAMat
-  //	tmp->setTransparency(0.0);
+  //    tmp->setShininess(.5);tmpAMat
+  //    tmp->setTransparency(0.0);
 
   //tmp->setDiffuseMap(mat);
@@ -608,9 +610,9 @@
   sc*=scale;
   if(false)
-    ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc + 75; 
+    ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc + 75;
   else
     ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc ;
   }
-  
+
   glGenTextures(1, &lightMap);
   glBindTexture(GL_TEXTURE_2D,  lightMap);
@@ -638,5 +640,5 @@
                    (const GLvoid *)&lightMapTexture);
 
-   
+
    // build the MipMaps automaticaly
    errorCode = gluBuild2DMipmaps(GL_TEXTURE_2D,
@@ -648,5 +650,5 @@
                                  (const GLvoid *)&lightMapTexture
                                 );
-   
+
 
 
@@ -658,9 +660,9 @@
 /**
  * Generates a vertex-array, a indice-array and a texture-coordinates-array for iface.
- * @param iface integer index of face 
+ * @param iface integer index of face
  * @todo cleanup this function, let the user choose the level of tesselation
  */
- 
- 
+
+
 void BspFile::tesselate(int iface)
 {
@@ -791,5 +793,5 @@
 
 
-          //Vertice[u*(tesselation+1)+v]=	temp[0]*((1.0f-px)*(1.0f-px))+ temp[1]*((1.0f-px)*px*2)+ temp[2]*(px*px);
+          //Vertice[u*(tesselation+1)+v]=       temp[0]*((1.0f-px)*(1.0f-px))+ temp[1]*((1.0f-px)*px*2)+ temp[2]*(px*px);
           Vertice[u*(level1)+v].position[0]=temp[0].position[0]*((1.0f-px)*(1.0f-px))+temp[1].position[0]*((1.0f-px)*px*2)+temp[2].position[0]*(px*px);
           Vertice[u*(level1)+v].position[1]=temp[0].position[1]*((1.0f-px)*(1.0f-px))+temp[1].position[1]*((1.0f-px)*px*2)+temp[2].position[1]*(px*px);
@@ -826,5 +828,5 @@
       // Debug Model
       //***********************************************************************************************************************
-      
+
       this->VertexArrayModels[this->patchOffset] = new VertexArrayModel();
       VertexArrayModel*  tmp = this->VertexArrayModels[this->patchOffset];
@@ -989,5 +991,5 @@
 void BspFile::swapAllBspCoordinates()
 {
- 
+
   for(int i = 0; i < this->numVertex ; ++i)
   {
@@ -995,14 +997,14 @@
     this->swapCoords(&((BspVertex *)this->vertice)[i].normal[0]);
 
-    
+
   }
-  
+
   for(int i = 0; i < this->numLeafs ; ++i)
   {
     this->swapCoords(this->leaves[i].mins);
     this->swapCoords(this->leaves[i].maxs);
-  
+
   }
-  
+
   for(int i = 0; i < this->numPlanes; ++i)
   {
@@ -1014,10 +1016,10 @@
   }
 
-    
+
   for(int i = 0; i < this->numFaces; ++i)
   {
     this->swapCoords(this->faces[i].normal);
   }
-  
+
 }
 
@@ -1036,7 +1038,7 @@
     array[0] =  scale * array[1] ;
     array[1] =  scale * array[2];
-    array[2] =  scale * sto ; 
+    array[2] =  scale * sto ;
   }
-  
+
 }
 
Index: /branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8087)
+++ /branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8088)
@@ -901,5 +901,5 @@
 
     // Return the normal here: Normal's stored in this->collPlane;
-    if(collision) worldEntity->collidesWithGround(out,out1,out2);
+//    if(collision) worldEntity->collidesWithGround(out,out1,out2);
 
   }
