Index: trunk/src/lib/graphics/importer/bsp/bsp_file.cc
===================================================================
--- trunk/src/lib/graphics/importer/bsp/bsp_file.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/bsp/bsp_file.cc	(revision 10314)
@@ -430,5 +430,4 @@
   char fileName [500];
   char ext [500];
-  struct stat results;
 
 
@@ -660,7 +659,7 @@
   int      errorCode = 0;           //!< the error code for the texture loading functions
   unsigned int   lightMap;          //!< the OpenGL texture handle
-  int      mipmapLevel = 0;         //!< the maximum mipmap level for this texture
-  int      mipmapWidth = 0;         //!< the width of the mipmap
-  int      mipmapHight = 0;         //!< the height of the mipmap3
+  //int      mipmapLevel = 0;         //!< the maximum mipmap level for this texture
+  //int      mipmapWidth = 0;         //!< the width of the mipmap
+  //int      mipmapHight = 0;         //!< the height of the mipmap3
   float sc, scale, temp;
   for(int i = 0; i < 128*128*3 ; i++)
@@ -1101,7 +1100,7 @@
   {
     int sto  =  array[0];
-    array[0] =  scale * array[1] ;
-    array[1] =  scale * array[2];
-    array[2] =  scale * sto ;
+    array[0] =  (int) scale * array[1] ;
+    array[1] =  (int) scale * array[2];
+    array[2] =  (int) scale * sto ;
   }
 
Index: trunk/src/lib/graphics/importer/bsp/bsp_manager.cc
===================================================================
--- trunk/src/lib/graphics/importer/bsp/bsp_manager.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/bsp/bsp_manager.cc	(revision 10314)
@@ -298,8 +298,54 @@
   }//else
 
+
+  // now sort the transparent faces in the right order
+  int size = this->trasparent.size();
+
+  // bubble sort
+  bool hasSwapped = true;
+  Vector v1, v2;
+
+  while( hasSwapped)
+  {
+    hasSwapped = false;
+
+    for( int i = 0; i < size - 1; i++)
+    {
+      // sorting test
+      face& fac1 =  (this->bspFile->faces)[this->trasparent[i]];
+      face& fac2 =  (this->bspFile->faces)[this->trasparent[i+1]];
+
+      // get center of face 1
+      const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
+
+      // assign the values of the vertices
+      v1(curVertex[fac1.vertex].position[0], curVertex[fac1.vertex].position[1], curVertex[fac1.vertex].position[2]);
+      v2(curVertex[fac2.vertex].position[0], curVertex[fac2.vertex].position[1], curVertex[fac2.vertex].position[2]);
+      // relativly to observer
+      v1 = this->cam - v1;
+      v2 = this->cam - v2;
+
+      // swap if necessary
+      if( v1 > v2)
+      {
+        // swap elements
+        int tmp = this->trasparent[i+1];
+        this->trasparent[i+1] = this->trasparent[i];
+        this->trasparent[i] = tmp;
+
+        hasSwapped = true;
+      }
+    }
+  }
+
+
+
+  // draw all solid faces
   while(!this->opal.empty()) {
-    this->draw_face(this->opal.front());
-    this->opal.pop_front();
-  }
+    this->draw_face(this->opal.back()); // front()
+    this->opal.pop_back();              // pop_back()
+  }
+
+  // draw all transparent faces
   while(!this->trasparent.empty()) {
     this->draw_face(this->trasparent.back());
Index: trunk/src/lib/graphics/importer/bsp/bsp_manager.h
===================================================================
--- trunk/src/lib/graphics/importer/bsp/bsp_manager.h	(revision 10161)
+++ trunk/src/lib/graphics/importer/bsp/bsp_manager.h	(revision 10314)
@@ -128,6 +128,6 @@
   bool * alreadyVisible;
   // Deques to store the visible faces
-  ::std::deque<int> trasparent; //!< the ones with transparancy go here
-  ::std::deque<int> opal; //!< the others here.
+  ::std::vector<int> trasparent; //!< the ones with transparancy go here
+  ::std::vector<int> opal; //!< the others here.
 
   Vector out;  //!< Stores collision coordinates
Index: trunk/src/lib/graphics/importer/model.cc
===================================================================
--- trunk/src/lib/graphics/importer/model.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/model.cc	(revision 10314)
@@ -17,5 +17,5 @@
 
 #include "model.h"
-
+#include "debug.h"
 #include "glincl.h"
 
@@ -88,2 +88,20 @@
   glEnd();
 }
+
+
+/**
+ * adds a mounting point to the model
+ * @param up up vector
+ * @param forward forward vector
+ * @param center center vector
+ */
+void Model::addMountPoint(const Vector& up, const Vector& forward, const Vector& center, const std::string& name)
+{
+  mountPointSkeleton mps;
+  mps.up = up;
+  mps.forward = forward;
+  mps.center = center;
+  mps.name = name;
+
+  this->mountPoints.push_back(mps);
+}
Index: trunk/src/lib/graphics/importer/model.h
===================================================================
--- trunk/src/lib/graphics/importer/model.h	(revision 10161)
+++ trunk/src/lib/graphics/importer/model.h	(revision 10314)
@@ -52,7 +52,20 @@
 
 
+//! skeleton informations for all mount points
+typedef struct
+{
+  std::string      name;                 //!< the name of the mount point
+  Vector           up;                   //!< the up vector
+  Vector           forward;              //!< the forward vector
+  Vector           center;               //!< the center vector
+} mountPointSkeleton;
+
+
+
 //! This class defines the basic components of a model
 class Model : virtual public BaseObject {
   ObjectListDeclaration(Model);
+
+  typedef std::list<mountPointSkeleton>   mpList;
 
   public:
@@ -85,4 +98,7 @@
     /** function to extract the mount points from the model data */
     virtual void extractMountPoints() {}
+    /** @returns a list of mounting points */
+    inline const mpList& getMountPoints() const { return this->mountPoints; }
+    void addMountPoint(const Vector& up, const Vector& forward, const Vector& center, const std::string& name);
 
 
@@ -92,5 +108,6 @@
 
   protected:
-    modelInfo      pModelInfo;      //!< Reference to the modelInfo
+    modelInfo                        pModelInfo;      //!< Reference to the modelInfo
+    mpList                           mountPoints;     //!< a list of all mounting point skeletons
 };
 
Index: trunk/src/lib/graphics/importer/obj/objModel.cc
===================================================================
--- trunk/src/lib/graphics/importer/obj/objModel.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/obj/objModel.cc	(revision 10314)
@@ -44,6 +44,4 @@
 
   this->finalize();
-
-  this->extractMountPoints();
 }
 
Index: trunk/src/lib/graphics/importer/oif/object_information_file.cc
===================================================================
--- trunk/src/lib/graphics/importer/oif/object_information_file.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/oif/object_information_file.cc	(revision 10314)
@@ -24,4 +24,14 @@
 
 
+
+/**
+ * constructor
+ */
+OIFData::OIFData()
+{
+  this->_root = NULL;
+}
+
+
 /**
  * constructor
@@ -30,5 +40,13 @@
 OIFData::OIFData(const std::string& fileName)
 {
+  this->_root = NULL;
   this->load(fileName);
+}
+
+
+OIFData::~OIFData()
+{
+  if( this->_root)
+    delete this->_root;
 }
 
@@ -40,41 +58,40 @@
 void OIFData::load(const std::string& fileName)
 {
-  //
-    if( fileName.empty())
+  if( fileName.empty())
   {
-    PRINTF(3)("No filename specified for object information loading");
+    PRINTF(1)("No filename specified for object information loading");
     return;
   }
 
-  TiXmlDocument XMLDoc(fileName);
+  TiXmlDocument* XMLDoc = new TiXmlDocument(fileName);
   // load the campaign document
-  if( !XMLDoc.LoadFile(fileName))
+  if( !XMLDoc->LoadFile(fileName))
   {
     // report an error
-    PRINTF(3)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
+    PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     return;
   }
 
   // check basic validity
-  TiXmlElement* root = XMLDoc.RootElement();
-  assert( root != NULL);
+  this->_root = XMLDoc->RootElement();
+  assert( this->_root != NULL);
 
-  if( strcmp( root->Value(), "ObjectInformationFile"))
+  if( strcmp( this->_root->Value(), "ObjectInformationFile"))
   {
     // report an error
-    PRINTF(2)("Specified XML File is not an orxonox object information file (<ObjectInformationFile> element missing)\n");
+    PRINTF(1)("Specified XML File is not an orxonox object information file (<ObjectInformationFile> element missing)\n");
     return;
   }
 
-  // construct campaign
-//   return new Campaign( root);
+//   this->initMountPoint( this->_root);
 }
 
 
-
 /**
- * standard constructor
+ * constructor
+ * @param fileName name of the file
  */
 ObjectInformationFile::ObjectInformationFile()
+  : data(new OIFData)
 {
   this->init();
@@ -107,4 +124,17 @@
 
 /**
+ * the definition of the assignment operator
+ * @param oif
+ * @return
+ */
+ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
+{
+  this->init();
+  this->data = oif.data;
+
+  return *this;
+}
+
+/**
  * initizlizing function
  */
@@ -112,4 +142,10 @@
 {
 
+}
+
+
+void ObjectInformationFile::load(const std::string& fileName)
+{
+  this->data = OIFData::Pointer(new OIFData(fileName));
 }
 
@@ -124,11 +160,12 @@
 
 
+/**
+ * this initializes the mount point
+ * @param mountPoint to be initialized
+ */
+// void ObjectInformationFile::initMountPoint(MountPoint* mountPoint)
+// {
+//   TiXmlElement* root = this->data->root();
+//
+// }
 
-ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
-{
-  this->data = oif.data;
-  return *this;
-}
-
-
-
Index: trunk/src/lib/graphics/importer/oif/object_information_file.h
===================================================================
--- trunk/src/lib/graphics/importer/oif/object_information_file.h	(revision 10161)
+++ trunk/src/lib/graphics/importer/oif/object_information_file.h	(revision 10314)
@@ -20,12 +20,16 @@
 
 public:
+  OIFData();
   OIFData(const std::string& fileName);
-  virtual ~OIFData() {}
+  virtual ~OIFData();
 
   void load(const std::string& fileName);
+  void initMountPoint(const TiXmlElement* root);
+
+  inline const TiXmlElement* root() { return this->_root; }
 
 
 private:
-
+  TiXmlElement* _root;           //!< root of the xml file
 };
 
@@ -40,5 +44,15 @@
   virtual ~ObjectInformationFile();
 
+  void load(const std::string& fileName);
+
   ObjectInformationFile& operator=(const ObjectInformationFile& oif);
+
+  /** @returns a reference to the xml oif file */
+  inline const TiXmlElement* getMountPointDescription() { return this->data->root(); }
+
+  inline void acquireData(const OIFData::Pointer& data) { this->data = data; }
+  const OIFData::Pointer& dataPointer() const { return this->data; };
+
+
 
   private:
Index: trunk/src/lib/graphics/importer/oif/resource_oif.cc
===================================================================
--- trunk/src/lib/graphics/importer/oif/resource_oif.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/oif/resource_oif.cc	(revision 10314)
@@ -26,16 +26,17 @@
   Resources::StorePointer* ptr = this->acquireResource(fileName);
 
+
   if (ptr)
   {
-    PRINTF(0)("FOUND OIF: %s\n", fileName.c_str());
-    //this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
+    PRINTF(5)("FOUND OIF: %s\n", fileName.c_str());
+    this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
   }
   else
   {
-    PRINTF(4)("NOT FOUND OIF: %s\n", fileName.c_str());
-//     std::string modelFileName = this->Resource::locateFile(modelName);
-//     //std::string skinFileName = this->Resource::locateFile(skinName);
-//     this->MD2Model::load(modelFileName, skinName, scale);
-//     this->Resource::addResource(new ResourceOIF::OIFResourcePointer(loadString(modelName, skinName, scale), keepLevel, this->MD2Model::dataPointer()));
+    PRINTF(5)("NOT FOUND OIF: %s\n", fileName.c_str());
+    std::string fullName = this->Resource::locateFile(fileName);
+    PRINTF(5)("trying loading of: %s\n", fullName.c_str());
+    this->load(fullName);
+    this->Resource::addResource(new ResourceOIF::OIFResourcePointer(fileName, keepLevel, this->ObjectInformationFile::dataPointer()));
   }
 
Index: trunk/src/lib/graphics/importer/oif/resource_oif.h
===================================================================
--- trunk/src/lib/graphics/importer/oif/resource_oif.h	(revision 10161)
+++ trunk/src/lib/graphics/importer/oif/resource_oif.h	(revision 10314)
@@ -15,5 +15,6 @@
 {
 public:
-  ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  ResourceOIF(const std::string& fileName,
+              const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
   static ResourceOIF createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
 
Index: trunk/src/lib/graphics/importer/static_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/static_model.cc	(revision 10161)
+++ trunk/src/lib/graphics/importer/static_model.cc	(revision 10314)
@@ -45,5 +45,5 @@
 
 StaticModel::StaticModel(const StaticModel& staticModel)
-  : data(staticModel.data)
+    : data(staticModel.data)
 {
   this->registerObject(this, StaticModel::_objectList);
@@ -111,66 +111,104 @@
     std::vector<Vector> vertices;
 
-    if( groupName.find("MP.", 0) != std::string::npos)
+    // check if the name has a "MP" prefix or else it won't work
+    if( groupName.find("MP.", 0) == std::string::npos)
+      continue;
+
+
+    PRINTF(5)("Found a MountPoint: %s\n", groupName.c_str());
+
+    StaticModelData::Face triangle[3];
+
+    // now check if it is a mount point identifier
+    if( (*groupIt)._faces.size() != 11)
     {
-      PRINTF(0)("Found a MountPoint: %s\n", groupName.c_str());
-
-      // now check if it is a mount point identifier
-      if( this->data->getGroups().size() != 5) {
-        PRINTF(1)("the face count of %s is wrong, perhaps you missnamed this object or used the wrong mount point object\n", groupName.c_str());
+      PRINTF(1)("the face count of %s is wrong, perhaps you missnamed this object or used the wrong mount point object (got %i faces)\n",
+                groupName.c_str(), (*groupIt)._faces.size());
+    }
+
+    // now iterate through all faces
+    std::vector<StaticModelData::Face>::const_iterator faceIt = (*groupIt)._faces.begin();
+    for( int i = 0; faceIt < (*groupIt)._faces.end(); faceIt++)
+    {
+      if( (*faceIt)._elements.size() == 3)
+      {
+        triangle[i++] = (*faceIt);
       }
-
-      // now extract the direction from the length:
-      std::vector<StaticModelData::Face>::const_iterator faceIt = (*groupIt)._faces.begin();
-      for( ; faceIt < (*groupIt)._faces.end(); faceIt++)
+    }
+
+
+    Vector center;
+    Vector xAxis;
+    Vector yAxis;
+    Vector zAxis;
+    // now process all points
+    for( int i = 0; i < 3; i++)
+    {
+      // convert the float vertices to vectors
+      Vector a( this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3],
+                this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 1],
+                this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 2]);
+      Vector b( this->data->getVertices()[triangle[i]._elements[1].vertexNumber * 3],
+                this->data->getVertices()[triangle[i]._elements[1].vertexNumber * 3 + 1],
+                this->data->getVertices()[triangle[i]._elements[1].vertexNumber * 3 + 2]);
+      Vector c( this->data->getVertices()[triangle[i]._elements[2].vertexNumber * 3],
+                this->data->getVertices()[triangle[i]._elements[2].vertexNumber * 3 + 1],
+                this->data->getVertices()[triangle[i]._elements[2].vertexNumber * 3 + 2]);
+
+      Vector ab = a - b;
+      Vector ac = a - c;
+      Vector bc = b - c;
+
+      Vector  axis1;
+      Vector  axis2;
+      // now find the center point (the one with the 90degree angle)
+      if( fabs(ab.dot( ac)) < 0.0001)
       {
-        // now go through all modelfaceelements
-        std::vector<StaticModelData::FaceElement>::const_iterator faceElementIt = (*faceIt)._elements.begin();
-        for( ; faceElementIt < (*faceIt)._elements.end(); faceElementIt++)
-        {
-          int vert = (*faceElementIt).vertexNumber;
-          vertices.push_back(Vector(this->data->getVertices()[vert*3],
-                             this->data->getVertices()[vert*3 + 1],
-                             this->data->getVertices()[vert*3 + 2]));
-        }
+        center = a;
+        axis1 = b - a;
+        axis2 = c - a;
       }
-
-      // vertex with the max count is the up-point
-      std::vector<Vector>::const_iterator it = vertices.begin();
-      Vector tmpPoint;
-      int tmpCount;
-      Vector upPoint;
-      int maxCount = 0;
-      for( ; it < vertices.end(); it++)
+      else if( fabs(ab.dot(bc)) < 0.0001)
       {
-        tmpCount = 0;
-        tmpPoint = (*it);
-        //
-        std::vector<Vector>::const_iterator it2 = vertices.begin();
-        for( ; it2 < vertices.end(); it2++)
-          if( tmpPoint == *it2)
-            tmpCount++;
-
-        // if this is the vertex with the most surrounding vertices
-        if( tmpCount > maxCount)
-        {
-          upPoint = tmpPoint;
-          maxCount = tmpCount;
-        }
+        center = b;
+        axis1 = a - b;
+        axis2 = c - b;
       }
-
-      // now get the center of the object
-      Vector center;
-      it = vertices.begin();
-      for( ; it < vertices.end(); it++)
-        center += (*it);
-      // scale
-      center /= vertices.size();
-
-
+      else if( fabs(bc.dot(ac)) < 0.0001)
+      {
+        center = c;
+        axis1 = b - c;
+        axis2 = a - c;
+      }
+
+
+      // get the longest axis (without defining a max() funciton :D
+      if( xAxis.len() < axis1.len() )
+        xAxis = axis1;
+      if( xAxis.len() < axis2.len())
+        xAxis = axis2;
+
+
+      // find the 2nd longest axis to be y-axis
+      if( xAxis.len() > axis1.len() && yAxis.len() < axis1.len())
+        yAxis = axis1;
+      if( xAxis.len() > axis2.len() && yAxis.len() < axis2.len())
+        yAxis = axis2;
+
+
+      // needed... no explanation here..
+      if( zAxis.len() == 0.)
+        zAxis = yAxis;
+
+      // find the shortest axis to be z-axis
+      if( yAxis.len() > axis1.len() )
+        zAxis = axis1;
+      if( yAxis.len() > axis2.len() )
+        zAxis = axis2;
     }
 
+    // now add the mount point
+     this->addMountPoint( zAxis, yAxis, center, groupName);
   }
-
-
 }
 
Index: trunk/src/lib/graphics/importer/static_model.h
===================================================================
--- trunk/src/lib/graphics/importer/static_model.h	(revision 10161)
+++ trunk/src/lib/graphics/importer/static_model.h	(revision 10314)
@@ -58,5 +58,5 @@
 
   void finalize();
-  void extractMountPoints();
+  virtual void extractMountPoints();
 
   void acquireData(const StaticModelData::Pointer& data);
@@ -71,4 +71,6 @@
 private:
   void updateBase();
+
+
 private:
   StaticModelData::Pointer         data;
Index: trunk/src/lib/math/vector.h
===================================================================
--- trunk/src/lib/math/vector.h	(revision 10161)
+++ trunk/src/lib/math/vector.h	(revision 10314)
@@ -47,4 +47,7 @@
   /** @param v: the Vecor to compare with this one @returns true, if the Vecors are different, false otherwise */
   inline bool operator!= (const Vector& v) const { return (this->x!=v.x||this->y!=v.y||this->z!=v.z)?true:false; };
+  inline bool operator> (const Vector& v) const  { return (this->len() > v.len()); }
+  inline bool operator< (const Vector& v) const  { return (this->len() < v.len()); }
+
   /** @param index The index of the "array" @returns the x/y/z coordinate */
   inline float operator[] (float index) const {if( index == 0) return this->x; if( index == 1) return this->y; if( index == 2) return this->z; }
@@ -82,4 +85,11 @@
   inline const Vector& operator= (const sVec3D& v) { this->x = v[0]; this->y = v[1]; this->z = v[2]; return *this; }
   inline const Vector& operator= (const float* v) { this->x = v[0]; this->y = v[1]; this->z = v[2]; return *this; }
+
+  /** this operator can be used to assign values to the vector */
+  inline void operator() (float x, float y, float z) { this->x = x; this->y = y; this->z = z;}
+
+
+
+
   /** @param v: the other vector \return the dot product of the vectors */
   float dot (const Vector& v) const { return x*v.x+y*v.y+z*v.z; };
