Index: trunk/lib/FlairSimulator/src/Castle.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Castle.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/Castle.cpp	(revision 158)
@@ -17,5 +17,4 @@
 
 #include "Castle.h"
-#include "Simulator.h"
 #include <IrrlichtDevice.h>
 #include <IFileSystem.h>
@@ -27,7 +26,7 @@
 namespace simulator {
 
-Castle::Castle(const Simulator *parent, int app_width, int app_height,
+Castle::Castle(int app_width, int app_height,
                int scene_width, int scene_height, std::string media_path)
-    : Gui(parent, "Castle", app_width, app_height, scene_width, scene_height,
+    : Gui("Castle", app_width, app_height, scene_width, scene_height,
           media_path) {
   // carte
Index: trunk/lib/FlairSimulator/src/Castle.h
===================================================================
--- trunk/lib/FlairSimulator/src/Castle.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/Castle.h	(revision 158)
@@ -23,5 +23,5 @@
 class Castle : public Gui {
 public:
-  Castle(const flair::simulator::Simulator *parent, int app_width,
+  Castle(int app_width,
          int app_height, int scene_width, int scene_height,
          std::string media_path);
Index: trunk/lib/FlairSimulator/src/GenericObject.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 158)
@@ -37,5 +37,5 @@
 namespace simulator {
 
-GenericObject::GenericObject(Simulator *parent, IMesh *mesh)
+GenericObject::GenericObject(IMesh *mesh)
 {
 	meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh);
@@ -46,5 +46,5 @@
   meshSceneNode->setMaterialFlag(EMF_LIGHTING, false);
 
-  parent->pimpl_->objects.push_back(this);
+  getSimulator()->pimpl_->objects.push_back(this);
 }
 
Index: trunk/lib/FlairSimulator/src/Gui.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Gui.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/Gui.cpp	(revision 158)
@@ -133,8 +133,8 @@
 }
 
-Gui::Gui(const Simulator *parent, std::string name, int app_width,
+Gui::Gui(std::string name, int app_width,
          int app_height, int scene_width, int scene_height,
          std::string media_path, E_DRIVER_TYPE driver_type)
-    : Object(parent, name, "Gui") {
+    : Object(getSimulator(), name, "Gui") {
   if (gui_ != NULL)
     Err("Gui should be instanced only one time\n");
Index: trunk/lib/FlairSimulator/src/Gui.h
===================================================================
--- trunk/lib/FlairSimulator/src/Gui.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/Gui.h	(revision 158)
@@ -48,5 +48,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
 class Gui: public core::Object {
@@ -55,5 +54,5 @@
 
 public:
-  Gui(const Simulator *parent, std::string name, int app_width, int app_height,
+  Gui(std::string name, int app_width, int app_height,
       int scene_width, int scene_height, std::string media_path,
       irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL);
Index: trunk/lib/FlairSimulator/src/Man.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Man.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/Man.cpp	(revision 158)
@@ -18,6 +18,4 @@
 #include "Man.h"
 #include "Gui.h"
-#include "Simulator.h"
-#include "Simulator_impl.h"
 #include "Euler.h"
 #include <ISceneManager.h>
@@ -38,5 +36,5 @@
 namespace simulator {
 
-Man::Man(const Simulator *parent, std::string name) : Model(parent, name) {
+Man::Man(std::string name,uint32_t modelId) : Model(name,modelId) {
   node = getGui()->getSceneManager()->addAnimatedMeshSceneNode(
       getGui()->getMesh("ninja.b3d"), getSceneNode(), -1, vector3df(0, 0, 0),
Index: trunk/lib/FlairSimulator/src/Man.h
===================================================================
--- trunk/lib/FlairSimulator/src/Man.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/Man.h	(revision 158)
@@ -34,9 +34,8 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
 class Man : private Model {
 public:
-  Man(const Simulator *parent, std::string name);
+  Man(std::string name,uint32_t modelId);
   ~Man();
 
Index: trunk/lib/FlairSimulator/src/Model.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Model.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/Model.cpp	(revision 158)
@@ -18,10 +18,8 @@
 #include "Model_impl.h"
 #include "Simulator.h"
-#include "Simulator_impl.h"
 #include <DoubleSpinBox.h>
 
 #ifdef GL
 #include "FollowMeCamera.h"
-#include "Gui.h"
 #include <ICameraSceneNode.h>
 using namespace irr;
@@ -36,13 +34,7 @@
 namespace simulator {
 
-Model::Model(const Simulator *parent, std::string name)
-    : IODevice(parent, name) {
-#ifdef GL
-  pimpl_ =
-      new Model_impl(this, name, getGui()->getSceneManager(), parent->pimpl_);
-#else
-  pimpl_ = new Model_impl(this, name, parent->pimpl_);
-#endif
-  parent->pimpl_->models.push_back(this);
+Model::Model(std::string name,uint32_t modelId)
+    : IODevice(getSimulator(), name) {
+  pimpl_ = new Model_impl(this, name,modelId);
 }
 
@@ -79,4 +71,8 @@
 float Model::dT(void) const { return pimpl_->dT->Value(); }
 
+int Model::GetId(void) const {
+  return pimpl_->modelId;
+}
+
 } // end namespace simulator
 } // end namespace flair
Index: trunk/lib/FlairSimulator/src/Model.h
===================================================================
--- trunk/lib/FlairSimulator/src/Model.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/Model.h	(revision 158)
@@ -51,5 +51,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 class FollowMeCamera;
 
@@ -65,5 +64,5 @@
 
 public:
-  Model(const Simulator *parent, std::string name);
+  Model(std::string name,uint32_t modelId);
   virtual ~Model();
 
@@ -93,4 +92,5 @@
 #endif
   gui::TabWidget *GetTabWidget(void) const;
+  int GetId(void) const;
 
 protected:
Index: trunk/lib/FlairSimulator/src/Model_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 158)
@@ -18,4 +18,5 @@
 #include "Model_impl.h"
 #include "Simulator.h"
+#include "Simulator_impl.h"
 #include "TabWidget.h"
 #include "Tab.h"
@@ -51,15 +52,15 @@
 
 #ifdef GL
-Model_impl::Model_impl(Model *self, std::string name,
-                       ISceneManager *scenemanager, vrpn_Connection_IP *vrpn)
-    : ISceneNode(scenemanager->getRootSceneNode(), scenemanager, -1),
-      Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)
+Model_impl::Model_impl(Model *self, std::string name,uint32_t modelId)
+    : ISceneNode(getGui()->getSceneManager()->getRootSceneNode(), getGui()->getSceneManager(), -1),
+      Thread(self, name, 50), vrpn_Tracker(name.c_str(), getSimulator()->pimpl_)
 
 #else
-Model_impl::Model_impl(Model *self, std::string name, vrpn_Connection_IP *vrpn)
-    : Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)
+Model_impl::Model_impl(Model *self, std::string name,uint32_t modelId)
+    : Thread(self, name, 50), vrpn_Tracker(name.c_str(), getSimulator()->pimpl_)
 #endif
 {
   this->self = self;
+  this->modelId=modelId;
 
 #ifdef GL
@@ -131,4 +132,6 @@
 
   self->AddDataToLog(output);
+  
+  getSimulator()->pimpl_->models.push_back(self);
 }
 
Index: trunk/lib/FlairSimulator/src/Parser.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Parser.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/Parser.cpp	(revision 158)
@@ -40,11 +40,10 @@
 namespace flair {
 namespace simulator {
-Parser::Parser(Simulator *parent, int app_width, int app_height,
+Parser::Parser(int app_width, int app_height,
                int scene_width, int scene_height, std::string media_path,
                std::string xmlFile)
-    : Gui(parent, "Parser", app_width, app_height, scene_width, scene_height,
+    : Gui("Parser", app_width, app_height, scene_width, scene_height,
           media_path) {
   this->media_path = media_path;
-  this->parent = parent;
   xmlNode *root_element = NULL;
   doc = xmlReadFile(xmlFile.c_str(), NULL, 0);
@@ -121,5 +120,5 @@
       if (fp != NULL) {
         GenericObject *object =
-            new GenericObject(parent, getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model")));
+            new GenericObject(getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model")));
         object->setPosition(
             getMeshVect(cur_node->children, (xmlChar *)"position"));
@@ -140,5 +139,5 @@
           getScolor(cur_node->children));
           //SColor(100, 255, 100, 100));
-      GenericObject *object = new GenericObject(parent, mesh);
+      GenericObject *object = new GenericObject(mesh);
       object->setPosition(getMeshVect(cur_node->children, (xmlChar *)"position"));
       object->setRotation(getMeshVect(cur_node->children, (xmlChar *)"rotation"));
@@ -152,6 +151,5 @@
                     atof((char *)xmlGetProp(cur_node, (xmlChar *)"eight"))));
 			
-      GenericObject *object =
-          new GenericObject(parent, mesh);
+      GenericObject *object =new GenericObject(mesh);
       object->setPosition(
           getMeshVect(cur_node->children, (xmlChar *)"position"));
Index: trunk/lib/FlairSimulator/src/Parser.h
===================================================================
--- trunk/lib/FlairSimulator/src/Parser.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/Parser.h	(revision 158)
@@ -39,5 +39,5 @@
   */
 public:
-  Parser(Simulator *parent, int app_width, int app_height, int scene_width,
+  Parser(int app_width, int app_height, int scene_width,
          int scene_height, std::string media_path, std::string xmlFile);
   ~Parser();
@@ -46,5 +46,4 @@
   xmlDoc *doc;
   std::string media_path;
-  Simulator *parent;
   void processElements(xmlNode *a_node);
   void processObjects(xmlNode *a_node);
Index: trunk/lib/FlairSimulator/src/SimuCameraGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuCameraGL.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/SimuCameraGL.cpp	(revision 158)
@@ -45,10 +45,10 @@
 
 SimuCameraGL::SimuCameraGL(const Model *parent, std::string name, int width,
-                           int height, int x, int y, int dev_id)
-    : SimuCamera(parent, name, width, height, 3, dev_id), SensorGL(parent) {
+                           int height, int x, int y, uint32_t modelId,uint32_t deviceId)
+    : SimuCamera(parent, name, width, height, 3, modelId,deviceId), SensorGL(parent) {
   smgr = getGui()->getSceneManager();
   camera = smgr->addCameraSceneNode();
   camera->addAnimator(this);
-  camera->setAspectRatio(4.0f / 3.0f); // on force a cause du view port
+  camera->setAspectRatio((float)width /(float)height); // on force a cause du view port
 
   this->width = width;
Index: trunk/lib/FlairSimulator/src/SimuCameraGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuCameraGL.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/SimuCameraGL.h	(revision 158)
@@ -51,5 +51,5 @@
   // top left origin
   SimuCameraGL(const simulator::Model *parent, std::string name, int width,
-               int height, int x, int y, int dev_id);
+               int height, int x, int y, uint32_t modelId,uint32_t deviceId);
   ~SimuCameraGL();
   //! Sets the value of the near clipping plane. (default: 1.0f)
Index: trunk/lib/FlairSimulator/src/SimuLaserGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 158)
@@ -38,6 +38,6 @@
 namespace flair {
 namespace sensor {
-SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, int dev_id)
-    : SimuLaser(parent, name, dev_id), SensorGL(parent) {
+SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, uint32_t modelId,uint32_t deviceId)
+    : SimuLaser(parent, name, modelId,deviceId), SensorGL(parent) {
   Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
   position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
Index: trunk/lib/FlairSimulator/src/SimuLaserGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuLaserGL.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/SimuLaserGL.h	(revision 158)
@@ -38,5 +38,5 @@
 class SimuLaserGL : public SimuLaser, public SensorGL {
 public:
-  SimuLaserGL(const simulator::Model *parent, std::string name, int dev_id);
+  SimuLaserGL(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId);
   ~SimuLaserGL();
 
Index: trunk/lib/FlairSimulator/src/SimuUsGL.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 158)
@@ -38,6 +38,6 @@
 namespace flair {
 namespace sensor {
-SimuUsGL::SimuUsGL(const Model *parent, std::string name, int dev_id)
-    : SimuUs(parent, name, dev_id), SensorGL(parent) {
+SimuUsGL::SimuUsGL(const Model *parent, std::string name, uint32_t modelId,uint32_t deviceId)
+    : SimuUs(parent, name, modelId,deviceId), SensorGL(parent) {
   Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
   position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
Index: trunk/lib/FlairSimulator/src/SimuUsGL.h
===================================================================
--- trunk/lib/FlairSimulator/src/SimuUsGL.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/SimuUsGL.h	(revision 158)
@@ -38,5 +38,5 @@
 class SimuUsGL : public SimuUs, public SensorGL {
 public:
-  SimuUsGL(const simulator::Model *parent, std::string name, int dev_id);
+  SimuUsGL(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId);
   ~SimuUsGL();
 
Index: trunk/lib/FlairSimulator/src/Simulator.h
===================================================================
--- trunk/lib/FlairSimulator/src/Simulator.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/Simulator.h	(revision 158)
@@ -22,4 +22,5 @@
 
 class Simulator_impl;
+class Model_impl;
 
 namespace flair {
@@ -36,5 +37,5 @@
 
 class Simulator : public core::FrameworkManager {
-  friend class Model;
+  friend class ::Model_impl;
   friend class Gui;
   friend class GenericObject;
Index: trunk/lib/FlairSimulator/src/X4.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/X4.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/X4.cpp	(revision 158)
@@ -16,5 +16,4 @@
 
 #include "X4.h"
-#include "Simulator.h"
 #include <SimuBldc.h>
 #include <TabWidget.h>
@@ -46,6 +45,6 @@
 namespace simulator {
 
-X4::X4(const Simulator *parent, std::string name, int dev_id)
-    : Model(parent, name) {
+X4::X4(std::string name, uint32_t modelId)
+    : Model(name,modelId) {
   Tab *setup_tab = new Tab(GetTabWidget(), "model");
   m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1);
@@ -75,5 +74,5 @@
                             5); // moment d'inertie d'un axe (N.m.s²/rad)
 
-  motors = new SimuBldc(this, name, 4, dev_id);
+  motors = new SimuBldc(this, name, 4, modelId,0);
   
   SetIsReady(true);
@@ -96,27 +95,27 @@
 
   // cylinders are aligned with y axis
-  red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
-  black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
-  motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
   // geo->drop();
 
   ITexture *texture = getGui()->getTexture("carbone.jpg");
-  fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -135));
-  fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -45));
-  rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 135), texture);
-  rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 45), texture);
 
   texture = getGui()->getTexture("metal047.jpg");
-  fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+  MeshSceneNode *fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
                                vector3df(90, 0, 0), texture);
-  fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+  MeshSceneNode *fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
                                vector3df(90, 0, 0), texture);
-  rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+  MeshSceneNode *rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
                                vector3df(90, 0, 0), texture);
-  rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+  MeshSceneNode *rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
                                vector3df(90, 0, 0), texture);
 
Index: trunk/lib/FlairSimulator/src/X4.h
===================================================================
--- trunk/lib/FlairSimulator/src/X4.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/X4.h	(revision 158)
@@ -32,21 +32,11 @@
 }
 
-#ifdef GL
-namespace irr {
-namespace scene {
-class IMesh;
-}
-}
-#endif
-
 namespace flair {
 namespace simulator {
-class Simulator;
 class Blade;
-class MeshSceneNode;
 
 class X4 : public Model {
 public:
-  X4(const Simulator *parent, std::string name, int dev_id);
+  X4(std::string name, uint32_t modelId);
   ~X4();
 #ifdef GL
@@ -55,7 +45,4 @@
 
 protected:
-  irr::scene::IMesh *red_arm, *black_arm, *motor;
-  MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;
-  MeshSceneNode *fl_motor, *fr_motor, *rl_motor, *rr_motor;
   Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
   core::Mutex *motor_speed_mutex;
Index: trunk/lib/FlairSimulator/src/X8.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/X8.cpp	(revision 157)
+++ trunk/lib/FlairSimulator/src/X8.cpp	(revision 158)
@@ -16,5 +16,4 @@
 
 #include "X8.h"
-#include "Simulator.h"
 #include <SimuBldc.h>
 #include <TabWidget.h>
@@ -46,6 +45,5 @@
 namespace simulator {
 
-X8::X8(const Simulator *parent, std::string name, int dev_id)
-    : Model(parent, name) {
+X8::X8(std::string name, uint32_t modelId): Model( name,modelId) {
   Tab *setup_tab = new Tab(GetTabWidget(), "model");
   m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1);
@@ -84,5 +82,5 @@
       0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
 
-  motors = new SimuBldc(this, name, 8, dev_id);
+  motors = new SimuBldc(this, name, 8, modelId,0);
   
   SetIsReady(true);
@@ -101,36 +99,36 @@
 
   // cylinders are aligned with y axis
-  red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
-  black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
-  motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
   // geo->drop();
 
   ITexture *texture = getGui()->getTexture("carbone.jpg");
-  fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -135));
-  fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -45));
-  rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 135), texture);
-  rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 45), texture);
 
   texture = getGui()->getTexture("metal047.jpg");
-  tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-  tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-  trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-  trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-
-  bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5),
-                                vector3df(90, 0, 0), texture);
-  bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5),
-                                vector3df(90, 0, 0), texture);
-  brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5),
-                                vector3df(90, 0, 0), texture);
-  brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5),
+  MeshSceneNode *tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+
+  MeshSceneNode *bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5),
                                 vector3df(90, 0, 0), texture);
 
Index: trunk/lib/FlairSimulator/src/X8.h
===================================================================
--- trunk/lib/FlairSimulator/src/X8.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/X8.h	(revision 158)
@@ -32,21 +32,11 @@
 }
 
-#ifdef GL
-namespace irr {
-namespace scene {
-class IMesh;
-}
-}
-#endif
-
 namespace flair {
 namespace simulator {
-class Simulator;
 class Blade;
-class MeshSceneNode;
 
 class X8 : public Model {
 public:
-  X8(const Simulator *parent, std::string name, int dev_id);
+  X8(std::string name, uint32_t modelId);
   ~X8();
   virtual void Draw(void);
@@ -55,8 +45,4 @@
 protected:
 #ifdef GL
-  irr::scene::IMesh *red_arm, *black_arm, *motor;
-  MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;
-  MeshSceneNode *tfl_motor, *tfr_motor, *trl_motor, *trr_motor;
-  MeshSceneNode *bfl_motor, *bfr_motor, *brl_motor, *brr_motor;
   Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
   Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
Index: trunk/lib/FlairSimulator/src/unexported/GenericObject.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 158)
@@ -34,5 +34,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
 class GenericObject {
@@ -40,5 +39,5 @@
 
 public:
-  GenericObject(Simulator *parent,irr::scene::IMesh *mesh);
+  GenericObject(irr::scene::IMesh *mesh);
   virtual ~GenericObject();
 
Index: trunk/lib/FlairSimulator/src/unexported/Model_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 158)
@@ -66,11 +66,5 @@
                    {
 public:
-#ifdef GL
-  Model_impl(flair::simulator::Model *self, std::string name,
-             irr::scene::ISceneManager *scenemanager, vrpn_Connection_IP *vrpn);
-#else
-  Model_impl(flair::simulator::Model *self, std::string name,
-             vrpn_Connection_IP *vrpn);
-#endif
+  Model_impl(flair::simulator::Model *self, std::string name,uint32_t modelId);
   ~Model_impl();
 
@@ -100,4 +94,5 @@
   flair::gui::TabWidget *tabwidget;
   flair::gui::DoubleSpinBox *dT;
+  int modelId;
 
 private:
Index: trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 157)
+++ trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 158)
@@ -29,6 +29,8 @@
 }
 
+class Model_impl;
+
 class Simulator_impl : public vrpn_Connection_IP, private flair::core::Thread {
-  friend class flair::simulator::Model;
+  friend class ::Model_impl;
   friend class flair::simulator::GenericObject;
 
