Index: trunk/include/FlairSimulator/Castle.h
===================================================================
--- trunk/include/FlairSimulator/Castle.h	(revision 44)
+++ trunk/include/FlairSimulator/Castle.h	(revision 50)
@@ -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/include/FlairSimulator/FixedCamera.h
===================================================================
--- trunk/include/FlairSimulator/FixedCamera.h	(revision 44)
+++ trunk/include/FlairSimulator/FixedCamera.h	(revision 50)
@@ -26,5 +26,5 @@
 class FixedCamera : public VisualizationCamera {
 public:
-  FixedCamera(std::string name,core::Vector3D position,core::Vector3D lookat=core::Vector3D(0,0,0),float rotateSpeed = -3.0f, float zoomSpeed = .05f);
+  FixedCamera(std::string name,core::Vector3Df position,core::Vector3Df lookat=core::Vector3Df(0,0,0),float rotateSpeed = -3.0f, float zoomSpeed = .05f);
   ~FixedCamera();
 
Index: trunk/include/FlairSimulator/Gui.h
===================================================================
--- trunk/include/FlairSimulator/Gui.h	(revision 44)
+++ trunk/include/FlairSimulator/Gui.h	(revision 50)
@@ -19,4 +19,5 @@
 
 #include <Object.h>
+#include <Vector3D.h>
 #include <EDriverTypes.h>
 #include <vector3d.h>
@@ -36,5 +37,4 @@
 namespace core {
 class Object;
-class Vector3D;
 class Euler;
 class Quaternion;
@@ -48,12 +48,11 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
-class Gui : public core::Object {
+class Gui: public core::Object {
   friend class ::Simulator_impl;
   friend class VisualizationCamera;
 
 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);
@@ -126,5 +125,5 @@
 * \return vector in irrlicht coordinates
 */
-irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D vect);
+template<typename T>  irr::core::vector3df ToIrrlichtCoordinates(core::Vector3D<T> vect);
 
 /*!
@@ -137,5 +136,5 @@
 * \return vector in simulator coordinates
 */
-core::Vector3D ToSimulatorCoordinates(irr::core::vector3df vect);
+core::Vector3Df ToSimulatorCoordinates(irr::core::vector3df vect);
 
 /*!
Index: trunk/include/FlairSimulator/Man.h
===================================================================
--- trunk/include/FlairSimulator/Man.h	(revision 44)
+++ trunk/include/FlairSimulator/Man.h	(revision 50)
@@ -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/include/FlairSimulator/Model.h
===================================================================
--- trunk/include/FlairSimulator/Model.h	(revision 44)
+++ trunk/include/FlairSimulator/Model.h	(revision 50)
@@ -51,5 +51,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 class FollowMeCamera;
 
@@ -65,12 +64,12 @@
 
 public:
-  Model(const Simulator *parent, std::string name);
+  Model(std::string name,uint32_t modelId);
   virtual ~Model();
 
   typedef struct simu_state {
     core::Quaternion Quat;
-    core::Vector3D W;
-    core::Vector3D Pos;
-    core::Vector3D Vel;
+    core::Vector3Df W;
+    core::Vector3D<double> Pos;
+    core::Vector3D<double> Vel;
   } simu_state_t;
 
@@ -93,8 +92,9 @@
 #endif
   gui::TabWidget *GetTabWidget(void) const;
+  int GetId(void) const;
 
 protected:
   DiscreteTimeVariable<simu_state_t, 3> state;
-  float dT(void) const;
+  double dT(void) const;
   virtual void CalcModel(void) = 0;
 #ifdef GL
Index: trunk/include/FlairSimulator/Parser.h
===================================================================
--- trunk/include/FlairSimulator/Parser.h	(revision 44)
+++ trunk/include/FlairSimulator/Parser.h	(revision 50)
@@ -19,12 +19,8 @@
 
 #include <Gui.h>
+#include <Vector3D.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
-
-namespace flair {
-  namespace core {
-    class Vector3D;
-  }
-}
+#include <SColor.h>
 
 namespace flair {
@@ -38,5 +34,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();
@@ -45,12 +41,12 @@
   xmlDoc *doc;
   std::string media_path;
-  Simulator *parent;
   void processElements(xmlNode *a_node);
   void processObjects(xmlNode *a_node);
   void processParams(xmlNode *a_node);
+	irr::video::SColor getScolor(xmlNode *mesh_node);
   irr::core::vector3df getMeshVect(xmlNode *mesh_node, xmlChar *param);
   irr::core::vector3df getSceneVect(xmlNode *mesh_node, xmlChar *param,
                                     bool isScale = false);
-  core::Vector3D getMeshVector3D(xmlNode *mesh_node, xmlChar *param);
+  core::Vector3Df getMeshVector3D(xmlNode *mesh_node, xmlChar *param);
 };
 }
Index: trunk/include/FlairSimulator/SimuCameraGL.h
===================================================================
--- trunk/include/FlairSimulator/SimuCameraGL.h	(revision 44)
+++ trunk/include/FlairSimulator/SimuCameraGL.h	(revision 50)
@@ -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)
@@ -67,5 +67,5 @@
                                   irr::scene::ISceneManager *newManager = 0);
   void getImage(void);
-  void putImage(char *pixels);
+  void putImage(char *pixels,core::Time imageTime);
   irr::scene::ICameraSceneNode *camera;
   irr::scene::ISceneManager *smgr;
Index: trunk/include/FlairSimulator/SimuLaserGL.h
===================================================================
--- trunk/include/FlairSimulator/SimuLaserGL.h	(revision 44)
+++ trunk/include/FlairSimulator/SimuLaserGL.h	(revision 50)
@@ -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/include/FlairSimulator/SimuUsGL.h
===================================================================
--- trunk/include/FlairSimulator/SimuUsGL.h	(revision 44)
+++ trunk/include/FlairSimulator/SimuUsGL.h	(revision 50)
@@ -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/include/FlairSimulator/Simulator.h
===================================================================
--- trunk/include/FlairSimulator/Simulator.h	(revision 44)
+++ trunk/include/FlairSimulator/Simulator.h	(revision 50)
@@ -19,12 +19,13 @@
 
 #include <FrameworkManager.h>
+#include <Vector3D.h>
 #include <stdint.h>
 
 class Simulator_impl;
+class Model_impl;
 
 namespace flair {
 namespace core {
 class Quaternion;
-class Vector3D;
 }
 }
@@ -36,5 +37,5 @@
 
 class Simulator : public core::FrameworkManager {
-  friend class Model;
+  friend class ::Model_impl;
   friend class Gui;
   friend class GenericObject;
@@ -52,5 +53,5 @@
   // coordinate, around z axis
   core::Quaternion ToVRPNReference(core::Quaternion quat_in);
-  core::Vector3D ToVRPNReference(core::Vector3D point_in);
+  core::Vector3D<double> ToVRPNReference(core::Vector3D<double> point_in);
 
 private:
Index: trunk/include/FlairSimulator/X4.h
===================================================================
--- trunk/include/FlairSimulator/X4.h	(revision 44)
+++ trunk/include/FlairSimulator/X4.h	(revision 50)
@@ -19,6 +19,4 @@
 
 #include <Model.h>
-#include <stdint.h>
-#include <stdio.h>
 
 namespace flair {
@@ -34,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
@@ -57,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/include/FlairSimulator/X8.h
===================================================================
--- trunk/include/FlairSimulator/X8.h	(revision 44)
+++ trunk/include/FlairSimulator/X8.h	(revision 50)
@@ -19,5 +19,4 @@
 
 #include <Model.h>
-#include <stdint.h>
 
 namespace flair {
@@ -33,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);
@@ -56,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;
