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