]> git.mxchange.org Git - flightgear.git/commitdiff
Added a second minimalistic HUD.
authorcurt <curt>
Mon, 24 Aug 1998 20:05:15 +0000 (20:05 +0000)
committercurt <curt>
Mon, 24 Aug 1998 20:05:15 +0000 (20:05 +0000)
Added code to display the number of triangles rendered.

Cockpit/cockpit.cxx
Cockpit/hud.cxx
Cockpit/hud.hxx

index 6c68c6d52aacb467311c02b30e07bcbfb89c7866..cef383f0569b8a09ebca18d4a02293a051a06629 100644 (file)
@@ -247,6 +247,12 @@ double get_vfc_ratio( void )
     return pview->vfc_ratio;
 }
 
+double get_vfc_tris_drawn   ( void )
+{
+    return current_view.tris_rendered;
+}
+
+
 bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
 {
     fgPrintf( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem\n");
@@ -303,9 +309,13 @@ void fgCockpitUpdate( void ) {
 
 
 /* $Log$
-/* Revision 1.13  1998/08/22 01:19:27  curt
-/* Omit panel code because it's texture loading overruns array bounds.
+/* Revision 1.14  1998/08/24 20:05:15  curt
+/* Added a second minimalistic HUD.
+/* Added code to display the number of triangles rendered.
 /*
+ * Revision 1.13  1998/08/22 01:19:27  curt
+ * Omit panel code because it's texture loading overruns array bounds.
+ *
  * Revision 1.12  1998/07/13 21:28:00  curt
  * Converted the aoa scale to a radio altimeter.
  *
index 52ee79f45bdee7ba1d6b2a26e83b13a88d761212..de8b2518bf2d3fd8175dc8330c8d6c2e2d30b8b0 100644 (file)
@@ -124,8 +124,8 @@ int yy;
 
        glPushMatrix();
   glRotatef(theta * RAD_TO_DEG, 0.0, 0.0, 1.0);
-  xx = x * cos(theta) + y * sin( theta );
-  yy = y * cos(theta) - x * sin( theta );
+  xx = (int)(x * cos(theta) + y * sin( theta ));
+  yy = (int)(y * cos(theta) - x * sin( theta ));
        glTranslatef( xx, yy, 0);
        glScalef(.1, .1, 0.0);
        while (*msg) {
@@ -463,13 +463,327 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
         break;
 
       case 20:
+         switch( current_options.get_tris_or_culled() ) {
+         case 0:
+             HIptr = (instr_item *) new instr_label( 10,
+                                                     25,
+                                                     90,
+                                                     10,
+                                                     get_vfc_tris_drawn,
+                                                     "%.0f",
+                                                     "Tris Rendered = ",
+                                                     NULL,
+                                                     1.0,
+                                                     HUDS_TOP,
+                                                     RIGHT_JUST,
+                                                     SMALL,
+                                                     0,
+                                                     TRUE );
+             break;
+         case 1:
+             HIptr = (instr_item *) new instr_label( 10,
+                                                     25,
+                                                     90,
+                                                     10,
+                                                     get_vfc_ratio,
+                                                     "%.2f",
+                                                     "VFC Ratio = ",
+                                                     NULL,
+                                                     1.0,
+                                                     HUDS_TOP,
+                                                     RIGHT_JUST,
+                                                     SMALL,
+                                                     0,
+                                                     TRUE );
+             break;
+         }
+         break;
+
+      case 21:
         HIptr = (instr_item *) new instr_label( 10,
-                                                25,
+                                                40,
                                                 90,
                                                 10,
-                                                 get_vfc_ratio,
-                                                "%.2f",
-                                                "VFC Ratio = ",
+                                                get_fov,
+                                                "%.1f",
+                                                "FOV = ",
+                                                NULL,
+                                               1.0,
+                                                HUDS_TOP,
+                                                RIGHT_JUST,
+                                                SMALL,
+                                                0,
+                                                TRUE );
+        break;
+
+      default:
+        HIptr = 0;;
+      }
+    if( HIptr ) {                   // Anything to install?
+      HUD_deque.insert( HUD_deque.begin(), HIptr);
+      }
+    index++;
+    }
+  while( HIptr );
+
+  return 0;  // For now. Later we may use this for an error code.
+}
+
+int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
+{
+  instr_item *HIptr;
+  int index;
+
+  fgPrintf( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD\n" );
+
+  HUD_deque.erase( HUD_deque.begin(), HUD_deque.end());  // empty the HUD deque
+
+//  hud->code = 1;
+//  hud->status = 0;
+
+  // For now lets just hardcode the hud here.
+  // In the future, hud information has to come from the same place
+  // aircraft information came from.
+
+//  fgHUDSetTimeMode( hud, NIGHT );
+//  fgHUDSetBrightness( hud, BRT_LIGHT );
+
+//  index = 0;
+  index = 19;  
+
+  do {
+    switch ( index ) {
+      case 0:     // TBI
+        HIptr = (instr_item *) new fgTBI_instr( 270, 100, 60, 10 );
+        break;
+
+      case 1:     // Artificial Horizon
+        HIptr = (instr_item *) new HudLadder( 240, 195, 120, 180 );
+        break;
+
+      case 2:    // KIAS
+        HIptr = (instr_item *) new hud_card( 130,
+                                             170,
+                                              28,
+                                             200,
+                                             get_speed,
+                                             HUDS_LEFT | HUDS_VERT,
+                                             200.0, 0.0,
+                                             1.0,
+                                             10,  5,
+                                             0,
+                                             0,
+                                             50.0,
+                                             true);
+
+        break;
+
+      case 3:    // Radio Altimeter
+        HIptr = (instr_item *) new hud_card( 420,
+                                             195,
+                                              25,
+                                             150,
+                                             get_agl,
+                                             HUDS_LEFT | HUDS_VERT,
+                                             1000, 0,
+                                             1.0,
+                                             25,    5,
+                                             0,
+                                             0,
+                                             200.0,
+                                             true);
+        break;
+
+      case 4:    // GYRO COMPASS
+        HIptr = (instr_item *) new hud_card( 200,
+                                             375,
+                                             200,
+                                              28,
+                                             get_heading,
+                                             HUDS_TOP,
+                                             360, 0,
+                                               1.0,
+                                               5,   1,
+                                             360,
+                                               0,
+                                              25,
+                                             true);
+        break;
+
+      case 5:    // AMSL
+        HIptr = (instr_item *) new hud_card( 460,
+                                             170,
+                                              35,
+                                             200,
+                                             get_altitude,
+                                             HUDS_RIGHT | HUDS_VERT,
+                                             15000, 0,
+                                             1.0,
+                                             100,  25,
+                                             0,
+                                             0,
+                                             250,
+                                             true);
+        break;
+
+      case 6:
+        HIptr = (instr_item *) new  guage_instr( 250,            // x
+                                                 350,            // y
+                                                 100,            // width
+                                                  20,            // height
+                                                 get_aileronval, // data source
+                                                 HUDS_BOTTOM | HUDS_NOTEXT,
+                                                 100.0,
+                                                 +1.0,
+                                                 -1.0);
+        break;
+
+      case 7:
+        HIptr = (instr_item *) new  guage_instr( 170,             // x
+                                                 225,             // y
+                                                  20,             // width
+                                                 100,             // height
+                                                 get_elevatorval, // data source
+                                                 HUDS_RIGHT | HUDS_VERT | HUDS_NOTEXT,
+                                                -100.0,           // Scale data
+                                                  +1.0,           // Data Range
+                                                  -1.0);
+        break;
+
+      case 8:
+        HIptr = (instr_item *) new  guage_instr( 250,             // x
+                                                 200,             // y
+                                                 100,             // width
+                                                  20,             // height
+                                                 get_rudderval,   // data source
+                                                 HUDS_TOP | HUDS_NOTEXT,
+                                                 100.0,
+                                                 +1.0,
+                                                 -1.0);
+        break;
+
+      case 9:
+        HIptr = (instr_item *) new  guage_instr( 100,             // x
+                                                 190,
+                                                  20,
+                                                 160,             // height
+                                                 get_throttleval, // data source
+                                                 HUDS_VERT | HUDS_RIGHT | HUDS_NOTEXT,
+                                                 100.0,
+                                                   1.0,
+                                                   0.0);
+        break;
+
+      case 10:    // Digital KIAS
+        HIptr = (instr_item *) new instr_label ( 110,
+                                                 150,
+                                                  40,
+                                                  30,
+                                                 get_speed,
+                                                 "%5.0f",
+                                                 NULL,
+                                                 " Kts",
+                                                 1.0,
+                                                 HUDS_TOP,
+                                                 RIGHT_JUST,
+                                                 SMALL,
+                                                 0,
+                                                 TRUE );
+        break;
+
+      case 11:    // Digital Altimeter
+        HIptr = (instr_item *) new instr_label ( 110,
+                                                 135,
+                                                  40,
+                                                  10,
+                                                 get_altitude,
+                                                 "MSL  %5.0f",
+                                                 NULL,
+                                                 " m",
+                                                 1.0,
+                                                 HUDS_TOP,
+                                                 LEFT_JUST,
+                                                 SMALL,
+                                                 0,
+                                                 TRUE );
+        break;
+
+      case 12:    // Roll indication diagnostic
+        HIptr = (instr_item *) new instr_label ( 110,
+                                                 120,
+                                                  40,
+                                                  10,
+                                                 get_roll,
+                                                 "%5.2f",
+                                                 " Roll",
+                                                 " Deg",
+                                                 1.0,
+                                                 HUDS_TOP,
+                                                 RIGHT_JUST,
+                                                 SMALL,
+                                                 0,
+                                                 TRUE );
+        break;
+
+      case 13:    // Angle of attack diagnostic
+        HIptr = (instr_item *) new instr_label ( 440,
+                                                 150,
+                                                  60,
+                                                  10,
+                                                 get_aoa,
+                                                 "      %5.2f",
+                                                 "AOA",
+                                                 " Deg",
+                                                 1.0,
+                                                 HUDS_TOP,
+                                                 RIGHT_JUST,
+                                                 SMALL,
+                                                 0,
+                                                 TRUE );
+        break;
+
+      case 14:
+        HIptr = (instr_item *) new instr_label ( 440,
+                                                 135,
+                                                  60,
+                                                  10,
+                                                 get_heading,
+                                                 " %5.1f",
+                                                 "Heading ",
+                                                 " Deg",
+                                                 1.0,
+                                                 HUDS_TOP,
+                                                 RIGHT_JUST,
+                                                 SMALL,
+                                                 0,
+                                                 TRUE );
+        break;
+
+      case 15:
+        HIptr = (instr_item *) new instr_label ( 440,
+                                                 120,
+                                                  60,
+                                                  10,
+                                                 get_sideslip,
+                                                 "%5.2f",
+                                                 "Sideslip ",
+                                                 NULL,
+                                                 1.0,
+                                                 HUDS_TOP,
+                                                 RIGHT_JUST,
+                                                 SMALL,
+                                                 0,
+                                                 TRUE );
+        break;
+
+      case 16:
+        HIptr = (instr_item *) new instr_label( 440,
+                                                100,
+                                                 60,
+                                                 10,
+                                                get_throttleval,
+                                                "%5.2f",
+                                                "Throttle ",
                                                 NULL,
                                                  1.0,
                                                 HUDS_TOP,
@@ -479,6 +793,95 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
                                                 TRUE );
         break;
 
+      case 17:
+        HIptr = (instr_item *) new instr_label( 440,
+                                                 85,
+                                                 60,
+                                                 10,
+                                                get_elevatorval,
+                                                "%5.2f",
+                                                "Elevator ",
+                                                NULL,
+                                                 1.0,
+                                                HUDS_TOP,
+                                                RIGHT_JUST,
+                                                SMALL,
+                                                0,
+                                                TRUE );
+        break;
+
+      case 18:
+        HIptr = (instr_item *) new instr_label( 440,
+                                                 60,
+                                                 60,
+                                                 10,
+                                                get_aileronval,
+                                                "%5.2f",
+                                                "Aileron  ",
+                                                NULL,
+                                                 1.0,
+                                                HUDS_TOP,
+                                                RIGHT_JUST,
+                                                SMALL,
+                                                0,
+                                                TRUE );
+        break;
+
+
+      case 19:
+        HIptr = (instr_item *) new instr_label( 10,
+                                                10,
+                                                60,
+                                                10,
+                                                 get_frame_rate,
+                                                "%.1f",
+                                                "Frame rate = ",
+                                                NULL,
+                                                 1.0,
+                                                HUDS_TOP,
+                                                RIGHT_JUST,
+                                                SMALL,
+                                                0,
+                                                TRUE );
+        break;
+
+      case 20:
+                 switch( current_options.get_tris_or_culled() ) {
+                         case 0:
+                                 HIptr = (instr_item *) new instr_label( 10,
+                                         25,
+                                         90,
+                                         10,
+                                         get_vfc_tris_drawn,                                                                                           
+                                         "%.0f",
+                                         "Tris Rendered = ",
+                                         NULL,
+                                         1.0,
+                                         HUDS_TOP,
+                                         RIGHT_JUST,
+                                         SMALL,
+                                         0,
+                                         TRUE );
+                                 break;
+                         case 1:
+                                 HIptr = (instr_item *) new instr_label( 10,
+                                         25,
+                                         90,
+                                         10,
+                                         get_vfc_ratio,
+                                         "%.2f",
+                                         "VFC Ratio = ",
+                                         NULL,
+                                         1.0,
+                                         HUDS_TOP,
+                                         RIGHT_JUST,
+                                         SMALL,
+                                         0,
+                                         TRUE );
+                                 break;
+                 }
+                 break;
+               
       case 21:
         HIptr = (instr_item *) new instr_label( 10,
                                                 40,
@@ -696,9 +1099,13 @@ void fgUpdateHUD( void ) {
 }
 
 /* $Log$
-/* Revision 1.19  1998/07/30 23:44:05  curt
-/* Tweaks for sgi building.
+/* Revision 1.20  1998/08/24 20:05:16  curt
+/* Added a second minimalistic HUD.
+/* Added code to display the number of triangles rendered.
 /*
+ * Revision 1.19  1998/07/30 23:44:05  curt
+ * Tweaks for sgi building.
+ *
  * Revision 1.18  1998/07/20 12:47:55  curt
  * Replace the hud rendering for loop (which linearly searches the the hud
  * list to find the entry with the proper position) with a simple linear
index 91df15a8d319ac7f9d3288fa12d9ec3eb74c7eb0..b324433a355b7a33d133db0eab2ba688bb9a2968 100644 (file)
@@ -174,6 +174,7 @@ extern double get_longitude   ( void );
 extern double get_long_min    ( void );
 extern double get_fov         ( void );
 extern double get_vfc_ratio   ( void );
+extern double get_vfc_tris_drawn   ( void );
 
 enum  hudinstype{ HUDno_instr,
               HUDscale,
@@ -495,6 +496,7 @@ class HudLadder : public dual_instr_item {
 
 extern void HUD_brightkey( bool incr_bright );
 extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
+extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
 extern void fgUpdateHUD( void );
 
 extern void drawOneLine ( UINT x1, UINT y1, UINT x2, UINT y2);
@@ -523,10 +525,14 @@ void fgHUDSetTimeMode( Hptr hud, int time_of_day );
 #endif // _HUD_H
 
 /* $Log$
-/* Revision 1.11  1998/07/24 21:36:55  curt
-/* Ran dos2unix to get rid of extraneous ^M's.  Tweaked parameter in
-/* ImageGetRawData() to match usage.
+/* Revision 1.12  1998/08/24 20:05:17  curt
+/* Added a second minimalistic HUD.
+/* Added code to display the number of triangles rendered.
 /*
+ * Revision 1.11  1998/07/24 21:36:55  curt
+ * Ran dos2unix to get rid of extraneous ^M's.  Tweaked parameter in
+ * ImageGetRawData() to match usage.
+ *
  * Revision 1.10  1998/07/13 21:28:02  curt
  * Converted the aoa scale to a radio altimeter.
  *