Index: trunk/lib/FlairSimulator/src/FixedCamera.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/FixedCamera.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/FixedCamera.cpp	(revision 70)
@@ -25,4 +25,5 @@
 #include <IrrlichtDevice.h>
 #include <ISceneManager.h>
+#include <Euler.h>
 
 using namespace irr;
@@ -34,14 +35,23 @@
 namespace simulator {
 
-FixedCamera::FixedCamera(core::Vector3D position,float rotateSpeed,float zoomSpeed):VisualizationCamera(rotateSpeed,zoomSpeed)  {
-  RotY = 020;
+FixedCamera::FixedCamera(std::string name,core::Vector3D position,float inRotateSpeed,float inZoomSpeed):VisualizationCamera(name)  {
+  RotY = -90;
   RotZ = 0;
   Rotating = false;
-
-   // camera
-  camera->setPosition(vector3df(position.x,position.y,position.z));
+  rotateSpeed=inRotateSpeed;
+  zoomSpeed=inZoomSpeed;
+  camera->setPosition(vector3df(ToIrrlichtCoordinates(position)));
+  fov=camera->getFOV();
 }
 
 FixedCamera::~FixedCamera() {}
+
+float FixedCamera::sat(float value) {
+  if (value >= -1)
+    value = -1;
+  if (value <= -179)
+    value = -179;
+  return value;
+}
 
 void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) {
@@ -60,8 +70,10 @@
       nRotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;
       nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
+      nRotY = sat(nRotY);
     }
   } else if (Rotating) {
     RotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;
     RotZ += (RotateStart.X - MousePos.X) * rotateSpeed;
+    RotY = sat(RotY);
     nRotY = RotY;
     nRotZ = RotZ;
@@ -69,6 +81,17 @@
   }
 
+  float newFov=fov+currentZoom*zoomSpeed;
+  if(newFov>fov) {
+    newFov=fov;
+    currentZoom=0;
+  }
+  if(newFov<0) {
+    newFov=zoomSpeed;
+    currentZoom=1-fov/zoomSpeed;
+  }
+
   camera->setRotation(vector3df(0,nRotY,nRotZ));
   camera->bindTargetAndRotation(true);
+  camera->setFOV(newFov);
 }
 
Index: trunk/lib/FlairSimulator/src/FixedCamera.h
===================================================================
--- trunk/lib/FlairSimulator/src/FixedCamera.h	(revision 69)
+++ trunk/lib/FlairSimulator/src/FixedCamera.h	(revision 70)
@@ -26,5 +26,5 @@
 class FixedCamera : public VisualizationCamera {
 public:
-  FixedCamera(core::Vector3D position,float rotateSpeed = -500.0f, float zoomSpeed = 4.0f);
+  FixedCamera(std::string name,core::Vector3D position,float rotateSpeed = -500.0f, float zoomSpeed = .1f);
   ~FixedCamera();
 
@@ -32,7 +32,11 @@
 
 private:
+  float sat(float value);
   irr::core::position2df RotateStart;
   bool Rotating;
+  float rotateSpeed;
+  float zoomSpeed;
   float RotY, RotZ;
+  float fov;
 };
 
Index: trunk/lib/FlairSimulator/src/FollowMeCamera.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/FollowMeCamera.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/FollowMeCamera.cpp	(revision 70)
@@ -34,7 +34,9 @@
 namespace simulator {
 
-FollowMeCamera::FollowMeCamera(const ISceneNode *parent, float rotateSpeed,
-                             float zoomSpeed):VisualizationCamera(rotateSpeed,zoomSpeed)  {
+FollowMeCamera::FollowMeCamera(const ISceneNode *parent, std::string name,float inRotateSpeed,
+                             float inZoomSpeed):VisualizationCamera(name)  {
   this->parent = parent;
+  rotateSpeed=inRotateSpeed;
+  zoomSpeed=inZoomSpeed;
   RotY = 20;
   RotZ = 0;
@@ -44,8 +46,10 @@
 FollowMeCamera::~FollowMeCamera() {}
 
-void FollowMeCamera::setPositionOffset(vector3df newpos) { pos_offset = newpos; }
+void FollowMeCamera::setPositionOffset(vector3df newpos) {
+  pos_offset = ToIrrlichtCoordinates(newpos);
+}
 
 void FollowMeCamera::setTargetOffset(vector3df newpos) {
-  target_offset = newpos;
+  target_offset = ToIrrlichtCoordinates(newpos);
 }
 
@@ -59,5 +63,4 @@
 
 void FollowMeCamera::animateNode(ISceneNode *node, u32 timeMs) {
-  vector3df pos;
 
   float nRotY = RotY;
@@ -84,5 +87,12 @@
   }
 
-  pos.X = -currentZoom;
+  float newCurrentZoom= 100+currentZoom * zoomSpeed;
+  if (newCurrentZoom <= 0) {
+    newCurrentZoom =zoomSpeed;
+    currentZoom =1-100/zoomSpeed;
+  }
+
+  vector3df pos;
+  pos.X = -newCurrentZoom;
   pos.Y = 0;
   pos.Z = 0;
Index: trunk/lib/FlairSimulator/src/Gui.h
===================================================================
--- trunk/lib/FlairSimulator/src/Gui.h	(revision 69)
+++ trunk/lib/FlairSimulator/src/Gui.h	(revision 70)
@@ -52,4 +52,5 @@
 class Gui : public core::Object {
   friend class ::Simulator_impl;
+  friend class VisualizationCamera;
 
 public:
Index: trunk/lib/FlairSimulator/src/Gui_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Gui_impl.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/Gui_impl.cpp	(revision 70)
@@ -98,17 +98,4 @@
   smgr->setAmbientLight(video::SColorf(1, 1, 1));
 
-/*
-   // camera
-  camera = smgr->addCameraSceneNode();
-
-  camera->setAspectRatio(
-      (float)scene_width / (float)scene_height); // on force a cause du view port
-
-  camera->setUpVector(vector3df(0, 0, 1));
-
-  FixedCamera* animator = new FixedCamera(vector3df(1,1,1));
-  camera->addAnimator(animator);
-
-  camera->setFarValue(8000);*/
   /*
 env = device->getGUIEnvironment();
@@ -146,4 +133,8 @@
   delete receiver;
   // printf("del Gui_impl ok\n");
+}
+
+void Gui_impl::AddVisualizationCamera(VisualizationCamera* camera) {
+  cameras.push_back(camera);
 }
 
@@ -187,5 +178,5 @@
   int cam_id = 0;
 
-  receiver->SetModel(models.at(cam_id));
+  receiver->SetModel(models.at(0));
 
   for (size_t i = 0; i < models.size(); i++) {
@@ -213,5 +204,5 @@
   }
 
-  setWindowCaption(models.at(0), 0);
+  setWindowCaption(0, 0);
 
   while (device->run()) {
@@ -247,5 +238,6 @@
 
     // vue poursuite
-    smgr->setActiveCamera(models.at(cam_id)->getFollowMeCamera()->getCameraSceneNode());
+    //smgr->setActiveCamera(models.at(cam_id)->getFollowMeCamera()->getCameraSceneNode());
+    smgr->setActiveCamera(cameras.at(cam_id)->getCameraSceneNode());
     driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
     smgr->drawAll(); // commente voir plus bas
@@ -279,5 +271,6 @@
     // mais a priori souci avec models.at(i)->pimpl_->CheckCollision();
     // (setelipsoid?)
-    smgr->setActiveCamera(models.at(cam_id)->getFollowMeCamera()->getCameraSceneNode());
+    //smgr->setActiveCamera(models.at(cam_id)->getFollowMeCamera()->getCameraSceneNode());
+    smgr->setActiveCamera(cameras.at(cam_id)->getCameraSceneNode());
     driver->setViewPort(core::rect<s32>(0, 0, scene_width, scene_height));
     smgr->drawAll();
@@ -286,7 +279,7 @@
 
     int fps = driver->getFPS();
-    // printf("fps %i\n",fps);
+
     if (lastFPS != fps) {
-      setWindowCaption(models.at(cam_id), fps);
+      setWindowCaption(cam_id, fps);
       lastFPS = fps;
     }
@@ -294,13 +287,13 @@
     if (receiver->IsKeyDown(KEY_PRIOR)) {
       cam_id++;
-      if (cam_id >= (int)models.size()) cam_id = 0;
-      receiver->SetModel(models.at(cam_id));
-      setWindowCaption(models.at(cam_id), fps);
+      if (cam_id >= (int)cameras.size()) cam_id = 0;
+      receiver->SetModel(getModelFromVisualizationCamera(models,cameras.at(cam_id)));
+      setWindowCaption(cam_id, fps);
     }
     if (receiver->IsKeyDown(KEY_NEXT)) {
       cam_id--;
-      if (cam_id < 0) cam_id = models.size() - 1;
-      receiver->SetModel(models.at(cam_id));
-      setWindowCaption(models.at(cam_id), fps);
+      if (cam_id < 0) cam_id = cameras.size() - 1;
+      receiver->SetModel(getModelFromVisualizationCamera(models,cameras.at(cam_id)));
+      setWindowCaption(cam_id, fps);
     }
 
@@ -354,8 +347,16 @@
 }
 
-void Gui_impl::setWindowCaption(Object *object, int fps) {
+Model *Gui_impl::getModelFromVisualizationCamera(std::vector<Model *> models,VisualizationCamera *camera) {
+  for (size_t i = 0; i < models.size(); i++) {
+      if(models.at(i)->getFollowMeCamera()==camera) return models.at(i);
+  }
+  return NULL;
+}
+
+void Gui_impl::setWindowCaption(int cam_id, int fps) {
   std::ostringstream text;
-  text << "Cam: " << object->ObjectName().c_str()
-       << ", Kbd: " << object->ObjectName().c_str() << ", FPS: " << fps;
+
+  text << "Cam: " << cameras.at(cam_id)->getName().c_str()
+     << ", FPS: " << fps;
 
   device->setWindowCaption(stringw(text.str().c_str()).c_str());
Index: trunk/lib/FlairSimulator/src/Man.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Man.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/Man.cpp	(revision 70)
@@ -47,6 +47,6 @@
   node->getMaterial(0).Lighting = false;
 
-  getFollowMeCamera()->setPositionOffset(vector3df(0, 0, 100));
-  getFollowMeCamera()->setTargetOffset(vector3df(0, 0, 100));
+  getFollowMeCamera()->setPositionOffset(vector3df(0, 0, -1));
+  getFollowMeCamera()->setTargetOffset(vector3df(0, 0, -1));
 
   setTriangleSelector(
Index: trunk/lib/FlairSimulator/src/Model.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Model.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/Model.cpp	(revision 70)
@@ -19,8 +19,8 @@
 #include "Simulator.h"
 #include "Simulator_impl.h"
-#include "FollowMeCamera.h"
 #include <DoubleSpinBox.h>
 
 #ifdef GL
+#include "FollowMeCamera.h"
 #include "Gui.h"
 #include <ICameraSceneNode.h>
Index: trunk/lib/FlairSimulator/src/Model_impl.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 70)
@@ -83,5 +83,5 @@
 
   // camera
-  camera = new FollowMeCamera(this);
+  camera = new FollowMeCamera(this,name);
 
   position_init = false;
Index: trunk/lib/FlairSimulator/src/VisualizationCamera.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/VisualizationCamera.cpp	(revision 69)
+++ trunk/lib/FlairSimulator/src/VisualizationCamera.cpp	(revision 70)
@@ -21,4 +21,5 @@
 #include "Model_impl.h"
 #include "Gui.h"
+#include "Gui_impl.h"
 #include <ICursorControl.h>
 #include <ICameraSceneNode.h>
@@ -34,8 +35,7 @@
 namespace simulator {
 
-VisualizationCamera::VisualizationCamera(float inRotateSpeed,float inZoomSpeed) {
-  zoomSpeed = inZoomSpeed;
-  rotateSpeed = inRotateSpeed;
-  currentZoom = 100;
+VisualizationCamera::VisualizationCamera(std::string inName) {
+  name=inName;
+  currentZoom = 0;
   LMouseKey = false;
 
@@ -46,7 +46,13 @@
   camera->addAnimator(this);
   camera->setFarValue(8000);
+
+  getGui()->pimpl_->AddVisualizationCamera(this);
 }
 
 VisualizationCamera::~VisualizationCamera() {}
+
+std::string VisualizationCamera::getName(void) {
+  return name;
+}
 
 ICameraSceneNode *VisualizationCamera::getCameraSceneNode(void) {
@@ -66,7 +72,5 @@
 
   case EMIE_MOUSE_WHEEL:
-    currentZoom -= event.MouseInput.Wheel * zoomSpeed;
-    if (currentZoom <= 0)
-      currentZoom = zoomSpeed;
+    currentZoom -= event.MouseInput.Wheel;
     break;
   case EMIE_LMOUSE_PRESSED_DOWN:
Index: trunk/lib/FlairSimulator/src/VisualizationCamera.h
===================================================================
--- trunk/lib/FlairSimulator/src/VisualizationCamera.h	(revision 69)
+++ trunk/lib/FlairSimulator/src/VisualizationCamera.h	(revision 70)
@@ -21,4 +21,5 @@
 #include <position2d.h>
 #include <Vector3D.h>
+#include <string>
 
 namespace irr {
@@ -33,5 +34,5 @@
 class VisualizationCamera : private irr::scene::ISceneNodeAnimator {
 public:
-  VisualizationCamera(float rotateSpeed = -500.0f, float zoomSpeed = 4.0f);
+  VisualizationCamera(std::string name);
   ~VisualizationCamera();
 
@@ -40,4 +41,5 @@
   virtual bool OnEvent(const irr::SEvent& event);
   irr::scene::ICameraSceneNode *getCameraSceneNode(void);
+  std::string getName(void);
 
 private:
@@ -48,7 +50,6 @@
   irr::scene::ICameraSceneNode *camera;
   irr::core::position2df MousePos;
-  float rotateSpeed;
-  float zoomSpeed;
   float currentZoom;
+  std::string name;
 };
 
Index: trunk/lib/FlairSimulator/src/unexported/FollowMeCamera.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/FollowMeCamera.h	(revision 69)
+++ trunk/lib/FlairSimulator/src/unexported/FollowMeCamera.h	(revision 70)
@@ -26,5 +26,5 @@
 class FollowMeCamera : public VisualizationCamera {
 public:
-  FollowMeCamera(const irr::scene::ISceneNode *parent,
+  FollowMeCamera(const irr::scene::ISceneNode *parent,std::string name,
                 float rotateSpeed = -500.0f, float zoomSpeed = 4.0f);
   ~FollowMeCamera();
@@ -41,4 +41,6 @@
   float RotY, RotZ;
   float sat(float value);
+  float rotateSpeed;
+  float zoomSpeed;
 };
 
Index: trunk/lib/FlairSimulator/src/unexported/Gui_impl.h
===================================================================
--- trunk/lib/FlairSimulator/src/unexported/Gui_impl.h	(revision 69)
+++ trunk/lib/FlairSimulator/src/unexported/Gui_impl.h	(revision 70)
@@ -30,5 +30,4 @@
 class IMeshSceneNode;
 class ITriangleSelector;
-//class ICameraSceneNode;
 }
 namespace video {
@@ -49,5 +48,5 @@
 class GenericObject;
 class Gui;
-class FixedCamera;
+class VisualizationCamera;
 }
 }
@@ -61,5 +60,5 @@
            irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL);
   ~Gui_impl();
-  void RunGui(std::vector<flair::simulator::Model *> modeles,
+  void RunGui(std::vector<flair::simulator::Model *> models,
               std::vector<flair::simulator::GenericObject *> objects);
   void setMesh(std::string file,
@@ -74,4 +73,5 @@
   irr::scene::ISceneManager *smgr;
   int scene_width, scene_height;
+  void AddVisualizationCamera(flair::simulator::VisualizationCamera* camera);
 
 private:
@@ -80,12 +80,12 @@
   irr::gui::IGUIFont *font;
   irr::gui::IGUIEnvironment *env;
-  void setWindowCaption(flair::core::Object *object, int fps);
+  void setWindowCaption(int cam_id, int fps);
   void takeScreenshot(void);
   hdfile_t *dbtFile_r, *dbtFile_w;
   size_t dbtSize(std::vector<flair::simulator::Model *> modeles);
   char *dbtbuf;
-  flair::simulator::FixedCamera *fixedCamera;
   flair::simulator::Gui *self;
-  //irr::scene::ICameraSceneNode * camera;
+  std::vector<flair::simulator::VisualizationCamera *> cameras;
+  flair::simulator::Model *getModelFromVisualizationCamera(std::vector<flair::simulator::Model *> models,flair::simulator::VisualizationCamera *camera);
 };
 
