Index: orxonox/trunk/src/object.cc
===================================================================
--- orxonox/trunk/src/object.cc	(revision 3185)
+++ orxonox/trunk/src/object.cc	(revision 3193)
@@ -20,6 +20,7 @@
 
 /**
-   \brief Creates a 3D-Object, but does not load any 3D-models
-   pretty useless
+   \brief Creates a 3D-Object, but does not load any 3D-models.
+
+   This Constructor is pretty useless, because why load no object in an object-loader??
 */
 Object::Object ()
@@ -36,5 +37,5 @@
 
 /**
-   \brief Crates a 3D-Object and loads in a File
+   \brief Crates a 3D-Object and loads in a File.
    \param fileName file to parse and load (must be a .obj file)
 */
@@ -68,5 +69,7 @@
 
 /**
-   \brief deletes an Object
+   \brief deletes an Object.
+
+   Looks if any from object allocated space is still in use, and if so deleted it.
 */
 Object::~Object()
@@ -117,6 +120,7 @@
 /**
    \brief Draws the Object number groupNumber
+   \param groupNumber The number of the group that will be displayed.
+
    It does this by just calling the List that must have been created earlier.
-   \param groupNumber The number of the group that will be displayed.
 */
 void Object::draw (int groupNumber) const 
@@ -152,6 +156,7 @@
 /**
    \brief Draws the Object with a specific groupName
+   \param groupName The name of the group that will be displayed.
+
    It does this by just calling the List that must have been created earlier.
-   \param groupName The name of the group that will be displayed.
 */
 void Object::draw (char* groupName) const
@@ -185,6 +190,8 @@
 
 /**
-    \brief initializes the Object
-    This Function initializes all the needed arrays, Lists and clientStates
+    \brief initializes the Object.
+
+    This Function initializes all the needed arrays, Lists and clientStates.
+    It also defines default values.
 */
 bool Object::initialize (void)
@@ -214,4 +221,7 @@
 /**
    \brief initializes a new Group object
+   \param group the group that should be initialized.
+   \todo Maybe Group should be a Class, because it does a lot of stuff
+   
 */
 bool Object::initGroup(Group* group)
@@ -231,4 +241,5 @@
 /**
    \brief initializes a new Face. (sets default Values)
+   \param face The face to initialize
 */
 bool Object::initFace (Face* face)
@@ -285,6 +296,6 @@
 
 /**
-   \brief Cleans up all Faces starting from face.
-   \param face the first face to clean
+   \brief Cleans up all Faces starting from face until NULL is reached.
+   \param face the first face to clean.
 */
 bool Object::cleanupFace (Face* face)
@@ -386,4 +397,5 @@
       BoxObject();
       delete []fileName;
+      OBJ_FILE->close();
       return false;
     }
@@ -450,7 +462,8 @@
 /**
    \brief parses a group String
+   \param groupString the new Group to create
+
    This function initializes a new Group. 
    With it you should be able to import .obj-files with more than one Objects inside. 
-   \param groupString the new Group to create
 */
 bool Object::readGroup (char* groupString)
@@ -476,6 +489,7 @@
 /**
    \brief parses a vertex-String
+   \param vertexString The String that will be parsed.
+
    If a vertex line is found this function will inject it into the vertex-Array
-   \param vertexString The String that will be parsed.
 */
 bool Object::readVertex (char* vertexString)
@@ -493,7 +507,8 @@
 /**
    \brief parses a face-string
+   \param faceString The String that will be parsed.
+
    If a face line is found this function will add it to the glList.
    The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe.
-   \param faceString The String that will be parsed.
 */
 bool Object::readFace (char* faceString)
@@ -556,6 +571,7 @@
 /**
    \brief parses a vertexNormal-String
+   \param normalString The String that will be parsed.
+
    If a vertexNormal line is found this function will inject it into the vertexNormal-Array
-   \param normalString The String that will be parsed.
 */
 bool Object::readVertexNormal (char* normalString)
@@ -573,6 +589,8 @@
 /**
    \brief parses a vertexTextureCoordinate-String
-   If a vertexTextureCoordinate line is found this function will inject it into the vertexTexture-Array
    \param vTextureString The String that will be parsed.
+
+   If a vertexTextureCoordinate line is found,
+   this function will inject it into the vertexTexture-Array
 */
 bool Object::readVertexTexture (char* vTextureString)
@@ -590,6 +608,10 @@
 /** 
     \brief Function to read in a mtl File.
-    this Function parses all Lines of an mtl File
     \param mtlFile The .mtl file to read
+
+    This Function parses all Lines of an mtl File.
+    The reason for it not to be in the materials-class is,
+    that a material does not have to be able to read itself in from a File.
+
 */
 bool Object::readMtlLib (char* mtlFile)
@@ -611,4 +633,5 @@
 	printf ("unable to open file: %s\n", fileName);
       delete []fileName;
+      MTL_FILE->close();
       return false;
     }
@@ -809,4 +832,6 @@
 /**
    \brief Adds a Face-element (one vertex of a face) with all its information. 
+   \param elem The FaceElement to add to the OpenGL-environment.
+
    It does this by searching:
    1. The Vertex itself
@@ -814,5 +839,4 @@
    3. The VertexTextureCoordinate
    merging this information, the face will be drawn.
-
 */
 bool Object::addGLElement (FaceElement* elem)
@@ -832,4 +856,5 @@
 /**
    \brief A routine that is able to create normals.
+
    The algorithm does the following:
    1. It calculates creates Vectors for each normale, and sets them to zero.
@@ -912,56 +937,57 @@
 /**
    \brief Includes a default object
+
    This will inject a Cube, because this is the most basic object.
 */
 void Object::BoxObject(void)
 {
-  readVertex ("-0.500000 -0.500000 0.500000");
-  readVertex ("0.500000 -0.500000 0.500000");
-  readVertex ("-0.500000 0.500000 0.500000");
-  readVertex ("0.500000 0.500000 0.500000");
-  readVertex ("-0.500000 0.500000 -0.500000");
-  readVertex ("0.500000 0.500000 -0.500000");
-  readVertex ("-0.500000 -0.500000 -0.500000");
-  readVertex ("0.500000 -0.500000 -0.500000");
-
-  readVertexTexture ("0.000000 0.000000");
-  readVertexTexture ("1.000000 0.000000");
-  readVertexTexture ("0.000000 1.000000");
-  readVertexTexture ("1.000000 1.000000");
-  readVertexTexture ("0.000000 2.000000");
-  readVertexTexture ("1.000000 2.000000");
-  readVertexTexture ("0.000000 3.000000");
-  readVertexTexture ("1.000000 3.000000");
-  readVertexTexture ("0.000000 4.000000");
-  readVertexTexture ("1.000000 4.000000");
-  readVertexTexture ("2.000000 0.000000");
-  readVertexTexture ("2.000000 1.000000");
-  readVertexTexture ("-1.000000 0.000000");
-  readVertexTexture ("-1.000000 1.000000");
-
-  readVertexNormal ("0.000000 0.000000 1.000000");
-  readVertexNormal ("0.000000 0.000000 1.000000");
-  readVertexNormal ("0.000000 0.000000 1.000000");
-  readVertexNormal ("0.000000 0.000000 1.000000");
-  readVertexNormal ("0.000000 1.000000 0.000000");
-  readVertexNormal ("0.000000 1.000000 0.000000");
-  readVertexNormal ("0.000000 1.000000 0.000000");
-  readVertexNormal ("0.000000 1.000000 0.000000");
-  readVertexNormal ("0.000000 0.000000 -1.000000");
-  readVertexNormal ("0.000000 0.000000 -1.000000");
-  readVertexNormal ("0.000000 0.000000 -1.000000");
-  readVertexNormal ("0.000000 0.000000 -1.000000");
-  readVertexNormal ("0.000000 -1.000000 0.000000");
-  readVertexNormal ("0.000000 -1.000000 0.000000");
-  readVertexNormal ("0.000000 -1.000000 0.000000");
-  readVertexNormal ("0.000000 -1.000000 0.000000");
-  readVertexNormal ("1.000000 0.000000 0.000000");
-  readVertexNormal ("1.000000 0.000000 0.000000");
-  readVertexNormal ("1.000000 0.000000 0.000000");
-  readVertexNormal ("1.000000 0.000000 0.000000");
-  readVertexNormal ("-1.000000 0.000000 0.000000");
-  readVertexNormal ("-1.000000 0.000000 0.000000");
-  readVertexNormal ("-1.000000 0.000000 0.000000");
-  readVertexNormal ("-1.000000 0.000000 0.000000");
+  readVertex ("-0.5 -0.5 0.5");
+  readVertex ("0.5 -0.5 0.5");
+  readVertex ("-0.5 0.5 0.5");
+  readVertex ("0.5 0.5 0.5");
+  readVertex ("-0.5 0.5 -0.5");
+  readVertex ("0.5 0.5 -0.5");
+  readVertex ("-0.5 -0.5 -0.5");
+  readVertex ("0.5 -0.5 -0.5");
+
+  readVertexTexture ("0.0 0.0");
+  readVertexTexture ("1.0 0.0");
+  readVertexTexture ("0.0 1.0");
+  readVertexTexture ("1.0 1.0");
+  readVertexTexture ("0.0 2.0");
+  readVertexTexture ("1.0 2.0");
+  readVertexTexture ("0.0 3.0");
+  readVertexTexture ("1.0 3.0");
+  readVertexTexture ("0.0 4.0");
+  readVertexTexture ("1.0 4.0");
+  readVertexTexture ("2.0 0.0");
+  readVertexTexture ("2.0 1.0");
+  readVertexTexture ("-1.0 0.0");
+  readVertexTexture ("-1.0 1.0");
+
+  readVertexNormal ("0.0 0.0 1.0");
+  readVertexNormal ("0.0 0.0 1.0");
+  readVertexNormal ("0.0 0.0 1.0");
+  readVertexNormal ("0.0 0.0 1.0");
+  readVertexNormal ("0.0 1.0 0.0");
+  readVertexNormal ("0.0 1.0 0.0");
+  readVertexNormal ("0.0 1.0 0.0");
+  readVertexNormal ("0.0 1.0 0.0");
+  readVertexNormal ("0.0 0.0 -1.0");
+  readVertexNormal ("0.0 0.0 -1.0");
+  readVertexNormal ("0.0 0.0 -1.0");
+  readVertexNormal ("0.0 0.0 -1.0");
+  readVertexNormal ("0.0 -1.0 0.0");
+  readVertexNormal ("0.0 -1.0 0.0");
+  readVertexNormal ("0.0 -1.0 0.0");
+  readVertexNormal ("0.0 -1.0 0.0");
+  readVertexNormal ("1.0 0.0 0.0");
+  readVertexNormal ("1.0 0.0 0.0");
+  readVertexNormal ("1.0 0.0 0.0");
+  readVertexNormal ("1.0 0.0 0.0");
+  readVertexNormal ("-1.0 0.0 0.0");
+  readVertexNormal ("-1.0 0.0 0.0");
+  readVertexNormal ("-1.0 0.0 0.0");
+  readVertexNormal ("-1.0 0.0 0.0");
 
   /* normaleLess-testingMode
