Index: trunk/lib/FlairSimulator/src/Parser.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Parser.cpp	(revision 87)
+++ trunk/lib/FlairSimulator/src/Parser.cpp	(revision 134)
@@ -18,11 +18,13 @@
 #include "Parser.h"
 #include "Simulator.h"
+#include "FixedCamera.h"
 #include "GenericObject.h"
-#include "FixedCamera.h"
 #include <vector3d.h>
 #include <Vector3D.h>
 #include <IrrlichtDevice.h>
 #include <IFileSystem.h>
-#include "GenericObject.h"
+#include <IAnimatedMesh.h>
+#include <IGeometryCreator.h>
+#include <ISceneManager.h>
 
 using namespace irr;
@@ -108,24 +110,16 @@
 
 void Parser::processObjects(xmlNode *a_node) {
-  FILE *fp;
-  std::string fileName;
-  xmlNode *cur_node = NULL;
-
-  const IGeometryCreator *geo;
-
-  geo = getGui()->getSceneManager()->getGeometryCreator();
+  xmlNode *cur_node = NULL;
 
   for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
     if (xmlStrEqual(cur_node->name, (xmlChar *)"mesh")) {
-      fileName = this->media_path;
+			FILE *fp;
+			std::string fileName = this->media_path+"/";
       fp = NULL;
       fp = fopen(fileName.append((char *)xmlGetProp(
-                                     cur_node, (xmlChar *)"model")).c_str(),
-                 "rb");
+                                     cur_node, (xmlChar *)"model")).c_str(),"rb");
       if (fp != NULL) {
         GenericObject *object =
-            new GenericObject(parent, "Object", getSceneManager());
-        object->setMesh(getGui()->getMesh(
-            (char *)xmlGetProp(cur_node, (xmlChar *)"model")));
+            new GenericObject(parent, getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model")));
         object->setPosition(
             getMeshVect(cur_node->children, (xmlChar *)"position"));
@@ -133,19 +127,30 @@
             getMeshVect(cur_node->children, (xmlChar *)"rotation"));
         object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
-        object->render();
       } else {
-        Err("FATAL ERROR : File %s doesn't exist !\r\n",
-            (char *)xmlGetProp(cur_node, (xmlChar *)"model"));
+        Err("FATAL ERROR : File %s %s doesn't exist !\r\n",
+            (char *)xmlGetProp(cur_node, (xmlChar *)"model"),fileName.c_str());
       }
     } else if (xmlStrEqual(cur_node->name, (xmlChar *)"cylinder")) {
+			const IGeometryCreator *geo;
+			geo = getGui()->getSceneManager()->getGeometryCreator();
+			IMesh* mesh=geo->createCylinderMesh(
+          ToIrrlichtScale(atof((char *)xmlGetProp(cur_node, (xmlChar *)"radius"))),
+          ToIrrlichtScale(atof((char *)xmlGetProp(cur_node, (xmlChar *)"length"))),
+          atof((char *)xmlGetProp(cur_node, (xmlChar *)"tesselation")),
+          SColor(100, 255, 100, 100));
+      GenericObject *object = new GenericObject(parent, mesh);
+      object->setPosition(getMeshVect(cur_node->children, (xmlChar *)"position"));
+      object->setRotation(getMeshVect(cur_node->children, (xmlChar *)"rotation"));
+      object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
+    } else if (xmlStrEqual(cur_node->name, (xmlChar *)"eight")) {
+			const IGeometryCreator *geo;
+			geo = getGui()->getSceneManager()->getGeometryCreator();
+			IMesh* mesh=geo->createCubeMesh(
+          vector3df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"length")),
+                    atof((char *)xmlGetProp(cur_node, (xmlChar *)"width")),
+                    atof((char *)xmlGetProp(cur_node, (xmlChar *)"eight"))));
+			
       GenericObject *object =
-          new GenericObject(parent, "Object", getSceneManager());
-      object->setMesh(geo->createCylinderMesh(
-          ToIrrlichtScale(
-              atof((char *)xmlGetProp(cur_node, (xmlChar *)"radius"))),
-          ToIrrlichtScale(
-              atof((char *)xmlGetProp(cur_node, (xmlChar *)"length"))),
-          atof((char *)xmlGetProp(cur_node, (xmlChar *)"tesselation")),
-          SColor(100, 255, 100, 100)));
+          new GenericObject(parent, mesh);
       object->setPosition(
           getMeshVect(cur_node->children, (xmlChar *)"position"));
@@ -153,24 +158,4 @@
           getMeshVect(cur_node->children, (xmlChar *)"rotation"));
       object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
-      // object->setMaterialTexture(0,getTexture("/home/apeiron/igep/uav_dev_svn/trunk/media/nskinbl.jpg"));
-      object->setMaterialType(video::EMT_SOLID);
-      object->render();
-    } else if (xmlStrEqual(cur_node->name, (xmlChar *)"eight")) {
-      GenericObject *object =
-          new GenericObject(parent, "Object", getSceneManager());
-      object->setMesh(geo->createCubeMesh(
-          vector3df(atof((char *)xmlGetProp(cur_node, (xmlChar *)"length")),
-                    atof((char *)xmlGetProp(cur_node, (xmlChar *)"width")),
-                    atof((char *)xmlGetProp(cur_node, (xmlChar *)"eight")))));
-      object->setPosition(
-          getMeshVect(cur_node->children, (xmlChar *)"position"));
-      object->setRotation(
-          getMeshVect(cur_node->children, (xmlChar *)"rotation"));
-      object->setScale(getMeshVect(cur_node->children, (xmlChar *)"scale"));
-      object->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
-      // object->getMaterial(0).Textures[0] =
-      // getTexture("/home/apeiron/igep/uav_dev_svn/trunk/media/nskinbl.jpg");
-      object->setMaterialFlag(EMF_LIGHTING, false);
-      object->render();
     }
   }
