]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/panelnode.cxx
I have added Aaron Wilson's virtual 3d runway projection to the HUD.
[flightgear.git] / src / Model / panelnode.cxx
index ee6c9a0c60c4a68c5f3f6f92cee02fa5c1ec75d3..55973b0035ec670cc3220f4a8c5649522abb9173 100644 (file)
@@ -2,35 +2,42 @@
 #  include <config.h>
 #endif
 
+#include <simgear/compiler.h>
 #include <vector>
 
-#include <GL/gl.h>
 #include <plib/sg.h>
 
-#include <Main/fg_props.hxx>
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
 #include "panelnode.hxx"
 
+SG_USING_STD(vector);
+
+
 // Static (!) handling for all 3D panels in the program.  Very
 // clumsy.  Replace with per-aircraft handling.
 vector<FGPanelNode*> all_3d_panels;
-bool fgHandle3DPanelMouseEvent(int button, int updown, int x, int y)
+bool fgHandle3DPanelMouseEvent( int button, int updown, int x, int y )
 {
-    for(int i=0; i<all_3d_panels.size(); i++)
-        if(all_3d_panels[i]->doMouseAction(button, updown, x, y))
+    for ( unsigned int i = 0; i < all_3d_panels.size(); i++ ) {
+        if ( all_3d_panels[i]->doMouseAction(button, updown, x, y) ) {
             return true;
+        }
+    }
     return false;
 }
 
 void fgUpdate3DPanels()
 {
-    for(int i=0; i<all_3d_panels.size(); i++)
+    for ( unsigned int i = 0; i < all_3d_panels.size(); i++ ) {
         all_3d_panels[i]->getPanel()->updateMouseDelay();
+    }
 }
 
 FGPanelNode::FGPanelNode(SGPropertyNode* props)
 {
+    int i;
+
     // Make an FGPanel object.  But *don't* call init() or bind() on
     // it -- those methods touch static state.
     _panel = fgReadPanel(props->getStringValue("path"));
@@ -43,7 +50,7 @@ FGPanelNode::FGPanelNode(SGPropertyNode* props)
     // Initialize the matrices to the identity.  PLib prints warnings
     // when trying to invert singular matrices (e.g. when not using a
     // 3D panel).
-    for(int i=0; i<4; i++)
+    for(i=0; i<4; i++)
         for(int j=0; j<4; j++)
             _lastModelview[4*i+j] = _lastProjection[4*i+j] = i==j ? 1 : 0;
 
@@ -73,7 +80,6 @@ FGPanelNode::FGPanelNode(SGPropertyNode* props)
     // perpendicular cross product.
     float *a = _bottomLeft, *b = _bottomRight, *c = _topLeft, *m = _xform;
     float u[3], v[3], w[3];
-    int i;
     for(i=0; i<3; i++) u[i] = b[i] - a[i]; // U = B - A
     for(i=0; i<3; i++) v[i] = c[i] - a[i]; // V = C - A