]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/HUD/HUD_runway.cxx
Reset: work with threaded OSG modes
[flightgear.git] / src / Instrumentation / HUD / HUD_runway.cxx
index fcf4f11277c0da885f716419582feb96ef3388df..5ad4592a1d6141bf6ba53d9e2dd95ad92423ea6a 100644 (file)
 
 #include <simgear/compiler.h>
 #include <simgear/math/sg_geodesy.hxx>
-#include <simgear/math/project.hxx>
+#include <simgear/scene/util/project.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
 #include <Scenery/scenery.hxx>
 #include <Aircraft/controls.hxx>
 #include <FDM/flight.hxx>
 #include <Environment/environment.hxx>
 #include <Environment/environment_mgr.hxx>
-#include <Main/viewer.hxx>
-#include <Main/viewmgr.hxx>
+#include <Viewer/viewer.hxx>
+#include <Viewer/viewmgr.hxx>
 #include <ATCDCL/ATCutils.hxx>
 
 #include "HUD.hxx"
-
+#include "HUD_private.hxx"
 
 HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
     Item(hud, node, x, y),
@@ -49,7 +50,6 @@ HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
     _scale_dist(node->getDoubleValue("scale-dist-nm")),
     _default_pitch(fgGetDouble("/sim/view[0]/config/pitch-pitch-deg", 0.0)),
     _default_heading(fgGetDouble("/sim/view[0]/config/pitch-heading-deg", 0.0)),
-    _cockpit_view(globals->get_viewmgr()->get_view(0)),
     _stipple_out(node->getIntValue("outer_stipple", 0xFFFF)),
     _stipple_center(node->getIntValue("center-stipple", 0xFFFF)),
     _draw_arrow(_arrow_scale > 0 ? true : false),
@@ -69,7 +69,6 @@ HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
     _top = _center_y + (_h / 2) + _y;
 }
 
-
 void HUD::Runway::draw()
 {
     _runway = get_active_runway();
@@ -77,18 +76,21 @@ void HUD::Runway::draw()
         return;
 
     glPushAttrib(GL_LINE_STIPPLE | GL_LINE_STIPPLE_PATTERN | GL_LINE_WIDTH);
-    float modelView[4][4], projMat[4][4];
+    float projMat[4][4]={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
+    float modelView[4][4];
     bool anyLines;
     //Get the current view
-    FGViewer* curr_view = globals->get_viewmgr()->get_current_view();
-    int curr_view_id = globals->get_viewmgr()->get_current();
-    double gpo = curr_view->getGoalPitchOffset_deg();
-    double gho = curr_view->getGoalHeadingOffset_deg();
-    double po = curr_view->getPitchOffset_deg();
-    double ho = curr_view->getHeadingOffset_deg();
-
-    double yaw = -(_cockpit_view->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
-    double pitch = (_cockpit_view->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
+//    FGViewer* curr_view = globals->get_viewmgr()->get_current_view();
+//    int curr_view_id = globals->get_viewmgr()->get_current();
+//    double gpo = curr_view->getGoalPitchOffset_deg();
+//    double gho = curr_view->getGoalHeadingOffset_deg();
+//    double po = curr_view->getPitchOffset_deg();
+//    double ho = curr_view->getHeadingOffset_deg();
+
+    FGViewer* cockpitView = globals->get_viewmgr()->get_view(0);
+    
+    double yaw = -(cockpitView->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
+    double pitch = (cockpitView->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
     //double roll = fgGetDouble("/sim/view[0]/config/roll-offset-deg",0.0) //TODO: adjust for default roll offset
     double sPitch = sin(pitch), cPitch = cos(pitch),
            sYaw = sin(yaw), cYaw = cos(yaw);
@@ -122,9 +124,9 @@ void HUD::Runway::draw()
     }
 
     //Calculate the 2D points via gluProject
-    int result = GL_TRUE;
+//    int result = GL_TRUE;
     for (int i = 0; i < 6; i++) {
-        result = simgear::project(_points3d[i][0], _points3d[i][1], _points3d[i][2],
+        /*result = */simgear::project(_points3d[i][0], _points3d[i][1], _points3d[i][2],
                                   _mm, _pm, _view,
                                   &_points2d[i][0], &_points2d[i][1], &_points2d[i][2]);
     }