]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/viewmgr.cxx
Merge branch 'jt/runway' into next
[flightgear.git] / src / Main / viewmgr.cxx
index c67c71914e49402ddab4655d3440882f5d21bac2..cb2dfa0531045664b6a76f52b82fba9d2236d072 100644 (file)
@@ -212,6 +212,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 +233,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,12 +294,15 @@ FGViewMgr::update (double dt)
   // Update the current view
   do_axes();
   view->update(dt);
+  abs_viewer_position = loop_view->getViewPosition();
 }
 
 void
 FGViewMgr::copyToCurrent()
 {
     SGPropertyNode *n = config_list[current];
+    fgSetString("/sim/current-view/name", n->getStringValue("name"));
+    fgSetString("/sim/current-view/type", n->getStringValue("type"));
 
     // copy certain view config data for default values
     fgSetDouble("/sim/current-view/config/heading-offset-deg",