]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/wxradar.cxx
Fix line endings
[flightgear.git] / src / Instrumentation / wxradar.cxx
index a233433c1bdf8b1d86da764ddcaf27cd6a53e784..829af7b258a8286989bbae47b5b74c12fd38f2f2 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Harald JOHNSEN, started May 2005.
 //
-// Copyright (C) 2005  Harald JOHNSEN - hjohnsen@evc.net
+// Copyright (C) 2005  Harald JOHNSEN
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
 //
 //
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <plib/sg.h>
 #include <plib/ssg.h>
 #include <Main/fg_props.hxx>
@@ -81,12 +85,10 @@ wxRadarBg::init ()
     _Instrument = fgGetNode(branch.c_str(), num, true );
     _serviceable_node = _Instrument->getChild("serviceable", 0, true);
     resultTexture = FGTextureManager::createTexture( odgauge_name );
-    resultTexture->ref();
     SGPath tpath(globals->get_fg_root());
     tpath.append("Aircraft/Instruments/Textures/wxecho.rgb");
     // no mipmap or else alpha will mix with pixels on the border of shapes, ruining the effect
     wxEcho = new ssgTexture( tpath.c_str(), false, false, false);
-    wxEcho->ref();
 
     _Instrument->setFloatValue("trk", 0.0);
     _Instrument->setFloatValue("tilt", 0.0);
@@ -132,8 +134,18 @@ wxRadarBg::update (double delta_time_sec)
             odg->set_texture( odgauge_name, resultTexture->getHandle());
         last_switchKnob = switchKnob;
     }
+    FGViewer *current__view = globals->get_current_view();
+    if( current__view->getInternal() && 
+        (current__view->getHeadingOffset_deg() <= 15.0 || current__view->getHeadingOffset_deg() >= 345.0) &&
+        (current__view->getPitchOffset_deg() <= 15.0 || current__view->getPitchOffset_deg() >= 350.0) ) {
+
+        // we don't update the radar echo if the pilot looks around
+        // this is a copy
+        radarEchoBuffer = *sgEnviro.get_radar_echo();
+    }
     odg->beginCapture(256);
     odg->Clear();
+
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
     glPushMatrix();
@@ -170,7 +182,7 @@ wxRadarBg::update (double delta_time_sec)
             const float rot_x = cos ( view_heading );
             const float rot_y = sin ( view_heading );
 
-            list_of_SGWxRadarEcho *radarEcho = sgEnviro.get_radar_echo();
+            list_of_SGWxRadarEcho *radarEcho = &radarEchoBuffer;
             list_of_SGWxRadarEcho::iterator iradarEcho;
             const float LWClevel[] = { 0.1f, 0.5f, 2.1f };
             const float symbolSize = 1.0f / 8.0f ;