]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/viewer.cxx
Improve timing statistics
[flightgear.git] / src / Main / viewer.cxx
index a2baa48c4aeb8262e7910fc2d53a99be4ca1005e..57e60f48110007c8eff18f06cd0f8fc05f2271b9 100644 (file)
 #endif
 
 #include <simgear/compiler.h>
+#include <cassert>
 
 #include "fg_props.hxx"
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/constants.h>
 #include <simgear/scene/model/placement.hxx>
-#include <simgear/math/vector.hxx>
 
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
@@ -289,7 +289,14 @@ void
 FGViewer::setHeadingOffset_deg (double heading_offset_deg)
 {
   _dirty = true;
-  _heading_offset_deg = heading_offset_deg;
+  if (_at_model && (_offset_m.x() == 0.0)&&(_offset_m.z() == 0.0))
+  {
+      /* avoid optical effects (e.g. rotating sky) when "looking at" with
+       * heading offsets x==z==0 (view heading cannot change). */
+      _heading_offset_deg = 0.0;
+  }
+  else
+      _heading_offset_deg = heading_offset_deg;
 }
 
 void
@@ -317,6 +324,14 @@ void
 FGViewer::setGoalHeadingOffset_deg (double goal_heading_offset_deg)
 {
   _dirty = true;
+  if (_at_model && (_offset_m.x() == 0.0)&&(_offset_m.z() == 0.0))
+  {
+      /* avoid optical effects (e.g. rotating sky) when "looking at" with
+       * heading offsets x==z==0 (view heading cannot change). */
+      _goal_heading_offset_deg = 0.0;
+      return;
+  }
+  
   _goal_heading_offset_deg = goal_heading_offset_deg;
   while ( _goal_heading_offset_deg < 0.0 ) {
     _goal_heading_offset_deg += 360;
@@ -501,6 +516,8 @@ FGViewer::updateDampOutput(double dt)
     
     for (unsigned int i=0; i<3; ++i) {
       if (_dampFactor[i] <= 0.0) {
+        // axis is un-damped, set output to target directly
+        _dampOutput[i] = _dampTarget[i];
         continue;
       }
       
@@ -649,6 +666,8 @@ FGViewer::update (double dt)
     }
   }
   recalc();
-  _cameraGroup->update(toOsg(_absolute_view_pos), toOsg(mViewOrientation));
-  _cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
+  if( fgGetBool( "/sim/rendering/draw-otw", true ) ) {
+    _cameraGroup->update(toOsg(_absolute_view_pos), toOsg(mViewOrientation));
+    _cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
+  }
 }