]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/viewmgr.cxx
Sync. w. JSBSim CVS
[flightgear.git] / src / Main / viewmgr.cxx
index 806d9451a45472b9935a5c3d0f4a772884cff199..950eace8315ac46253e8deffc90a0d6c05fdc0ef 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <string.h>            // strcmp
 
-#include <plib/sg.h>
-
 #include <simgear/compiler.h>
 
 #include <Model/acmodel.hxx>
@@ -147,11 +145,11 @@ FGViewMgr::reinit ()
     fgSetDouble("/sim/current-view/field-of-view", fov_deg);
 
     // target offsets for lookat mode only...
-    fgSetDouble("/sim/current-view/target-x-offset-deg",
+    fgSetDouble("/sim/current-view/target-x-offset-m",
         n->getDoubleValue("config/target-x-offset-m"));
-    fgSetDouble("/sim/current-view/target-y-offset-deg",
+    fgSetDouble("/sim/current-view/target-y-offset-m",
         n->getDoubleValue("config/target-y-offset-m"));
-    fgSetDouble("/sim/current-view/target-z-offset-deg",
+    fgSetDouble("/sim/current-view/target-z-offset-m",
         n->getDoubleValue("config/target-z-offset-m"));
   }
   setView(0);
@@ -212,6 +210,10 @@ FGViewMgr::bind ()
        &FGViewMgr::getNear_m, &FGViewMgr::setNear_m);
   fgSetArchivable("/sim/current-view/ground-level-nearplane-m");
 
+  SGPropertyNode *n = fgGetNode("/sim/current-view", true);
+  n->tie("viewer-x-m", SGRawValuePointer<double>(&abs_viewer_position[0]));
+  n->tie("viewer-y-m", SGRawValuePointer<double>(&abs_viewer_position[1]));
+  n->tie("viewer-z-m", SGRawValuePointer<double>(&abs_viewer_position[2]));
 }
 
 void
@@ -229,6 +231,9 @@ FGViewMgr::unbind ()
   fgUntie("/sim/current-view/axes/long");
   fgUntie("/sim/current-view/axes/lat");
   fgUntie("/sim/current-view/ground-level-nearplane-m");
+  fgUntie("/sim/current-view/viewer-x-m");
+  fgUntie("/sim/current-view/viewer-y-m");
+  fgUntie("/sim/current-view/viewer-z-m");
 }
 
 void
@@ -287,6 +292,7 @@ FGViewMgr::update (double dt)
   // Update the current view
   do_axes();
   view->update(dt);
+  abs_viewer_position = loop_view->getViewPosition();
 }
 
 void