]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/viewmgr.cxx
Roy Vegard Ovesen:
[flightgear.git] / src / Main / viewmgr.cxx
index 39e7ac95bd5a893e0498c02efa2ec4722c5f22c4..371c38f7d3ae38bde15ae3fe8c64e2c3a7933c28 100644 (file)
@@ -3,7 +3,7 @@
 // Written by Curtis Olson, started October 2000.
 //   partially rewritten by Jim Wilson March 2002
 //
-// Copyright (C) 2000  Curtis L. Olson  - curt@flightgear.org
+// Copyright (C) 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -51,7 +51,8 @@ FGViewMgr::init ()
   bool at_model = false;
   int from_model_index = 0;
   int at_model_index = 0;
-  double damp_alt, damp_roll, damp_pitch, damp_heading;
+  // double damp_alt;
+  double damp_roll = 0.0, damp_pitch = 0.0, damp_heading = 0.0;
   double x_offset_m, y_offset_m, z_offset_m, fov_deg;
   double heading_offset_deg, pitch_offset_deg, roll_offset_deg;
   double target_x_offset_m, target_y_offset_m, target_z_offset_m;
@@ -271,6 +272,14 @@ FGViewMgr::bind ()
        &FGViewMgr::getGoalViewPitchOffset_deg,
         &FGViewMgr::setGoalViewPitchOffset_deg);
   fgSetArchivable("/sim/current-view/goal-pitch-offset-deg");
+  fgTie("/sim/current-view/roll-offset-deg", this,
+       &FGViewMgr::getViewRollOffset_deg,
+        &FGViewMgr::setViewRollOffset_deg);
+  fgSetArchivable("/sim/current-view/roll-offset-deg");
+  fgTie("/sim/current-view/goal-roll-offset-deg", this,
+       &FGViewMgr::getGoalViewRollOffset_deg,
+        &FGViewMgr::setGoalViewRollOffset_deg);
+  fgSetArchivable("/sim/current-view/goal-roll-offset-deg");
 
   fgTie("/sim/current-view/view-number", this, 
                       &FGViewMgr::getView, &FGViewMgr::setView);
@@ -435,6 +444,12 @@ FGViewMgr::copyToCurrent()
     fgSetDouble("/sim/current-view/config/default-field-of-view-deg",
                 fgGetDouble(nodepath.c_str()));
 
+    nodepath = viewpath;
+    nodepath += "/config/from-model";
+    fgSetBool("/sim/current-view/config/from-model",
+                fgGetBool(nodepath.c_str()));
+
+
     // copy view data
     fgSetDouble("/sim/current-view/x-offset-m", getViewXOffset_m());
     fgSetDouble("/sim/current-view/y-offset-m", getViewYOffset_m());
@@ -457,6 +472,10 @@ FGViewMgr::copyToCurrent()
                 get_current_view()->getTargetYOffset_m());
     fgSetDouble("/sim/current-view/target-z-offset-m",
                 get_current_view()->getTargetZOffset_m());
+
+    fgSetBool("/sim/current-view/internal",
+                get_current_view()->getInternal());
+
 }
 
 
@@ -524,6 +543,38 @@ FGViewMgr::setGoalViewPitchOffset_deg (double tilt)
     view->setGoalPitchOffset_deg(tilt);
 }
 
+double
+FGViewMgr::getViewRollOffset_deg () const
+{
+  const FGViewer * view = get_current_view();
+  return (view == 0 ? 0 : view->getRollOffset_deg());
+}
+
+void
+FGViewMgr::setViewRollOffset_deg (double tilt)
+{
+  FGViewer * view = get_current_view();
+  if (view != 0) {
+    view->setGoalRollOffset_deg(tilt);
+    view->setRollOffset_deg(tilt);
+  }
+}
+
+double
+FGViewMgr::getGoalViewRollOffset_deg () const
+{
+  const FGViewer * view = get_current_view();
+  return (view == 0 ? 0 : view->getGoalRollOffset_deg());
+}
+
+void
+FGViewMgr::setGoalViewRollOffset_deg (double tilt)
+{
+  FGViewer * view = get_current_view();
+  if (view != 0)
+    view->setGoalRollOffset_deg(tilt);
+}
+
 double
 FGViewMgr::getViewXOffset_m () const
 {