]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Panel night lighting acts as if lights are always turned on. We don't
[flightgear.git] / src / Cockpit / panel.cxx
index bf5a1c13f87a0073c0e226894584fd648cca0b37..6ec50fd59f57f242085fec72db8e359f731aea1d 100644 (file)
@@ -272,6 +272,7 @@ FGPanel::update (double dt)
     _x_offset = fgGetInt("/sim/panel/x-offset");
     _y_offset = fgGetInt("/sim/panel/y-offset");
     _jitter = fgGetFloat("/sim/panel/jitter");
+    _flipx = fgGetBool("/sim/panel/flip-x");
 
                                // Do nothing if the panel isn't visible.
     if ( !fgPanelVisible() ) {
@@ -330,8 +331,11 @@ FGPanel::update (GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh)
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   glLoadIdentity();
-  gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
-  // gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
+  if ( _flipx ) {
+    gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
+  } else {
+    gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
+  }
   
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
@@ -369,12 +373,14 @@ FGPanel::draw()
   glEnable(GL_BLEND);
   glEnable(GL_ALPHA_TEST);
   glEnable(GL_COLOR_MATERIAL);
-  // glColor4f(1.0, 1.0, 1.0, 1.0);
-  if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) {
-      glColor4fv( cur_light_params.scene_diffuse );
-  } else {
-      glColor4f(0.7, 0.2, 0.2, 1.0);
+  sgVec4 panel_color;
+  sgCopyVec4( panel_color, cur_light_params.scene_diffuse );
+  if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
+      if ( panel_color[0] < 0.7 ) panel_color[0] = 0.7;
+      if ( panel_color[1] < 0.2 ) panel_color[1] = 0.2;
+      if ( panel_color[2] < 0.2 ) panel_color[2] = 0.2;
   }
+  glColor4fv( panel_color );
   if (_bg != 0) {
     glBindTexture(GL_TEXTURE_2D, _bg->getHandle());
     // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -873,12 +879,14 @@ FGTexturedLayer::draw ()
     
                                // From Curt: turn on the panel
                                // lights after sundown.
-    if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) {
-      glColor4fv( cur_light_params.scene_diffuse );
-    } else {
-      glColor4f(0.7, 0.2, 0.2, 1.0);
+    sgVec4 panel_color;
+    sgCopyVec4( panel_color, cur_light_params.scene_diffuse );
+    if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
+        if ( panel_color[0] < 0.7 ) panel_color[0] = 0.7;
+        if ( panel_color[1] < 0.2 ) panel_color[1] = 0.2;
+        if ( panel_color[2] < 0.2 ) panel_color[2] = 0.2;
     }
-
+    glColor4fv( panel_color );
 
     glTexCoord2f(_texture.getMinX(), _texture.getMinY()); glVertex2f(-w2, -h2);
     glTexCoord2f(_texture.getMaxX(), _texture.getMinY()); glVertex2f(w2, -h2);