]> git.mxchange.org Git - flightgear.git/commitdiff
Minimize impact of distant AI models on the scene graph.
authordurk <durk>
Wed, 10 Dec 2008 16:04:10 +0000 (16:04 +0000)
committerdurk <durk>
Wed, 10 Dec 2008 16:04:10 +0000 (16:04 +0000)
src/AIModel/AIAircraft.cxx
src/AIModel/AIAircraft.hxx

index d66eaa3ea3c449d3eae62348c2e14e908c4e1dab..1ed6f75721e08de0afa068cb46189704a020f65e 100644 (file)
@@ -159,8 +159,28 @@ void FGAIAircraft::setPerformance(const std::string& acclass) {
      updateSecondaryTargetValues(); // target roll, vertical speed, pitch
      updateActualState(); 
      UpdateRadar(manager);
+     checkVisibility();
   }
 
+void FGAIAircraft::checkVisibility() 
+{
+     double visibility_meters = fgGetDouble("/environment/visibility-m");
+
+     FGViewer* vw = globals->get_current_view();
+     double course, distance;
+
+     SGWayPoint current(pos.getLongitudeDeg(), pos.getLatitudeDeg(), 0);
+     SGWayPoint view (vw->getLongitude_deg(), vw->getLatitude_deg(), 0);
+     view.CourseAndDistance(current, &course, &distance);
+     if (distance > visibility_meters) {
+         //aip.getSGLocation()->set_cur_elev_m(aptElev);
+         //return;
+         invisible = true;
+      } else {
+         invisible = false;
+      }
+}
+
 
 
 void FGAIAircraft::AccelTo(double speed) {
index a179c9d7feec63a170292226cec8d6b8143c7751..e391c6a4547f63c089a01fa60645a8a91fb7c9f3 100644 (file)
@@ -126,6 +126,7 @@ private:
     void updatePitchAngleTarget();
     void updateActualState();
     void handleATCRequests();
+    void checkVisibility();
 
     double sign(double x);