]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud.hxx
8556e4b240f21120beea04d35ab2c6aed2c7a753
[flightgear.git] / src / Cockpit / hud.hxx
1 // hud.hxx -- hud defines and prototypes (initial draft)
2 //
3 // Written by Michele America, started September 1997.
4 //
5 // Copyright (C) 1997  Michele F. America  - nomimarketing@mail.telepac.pt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _OLDHUD_HXX
25 #define _OLDHUD_HXX
26
27 #ifndef __cplusplus
28 # error This library requires C++
29 #endif
30
31 #include <simgear/compiler.h>
32
33 #ifdef HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36
37 #ifdef HAVE_WINDOWS_H
38 #  include <windows.h>
39 #endif
40
41 #include <stdlib.h>
42 #include <string.h>
43
44 #include <algorithm>    // for_each()
45 #include <vector>       // STL vector
46 #include <deque>        // STL double ended queue
47 #include STL_FSTREAM
48
49 #include <osg/State>
50
51 #include <simgear/math/SGMath.hxx>
52 #include <simgear/constants.h>
53
54 #include <Include/fg_typedefs.h>
55 #include <Aircraft/aircraft.hxx>
56 #include <Aircraft/controls.hxx>
57 #include <FDM/flight.hxx>
58 #include <GUI/gui.h>
59 #include <Main/fg_props.hxx>
60 #include <Main/globals.hxx>
61 #include <Main/viewmgr.hxx>
62 #include <Airports/runways.hxx>
63
64 #include <plib/sg.h>
65
66 SG_USING_STD(deque);
67 SG_USING_STD(vector);
68 SG_USING_NAMESPACE(std);
69
70 #define float_to_int(v) SGMiscf::roundToInt(v)
71
72 // some of Norman's crazy optimizations. :-)
73
74 #ifndef WIN32
75 typedef struct {
76     int x, y;
77 } POINT;
78
79 typedef struct {
80     int top, bottom, left, right;
81 } RECT;
82 #endif
83
84 // View mode definitions
85
86 enum VIEW_MODES{ HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
87
88 // Label constants
89 #define HUD_FONT_SMALL     1
90 #define HUD_FONT_LARGE     2
91
92 enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
93
94 #define HUDS_AUTOTICKS           0x0001
95 #define HUDS_VERT                0x0002
96 #define HUDS_HORZ                0x0000
97 #define HUDS_TOP                 0x0004
98 #define HUDS_BOTTOM              0x0008
99 #define HUDS_LEFT     HUDS_TOP
100 #define HUDS_RIGHT    HUDS_BOTTOM
101 #define HUDS_BOTH     (HUDS_LEFT | HUDS_RIGHT)
102 #define HUDS_NOTICKS             0x0010
103 #define HUDS_ARITHTIC            0x0020
104 #define HUDS_DECITICS            0x0040
105 #define HUDS_NOTEXT              0x0080
106
107 // in cockpit.cxx
108 extern float get_throttleval ( void );
109 extern float get_aileronval  ( void );
110 extern float get_elevatorval ( void );
111 extern float get_elev_trimval( void );
112 extern float get_rudderval   ( void );
113 extern float get_speed       ( void );
114 extern float get_aoa         ( void );
115 extern float get_nlf         ( void );
116 extern float get_roll        ( void );
117 extern float get_pitch       ( void );
118 extern float get_heading     ( void );
119 extern float get_view_direction( void );
120 extern float get_altitude    ( void );
121 extern float get_agl         ( void );
122 extern float get_sideslip    ( void );
123 extern float get_frame_rate  ( void );
124 extern float get_latitude    ( void );
125 extern float get_lat_min     ( void );
126 extern float get_longitude   ( void );
127 extern float get_long_min    ( void );
128 extern float get_fov         ( void );
129 extern float get_vfc_ratio   ( void );
130 extern float get_vfc_tris_drawn   ( void );
131 extern float get_vfc_tris_culled   ( void );
132 extern float get_climb_rate  ( void );
133 extern float get_mach( void );
134 extern char *coord_format_lat(float);
135 extern char *coord_format_lon(float);
136
137 // $$$ begin - added, VS Renganathan, 13 Oct 2K
138 extern float get_anzg (void);
139 extern float get_Vx (void);
140 extern float get_Vy (void);
141 extern float get_Vz (void);
142 extern float get_Ax (void);
143 extern float get_Ay (void);
144 extern float get_Az (void);
145 extern int get_iaux1 (void);
146 extern int get_iaux2 (void);
147 extern int get_iaux3 (void);
148 extern int get_iaux4 (void);
149 extern int get_iaux5 (void);
150 extern int get_iaux6 (void);
151 extern int get_iaux7 (void);
152 extern int get_iaux8 (void);
153 extern int get_iaux9 (void);
154 extern int get_iaux10 (void);
155 extern int get_iaux11 (void);
156 extern int get_iaux12 (void);
157 extern float get_aux1(void);
158 extern float get_aux2(void);
159 extern float get_aux3(void);
160 extern float get_aux4(void);
161 extern float get_aux5 (void);
162 extern float get_aux6 (void);
163 extern float get_aux7 (void);
164 extern float get_aux8(void);
165 extern float get_aux9(void);
166 extern float get_aux10(void);
167 extern float get_aux11(void);
168 extern float get_aux12(void);
169 extern float get_aux13(void);
170 extern float get_aux14(void);
171 extern float get_aux15(void);
172 extern float get_aux16(void);
173 extern float get_aux17(void);
174 extern float get_aux18(void);
175 // $$$ end - added, VS Renganathan, 13 Oct 2K
176
177 extern char *get_formated_gmt_time( void );
178
179 enum  hudinstype{ HUDno_instr,
180                   HUDscale,
181                   HUDlabel,
182                   HUDladder,
183                   HUDcirc_ladder,
184                   HUDhorizon,
185                   HUDgauge,
186                   HUDdual_inst,
187                   HUDmoving_scale,
188                   HUDtbi
189 };
190
191 typedef struct gltagRGBTRIPLE { // rgbt
192     GLfloat Blue;
193     GLfloat Green;
194     GLfloat Red;
195 } glRGBTRIPLE;
196
197 class fgLineSeg2D {
198 private:
199     GLfloat x0, y0, x1, y1;
200
201 public:
202     fgLineSeg2D( GLfloat a = 0, GLfloat b =0, GLfloat c = 0, GLfloat d =0 )
203         : x0(a), y0(b),  x1(c), y1(d) {}
204
205     fgLineSeg2D( const fgLineSeg2D & image )
206         : x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
207
208     fgLineSeg2D& operator= ( const fgLineSeg2D & image ) { // seems unused
209         x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
210     }
211
212     void draw() const
213     {
214         glVertex2f(x0, y0);
215         glVertex2f(x1, y1);
216     }
217 };
218
219 class DrawLineSeg2D {
220     public:
221         void operator() (const fgLineSeg2D& elem) const {
222             elem.draw();
223         }
224 };
225
226
227 #define USE_HUD_TextList
228 extern fntTexFont        *HUD_Font;
229 extern float              HUD_TextSize;
230 extern fntRenderer       *HUDtext;
231 extern float HUD_matrix[16];
232
233 class fgText {
234 private:
235     float x, y;
236     char msg[64];
237 public:
238     int digit;
239     fgText(float x = 0, float y = 0, char *c = NULL,int digits=0): x(x), y(y)
240     {
241         strcpy(msg,c);
242         digit=digits;
243     }
244
245     fgText( const fgText & image )
246         : x(image.x), y(image.y),digit(image.digit) { strcpy(msg,image.msg); }
247
248     fgText& operator = ( const fgText & image ) {  // seems unused
249         strcpy(msg,image.msg); x = image.x; y = image.y;digit=image.digit;
250         return *this;
251     }
252
253     ~fgText() { msg[0]='\0'; }  // used but useless
254
255     int getStringWidth ( char *str )
256     {
257         if ( HUDtext && str ) {
258             float r, l ;
259             HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
260             return float_to_int( r - l );
261         }
262         return 0 ;
263     }
264
265     int StringWidth (void )
266     {
267         if ( HUDtext && strlen( msg )) {
268             float r, l ;
269             HUD_Font->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
270             return float_to_int( r - l );
271         }
272         return 0 ;
273     }
274
275     // this code is changed to display Numbers with big/small digits
276     // according to MIL Standards for example Altitude above 10000 ft
277     // is shown as 10ooo.
278
279     void Draw(fntRenderer *fnt,int digits) {
280         if (digits==1) {
281             int c=0,i=0;
282             char *t=msg;
283             int p=4;
284
285             if (t[0]=='-') {
286                 //if negative value then increase the c and p values
287                 //for '-' sign.  c++;
288                 p++;
289             }
290             char *tmp=msg;
291             while (tmp[i]!='\0') {
292                 if ((tmp[i]>='0') && (tmp[i]<='9'))
293                     c++;
294                 i++;
295             }
296             float orig_size = fnt->getPointSize();
297             if (c>p) {
298                 fnt->setPointSize(HUD_TextSize * 0.8);
299                 int p1=c-3;
300                 char *tmp1=msg+p1;
301                 int p2=p1*8;
302
303                 fnt->start2f(x+p2,y);
304                 fnt->puts(tmp1);
305
306                 fnt->setPointSize(HUD_TextSize * 1.2);
307                 char tmp2[64];
308                 strncpy(tmp2,msg,p1);
309                 tmp2[p1]='\0';
310
311                 fnt->start2f(x,y);
312                 fnt->puts(tmp2);
313             } else {
314                 fnt->setPointSize(HUD_TextSize * 1.2);
315                 fnt->start2f( x, y );
316                 fnt->puts(tmp);
317             }
318             fnt->setPointSize(orig_size);
319         } else {
320             //if digits not equal to 1
321             fnt->start2f( x, y );
322             fnt->puts( msg ) ;
323         }
324     }
325
326     void Draw()
327     {
328         guiFnt.drawString( msg, float_to_int(x), float_to_int(y) );
329     }
330 };
331
332 class fgLineList {
333     vector < fgLineSeg2D > List;
334 public:
335     fgLineList( void ) {}
336     void add( const fgLineSeg2D& seg ) { List.push_back(seg); }
337     void erase( void ) { List.erase( List.begin(), List.end() ); }
338     void draw( void ) {
339         glBegin(GL_LINES);
340         for_each( List.begin(), List.end(), DrawLineSeg2D());
341         glEnd();
342     }
343 };
344
345 class fgTextList {
346     fntRenderer *Font;
347     vector< fgText > List;
348 public:
349     fgTextList ( void ) { Font = 0; }
350
351     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
352     void add( const fgText& String ) { List.push_back(String); }
353     void erase( void ) { List.erase( List.begin(), List.end() ); }
354     void draw( void );
355 };
356
357
358 inline void Text( fgTextList &List, float x, float y, char *s)
359 {
360     List.add( fgText( x, y, s) );
361 }
362
363 inline void Text( fgTextList &List, const fgText &me)
364 {
365     List.add(me);
366 }
367
368 inline void Line( fgLineList &List, float x1, float y1, float x2, float y2)
369 {
370     List.add(fgLineSeg2D(x1,y1,x2,y2));
371 }
372
373
374 // Declare our externals
375 extern fgTextList         HUD_TextList;
376 extern fgLineList         HUD_LineList;
377 extern fgLineList         HUD_StippleLineList;
378
379
380 class instr_item {  // An Abstract Base Class (ABC)
381 private:
382     static UINT        instances;     // More than 64K instruments? Nah!
383     static int         brightness;
384     static glRGBTRIPLE color;
385
386     UINT               handle;
387     RECT               scrn_pos;      // Framing - affects scale dimensions
388                                       // and orientation. Vert vs Horz, etc.
389     FLTFNPTR           load_value_fn;
390     float              disp_factor;   // Multiply by to get numbers shown on scale.
391     UINT               opts;
392     bool               is_enabled;
393     bool               broken;
394     UINT               scr_span;      // Working values for draw;
395     POINT              mid_span;      //
396     int                digits;
397
398 public:
399     instr_item( int            x,
400                 int            y,
401                 UINT           height,
402                 UINT           width,
403                 FLTFNPTR       data_source,
404                 float          data_scaling,
405                 UINT           options,
406                 bool           working = true,
407                 int            digit = 0);
408
409     virtual ~instr_item ();
410
411     void    set_data_source ( FLTFNPTR fn ) { load_value_fn = fn; }
412     int     get_brightness  ( void ) { return brightness;}
413     RECT    get_location    ( void ) { return scrn_pos;  }
414     bool    is_broken       ( void ) { return broken;    }
415     bool    enabled         ( void ) { return is_enabled;}
416     bool    data_available  ( void ) { return !!load_value_fn; }
417     float   get_value       ( void ) { return load_value_fn(); }
418     float   data_scaling    ( void ) { return disp_factor; }
419     UINT    get_span        ( void ) { return scr_span;  }
420     POINT   get_centroid    ( void ) { return mid_span;  }
421     UINT    get_options     ( void ) { return opts;      }
422     int     get_digits      ( void ) { return digits;         }
423     inline int get_x() const { return scrn_pos.left; }
424     inline int get_y() const { return scrn_pos.top; }
425     inline int get_width() const { return scrn_pos.right; }
426     inline int get_height() const { return scrn_pos.bottom; }
427
428     UINT    huds_vert     (UINT options) { return (options & HUDS_VERT); }
429     UINT    huds_left     (UINT options) { return (options & HUDS_LEFT); }
430     UINT    huds_right    (UINT options) { return (options & HUDS_RIGHT); }
431     UINT    huds_both     (UINT options) {
432         return ((options & HUDS_BOTH) == HUDS_BOTH);
433     }
434     UINT    huds_noticks  (UINT options) { return (options & HUDS_NOTICKS); }
435     UINT    huds_notext   (UINT options) { return (options & HUDS_NOTEXT); }
436     UINT    huds_top      (UINT options) { return (options & HUDS_TOP); }
437     UINT    huds_bottom   (UINT options) { return (options & HUDS_BOTTOM); }
438
439     virtual void display_enable( bool working ) { is_enabled = working;}
440
441     virtual void break_display ( bool bad );
442     virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
443     void         SetPosition  ( int x, int y, UINT width, UINT height );
444     UINT         get_Handle( void );
445     virtual void draw( void ) = 0;   // Required method in derived classes
446
447     void drawOneLine( float x1, float y1, float x2, float y2)
448     {
449         HUD_LineList.add(fgLineSeg2D(x1,y1,x2,y2));
450     }
451     void drawOneStippleLine( float x1, float y1, float x2, float y2)
452     {
453         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
454     }
455     void TextString( char *msg, float x, float y,int digit )
456     {
457         HUD_TextList.add(fgText(x, y, msg,digit));
458     }
459     int getStringWidth ( char *str )
460     {
461         if ( HUDtext && str ) {
462             float r, l ;
463             HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
464             return float_to_int( r - l );
465         }
466         return 0 ;
467     }
468
469     //code to draw ticks as small circles
470     void drawOneCircle(float x1, float y1, float r)
471     {
472         glBegin(GL_LINE_LOOP);  // Use polygon to approximate a circle
473         for (int count=0; count<25; count++) {
474             float cosine = r * cos(count * 2 * SG_PI/10.0);
475             float sine =   r * sin(count * 2 * SG_PI/10.0);
476             glVertex2f(cosine+x1, sine+y1);
477         }
478         glEnd();
479     }
480
481 };
482
483 typedef instr_item *HIptr;
484
485 class HUDdraw {
486     public:
487         void operator() (HIptr elem) const {
488             if ( elem->enabled())
489                 elem->draw();
490         }
491 };
492
493
494 extern int HUD_style;
495
496 // instr_item           This class has no other purpose than to maintain
497 //                      a linked list of instrument and derived class
498 // object pointers.
499
500
501 class instr_label : public instr_item {
502 private:
503     const char  *pformat;
504     const char  *pre_str;
505     const char  *post_str;
506     fgLabelJust justify;
507     int         fontSize;
508     int         blink;
509     char        format_buffer[80];
510     bool        lat;
511     bool        lon;
512     bool        lbox;
513     SGPropertyNode_ptr lon_node;
514     SGPropertyNode_ptr lat_node;
515
516 public:
517     instr_label(const SGPropertyNode *);
518     virtual void draw(void);
519 };
520
521
522 //
523 // fgRunway_instr   This class is responsible for rendering the active runway
524 //                  in the hud (if visible).
525 class runway_instr : public instr_item {
526 private:
527         void boundPoint(const sgdVec3& v, sgdVec3& m);
528         bool boundOutsidePoints(sgdVec3& v, sgdVec3& m);
529         bool drawLine(const sgdVec3& a1, const sgdVec3& a2,
530                 const sgdVec3& p1, const sgdVec3& p2);
531         void drawArrow();
532         bool get_active_runway(FGRunway& rwy);
533         void get_rwy_points(sgdVec3 *points);
534         void setLineWidth(void);
535
536         sgdVec3 points3d[6], points2d[6];
537         double mm[16],pm[16], arrowScale, arrowRad, lnScale;
538         double scaleDist, default_pitch, default_heading;
539         GLint view[4];
540         FGRunway runway;
541         FGViewer* cockpit_view;
542         unsigned short stippleOut, stippleCen;
543         bool drawIA, drawIAAlways;
544         RECT location;
545         POINT center;
546
547 public:
548     runway_instr(const SGPropertyNode *);
549
550     virtual void draw( void );
551     void setArrowRotationRadius(double radius);
552     // Scales the runway indication arrow
553     void setArrowScale(double scale);
554     // Draws arrow when runway is not visible in HUD if draw=true
555     void setDrawArrow(bool draw);
556     // Always draws arrow if draw=true;
557     void setDrawArrowAlways(bool draw);
558     // Sets the maximum line scale
559     void setLineScale(double scale);
560     // Sets the distance where to start scaling the lines
561     void setScaleDist(double dist_nm);
562     // Sets the stipple pattern of the outline of the runway
563     void setStippleOutline(unsigned short stipple);
564     // Sets the stipple patter of the center line of the runway
565     void setStippleCenterline(unsigned short stipple);
566 };
567
568
569 //
570 // instr_scale           This class is an abstract base class for both moving
571 //                       scale and moving needle (fixed scale) indicators. It
572 // does not draw itself, but is not instanciable.
573 //
574
575 class instr_scale : public instr_item {
576 private:
577     float range_shown;   // Width Units.
578     float Maximum_value; //                ceiling.
579     float Minimum_value; // Representation floor.
580     float scale_factor;  // factor => screen units/range values.
581     UINT   Maj_div;       // major division marker units
582     UINT   Min_div;       // minor division marker units
583     UINT   Modulo;        // Roll over point
584     int    signif_digits; // digits to show to the right.
585
586 public:
587     instr_scale( int          x,
588                  int          y,
589                  UINT         width,
590                  UINT         height,
591                  FLTFNPTR     load_fn,
592                  UINT         options,
593                  float        show_range,
594                  float        max_value,
595                  float        min_value,
596                  float        disp_scaling,
597                  UINT         major_divs,
598                  UINT         minor_divs,
599                  UINT         rollover,
600                  int          dp_showing,
601                  bool         working = true);
602
603     virtual void draw    ( void ) {}; // No-op here. Defined in derived classes.
604     UINT   div_min       ( void ) { return Min_div;}
605     UINT   div_max       ( void ) { return Maj_div;}
606     float  min_val       ( void ) { return Minimum_value;}
607     float  max_val       ( void ) { return Maximum_value;}
608     UINT   modulo        ( void ) { return Modulo; }
609     float  factor        ( void ) { return scale_factor;}
610     float  range_to_show ( void ) { return range_shown;}
611 };
612
613 // hud_card                This class displays the indicated quantity on
614 //                         a scale that moves past the pointer. It may be
615 // horizontal or vertical, read above(left) or below(right) of the base
616 // line.
617
618 class hud_card : public instr_scale {
619 private:
620     float  val_span;
621     string type;
622     float  half_width_units;
623     bool   draw_tick_bottom;
624     bool   draw_tick_top;
625     bool   draw_tick_right;
626     bool   draw_tick_left;
627     bool   draw_cap_bottom;
628     bool   draw_cap_top;
629     bool   draw_cap_right;
630     bool   draw_cap_left;
631     float  marker_offset;
632     bool   pointer;
633     string pointer_type;
634     string tick_type;
635     string tick_length;
636     float  radius;
637     float  maxValue;
638     float  minValue;
639     int    divisions;
640     int    zoom;
641     UINT   Maj_div;
642     UINT   Min_div;
643
644 public:
645     hud_card(const SGPropertyNode *);
646     //    virtual void display_enable( bool setting );                  // FIXME
647     virtual void draw(void);
648     void circles(float, float, float);
649     void fixed(float, float, float, float, float, float);
650     void zoomed_scale(int, int);
651 };
652
653
654 class gauge_instr : public instr_scale {
655 public:
656     gauge_instr(const SGPropertyNode *);
657     virtual void draw( void );       // Required method in base class
658 };
659
660
661 //
662 // dual_instr_item         This class was created to form the base class
663 //                         for both panel and HUD Turn Bank Indicators.
664
665 class dual_instr_item : public instr_item {
666 private:
667     FLTFNPTR alt_data_source;
668
669 public:
670     dual_instr_item ( int       x,
671                       int       y,
672                       UINT      width,
673                       UINT      height,
674                       FLTFNPTR  chn1_source,
675                       FLTFNPTR  chn2_source,
676                       bool      working,
677                       UINT      options );
678
679     float current_ch1( void ) { return (float)alt_data_source(); }
680     float current_ch2( void ) { return (float)get_value(); }
681     virtual void draw( void ) {}
682 };
683
684
685 class fgTBI_instr : public dual_instr_item {
686 private:
687     UINT BankLimit;
688     UINT SlewLimit;
689     UINT scr_hole;
690     bool tsi;
691     float rad;
692
693 public:
694     fgTBI_instr(const SGPropertyNode *);
695
696     UINT bank_limit(void) { return BankLimit; }
697     UINT slew_limit(void) { return SlewLimit; }
698
699     virtual void draw(void);
700 };
701
702
703 class HudLadder : public dual_instr_item {
704 private:
705     UINT   width_units;
706     int    div_units;
707     UINT   minor_div;
708     UINT   label_pos;
709     UINT   scr_hole;
710     float  vmax;
711     float  vmin;
712     float  factor;
713     string hudladder_type;
714     bool   frl;
715     bool   target_spot;
716     bool   velocity_vector;
717     bool   drift_marker;
718     bool   alpha_bracket;
719     bool   energy_marker;
720     bool   climb_dive_marker;
721     bool   glide_slope_marker;
722     float  glide_slope;
723     bool   energy_worm;
724     bool   waypoint_marker;
725     int    zenith;
726     int    nadir;
727     int    hat;
728
729     // The Ladder has it's own temporary display lists
730     fgTextList         TextList;
731     fgLineList         LineList;
732     fgLineList         StippleLineList;
733
734 public:
735     HudLadder(const SGPropertyNode *);
736
737     virtual void draw(void);
738     void drawZenith(float, float, float);
739     void drawNadir(float, float, float);
740
741     void Text(float x, float y, char *s)
742     {
743         TextList.add(fgText(x, y, s));
744     }
745
746     void Line(float x1, float y1, float x2, float y2)
747     {
748         LineList.add(fgLineSeg2D(x1, y1, x2, y2));
749     }
750
751     void StippleLine(float x1, float y1, float x2, float y2)
752     {
753         StippleLineList.add(fgLineSeg2D(x1, y1, x2, y2));
754     }
755 };
756
757
758 extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
759 extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
760 extern void fgUpdateHUD( osg::State* );
761 extern void fgUpdateHUD( osg::State*, GLfloat x_start, GLfloat y_start,
762                          GLfloat x_end, GLfloat y_end );
763
764
765
766
767 class HUD_Properties : public SGPropertyChangeListener {
768 public:
769     HUD_Properties();
770     void valueChanged(SGPropertyNode *n);
771     void setColor() const;
772     bool isVisible() const { return _visible; }
773     bool isAntialiased() const { return _antialiased; }
774     bool isTransparent() const { return _transparent; }
775     float alphaClamp() const { return _cl; }
776
777 private:
778     float clamp(float f) { return f < 0.0f ? 0.0f : f > 1.0f ? 1.0f : f; }
779     SGPropertyNode_ptr _current;
780     SGPropertyNode_ptr _visibility;
781     SGPropertyNode_ptr _antialiasing;
782     SGPropertyNode_ptr _transparency;
783     SGPropertyNode_ptr _red, _green, _blue, _alpha;
784     SGPropertyNode_ptr _alpha_clamp;
785     SGPropertyNode_ptr _brightness;
786     bool _visible;
787     bool _antialiased;
788     bool _transparent;
789     float _r, _g, _b, _a, _cl;
790 };
791
792 #endif // _OLDHUD_H