]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud.cxx
remove the rest of the static variables (except one); cleanup
[flightgear.git] / src / Cockpit / hud.cxx
1 // hud.cxx -- hud defines and prototypes
2 //
3 // Written by Michele America, started September 1997.
4 //
5 // Copyright (C) 1997  Michele F. America  - micheleamerica@geocities.com
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 #include <simgear/compiler.h>
24 #include <simgear/structure/exception.hxx>
25
26 #include STL_STRING
27 #include STL_FSTREAM
28
29 #ifdef HAVE_CONFIG_H
30 #  include <config.h>
31 #endif
32
33 #ifdef HAVE_WINDOWS_H
34 #  include <windows.h>
35 #endif
36
37 #ifdef __BORLANDC__
38 #  define exception c_exception
39 #endif
40
41 #include <math.h>
42
43 #include <stdlib.h>
44 #include <stdio.h>              // char related functions
45 #include <string.h>             // strcmp()
46
47 #include SG_GLU_H
48
49 #include <simgear/constants.h>
50 #include <simgear/debug/logstream.hxx>
51 #include <simgear/misc/sg_path.hxx>
52
53 #include <Aircraft/aircraft.hxx>
54 //#include <Autopilot/xmlauto.hxx>
55 #include <GUI/new_gui.hxx>           // FGFontCache
56 #include <Main/globals.hxx>
57 #include <Main/fg_props.hxx>
58 #include <Scenery/scenery.hxx>
59
60 #include "hud.hxx"
61
62
63 static HUD_Properties *HUDprop = 0;
64
65 static char units[5];
66
67 deque<instr_item *> HUD_deque;
68
69 fgTextList HUD_TextList;
70 fgLineList HUD_LineList;
71 fgLineList HUD_StippleLineList;
72
73 fntRenderer *HUDtext = 0;
74 fntTexFont *HUD_Font = 0;
75 float HUD_TextSize = 0;
76 int HUD_style = 0;
77
78 float HUD_matrix[16];
79
80 int readHud( istream &input );
81 int readInstrument ( const SGPropertyNode * node);
82
83 static void drawHUD();
84 static void fgUpdateHUDVirtual();
85
86
87 class locRECT {
88 public:
89     RECT rect;
90
91     locRECT( UINT left, UINT top, UINT right, UINT bottom);
92     RECT get_rect(void) { return rect; }
93 };
94
95 locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
96 {
97     rect.left   =  left;
98     rect.top    =  top;
99     rect.right  =  right;
100     rect.bottom =  bottom;
101
102 }
103 // #define DEBUG
104
105
106
107
108 int readInstrument(const SGPropertyNode * node)
109 {
110     static const SGPropertyNode *startup_units_node
111         = fgGetNode("/sim/startup/units");
112
113     instr_item *HIptr;
114
115     if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
116         strcpy(units, " ft");
117     } else {
118         strcpy(units, " m");
119     }
120
121     const SGPropertyNode * ladder_group = node->getNode("ladders");
122
123     if (ladder_group != 0) {
124         int nLadders = ladder_group->nChildren();
125         for (int j = 0; j < nLadders; j++) {
126             HIptr = static_cast<instr_item *>(new HudLadder(ladder_group->getChild(j)));
127             HUD_deque.insert(HUD_deque.begin(), HIptr);
128         }
129     }
130
131     const SGPropertyNode * card_group = node->getNode("cards");
132     if (card_group != 0) {
133         int nCards = card_group->nChildren();
134         for (int j = 0; j < nCards; j++) {
135             const char *type = card_group->getChild(j)->getStringValue("type", "gauge");
136
137             if (!strcmp(type, "gauge"))
138                 HIptr = static_cast<instr_item *>(new gauge_instr(card_group->getChild(j)));
139             else if (!strcmp(type, "dial") || !strcmp(type, "tape"))
140                 HIptr = static_cast<instr_item *>(new hud_card(card_group->getChild(j)));
141             else {
142                 SG_LOG(SG_INPUT, SG_WARN, "HUD: unknown 'card' type: " << type);
143                 continue;
144             }
145             HUD_deque.insert(HUD_deque.begin(), HIptr);
146         }
147     }
148
149     const SGPropertyNode * label_group = node->getNode("labels");
150     if (label_group != 0) {
151         int nLabels = label_group->nChildren();
152         for (int j = 0; j < nLabels; j++) {
153             HIptr = static_cast<instr_item *>(new instr_label(label_group->getChild(j)));
154             HUD_deque.insert(HUD_deque.begin(), HIptr);
155         }
156     }
157
158     const SGPropertyNode * tbi_group = node->getNode("tbis");
159     if (tbi_group != 0) {
160         int nTbis = tbi_group->nChildren();
161         for (int j = 0; j < nTbis; j++) {
162             HIptr = static_cast<instr_item *>(new fgTBI_instr(tbi_group->getChild(j)));
163             HUD_deque.insert(HUD_deque.begin(), HIptr);
164         }
165     }
166
167     const SGPropertyNode * rwy_group = node->getNode("runways");
168     if (rwy_group != 0) {
169         int nRwy = rwy_group->nChildren();
170         for (int j = 0; j < nRwy; j++) {
171             HIptr = static_cast<instr_item *>(new runway_instr(rwy_group->getChild(j)));
172             HUD_deque.insert(HUD_deque.begin(), HIptr);
173         }
174     }
175     return 0;
176 } //end readinstrument
177
178
179 int readHud( istream &input )
180 {
181
182     SGPropertyNode root;
183
184     try {
185         readProperties(input, &root);
186     } catch (const sg_exception &e) {
187         guiErrorMessage("Error reading HUD: ", e);
188         return 0;
189     }
190
191
192     SG_LOG(SG_INPUT, SG_INFO, "Read properties for  " <<
193            root.getStringValue("name"));
194
195
196     HUD_deque.erase( HUD_deque.begin(), HUD_deque.end());
197
198
199     SG_LOG(SG_INPUT, SG_INFO, "Reading Hud instruments");
200
201     const SGPropertyNode * instrument_group = root.getChild("instruments");
202     int nInstruments = instrument_group->nChildren();
203
204     for (int i = 0; i < nInstruments; i++) {
205
206         const SGPropertyNode * node = instrument_group->getChild(i);
207
208         SGPath path( globals->get_fg_root() );
209         path.append(node->getStringValue("path"));
210
211         SG_LOG(SG_INPUT, SG_INFO, "Reading Instrument "
212                << node->getName()
213                << " from "
214                << path.str());
215
216         SGPropertyNode root2;
217         try {
218             readProperties(path.str(), &root2);
219         } catch (const sg_exception &e) {
220             guiErrorMessage("Error reading HUD instrument: ", e);
221             continue;
222         }
223         readInstrument(&root2);
224     }//for loop(i)
225
226     return 0;
227 }
228
229
230 // fgHUDInit
231 //
232 // Constructs a HUD object and then adds in instruments. At the present
233 // the instruments are hard coded into the routine. Ultimately these need
234 // to be defined by the aircraft's instrumentation records so that the
235 // display for a Piper Cub doesn't show the speed range of a North American
236 // mustange and the engine readouts of a B36!
237 //
238 int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
239 {
240
241     HUD_style = 1;
242
243     SG_LOG( SG_COCKPIT, SG_INFO, "Initializing current aircraft HUD" );
244
245     string hud_path =
246         fgGetString("/sim/hud/path", "Huds/Default/default.xml");
247     SGPath path(globals->get_fg_root());
248     path.append(hud_path);
249
250     ifstream input(path.c_str());
251     if (!input.good()) {
252         SG_LOG(SG_INPUT, SG_ALERT,
253                "Cannot read Hud configuration from " << path.str());
254     } else {
255         readHud(input);
256         input.close();
257     }
258
259     fgHUDReshape();
260
261     if ( HUDtext ) {
262         // this chunk of code is not necessarily thread safe if the
263         // compiler optimizer reorders these statements.  Note that
264         // "delete ptr" does not set "ptr = NULL".  We have to do that
265         // ourselves.
266         fntRenderer *tmp = HUDtext;
267         HUDtext = NULL;
268         delete tmp;
269     }
270
271     FGFontCache *fc = globals->get_fontcache();
272     HUD_Font = fc->getTexFont(fgGetString("/sim/hud/font/name", "Helvetica.txf"));
273     if (!HUD_Font)
274         throw sg_throwable(string("/sim/hud/font/name is not a texture font"));
275
276     HUD_TextSize = fgGetFloat("/sim/hud/font/size", 10);
277
278     HUDtext = new fntRenderer();
279     HUDtext->setFont(HUD_Font);
280     HUDtext->setPointSize(HUD_TextSize);
281     HUD_TextList.setFont( HUDtext );
282
283     if (!HUDprop)
284         HUDprop = new HUD_Properties;
285     return 0;  // For now. Later we may use this for an error code.
286
287 }
288
289
290 int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
291 {
292
293     HUD_style = 2;
294
295     SG_LOG( SG_COCKPIT, SG_INFO, "Initializing current aircraft HUD" );
296
297     SGPath path(globals->get_fg_root());
298     path.append("Huds/Minimal/default.xml");
299
300
301     ifstream input(path.c_str());
302     if (!input.good()) {
303         SG_LOG(SG_INPUT, SG_ALERT,
304                "Cannot read Hud configuration from " << path.str());
305     } else {
306         readHud(input);
307         input.close();
308     }
309
310     if (!HUDprop)
311         HUDprop = new HUD_Properties;
312     return 0;  // For now. Later we may use this for an error code.
313
314 }
315 //$$$ End - added, Neetha, 28 Nov 2k
316
317
318 void fgHUDReshape(void) {
319 #if 0
320     if ( HUDtext ) {
321         // this chunk of code is not necessarily thread safe if the
322         // compiler optimizer reorders these statements.  Note that
323         // "delete ptr" does not set "ptr = NULL".  We have to do that
324         // ourselves.
325         fntRenderer *tmp = HUDtext;
326         HUDtext = NULL;
327         delete tmp;
328     }
329
330     HUD_TextSize = fgGetInt("/sim/startup/xsize") / 60;
331     HUD_TextSize = 10;
332     HUDtext = new fntRenderer();
333     HUDtext -> setFont      ( guiFntHandle ) ;
334     HUDtext -> setPointSize ( HUD_TextSize ) ;
335     HUD_TextList.setFont( HUDtext );
336 #endif
337 }
338
339
340 // fgUpdateHUD
341 //
342 // Performs a once around the list of calls to instruments installed in
343 // the HUD object with requests for redraw. Kinda. It will when this is
344 // all C++.
345 //
346 void fgUpdateHUD( void ) {
347
348     static const SGPropertyNode *enable3d_node = fgGetNode("/sim/hud/enable3d");
349     if ( HUD_style == 1 && enable3d_node->getBoolValue() ) {
350         fgUpdateHUDVirtual();
351         return;
352     }
353
354     static const float normal_aspect = float(640) / float(480);
355     // note: aspect_ratio is Y/X
356     float current_aspect = 1.0f/globals->get_current_view()->get_aspect_ratio();
357     if ( current_aspect > normal_aspect ) {
358         float aspect_adjust = current_aspect / normal_aspect;
359         float adjust = 320.0f*aspect_adjust - 320.0f;
360         fgUpdateHUD( -adjust, 0.0f, 640.0f+adjust, 480.0f );
361     } else {
362         float aspect_adjust = normal_aspect / current_aspect;
363         float adjust = 240.0f*aspect_adjust - 240.0f;
364         fgUpdateHUD( 0.0f, -adjust, 640.0f, 480.0f+adjust );
365     }
366 }
367
368 void fgUpdateHUDVirtual()
369 {
370     FGViewer* view = globals->get_current_view();
371
372     // Standard fgfs projection, with essentially meaningless clip
373     // planes (we'll map the whole HUD plane to z=-1)
374     glMatrixMode(GL_PROJECTION);
375     glPushMatrix();
376     glLoadIdentity();
377     gluPerspective(view->get_v_fov(), 1/view->get_aspect_ratio(), 0.1, 10);
378
379     glMatrixMode(GL_MODELVIEW);
380     glPushMatrix();
381     glLoadIdentity();
382
383     // Standard fgfs view direction computation
384     float lookat[3];
385     lookat[0] = -sin(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
386     lookat[1] = tan(SG_DEGREES_TO_RADIANS * view->getPitchOffset_deg());
387     lookat[2] = -cos(SG_DEGREES_TO_RADIANS * view->getHeadingOffset_deg());
388     if (fabs(lookat[1]) > 9999)
389         lookat[1] = 9999; // FPU sanity
390     gluLookAt(0, 0, 0, lookat[0], lookat[1], lookat[2], 0, 1, 0);
391
392     // Map the -1:1 square to a 55.0x41.25 degree wide patch at z=1.
393     // This is the default fgfs field of view, which the HUD files are
394     // written to assume.
395     float dx = 0.52056705; // tan(55/2)
396     float dy = dx * 0.75;  // assumes 4:3 aspect ratio
397     float m[16];
398     m[0] = dx; m[4] =  0; m[ 8] = 0; m[12] = 0;
399     m[1] =  0; m[5] = dy; m[ 9] = 0; m[13] = 0;
400     m[2] =  0; m[6] =  0; m[10] = 1; m[14] = 0;
401     m[3] =  0; m[7] =  0; m[11] = 0; m[15] = 1;
402     glMultMatrixf(m);
403
404     // Convert the 640x480 "HUD standard" coordinate space to a square
405     // about the origin in the range [-1:1] at depth of -1
406     glScalef(1./320, 1./240, 1);
407     glTranslatef(-320, -240, -1);
408
409     // Do the deed
410     drawHUD();
411
412     // Clean up our mess
413     glMatrixMode(GL_PROJECTION);
414     glPopMatrix();
415     glMatrixMode(GL_MODELVIEW);
416     glPopMatrix();
417 }
418
419
420 void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
421                   GLfloat x_end, GLfloat y_end )
422 {
423     glMatrixMode(GL_PROJECTION);
424     glPushMatrix();
425     glLoadIdentity();
426     gluOrtho2D(x_start, x_end, y_start, y_end);
427
428     glMatrixMode(GL_MODELVIEW);
429     glPushMatrix();
430     glLoadIdentity();
431
432     drawHUD();
433
434     glMatrixMode(GL_PROJECTION);
435     glPopMatrix();
436     glMatrixMode(GL_MODELVIEW);
437     glPopMatrix();
438 }
439
440
441 void drawHUD()
442 {
443     if ( !HUD_deque.size() ) // Trust everyone, but ALWAYS cut the cards!
444         return;
445
446     HUD_TextList.erase();
447     HUD_LineList.erase();
448     // HUD_StippleLineList.erase();
449
450     glDisable(GL_DEPTH_TEST);
451     glDisable(GL_LIGHTING);
452
453     static const SGPropertyNode *heading_enabled
454         = fgGetNode("/autopilot/locks/heading", true);
455     static const SGPropertyNode *altitude_enabled
456         = fgGetNode("/autopilot/locks/altitude", true);
457
458     static char hud_hdg_text[256];
459     static char hud_wp0_text[256];
460     static char hud_wp1_text[256];
461     static char hud_wp2_text[256];
462     static char hud_alt_text[256];
463
464     glEnable(GL_BLEND);
465     if (HUDprop->isTransparent())
466         glBlendFunc(GL_SRC_ALPHA, GL_ONE);
467     else
468         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
469
470     if (HUDprop->isAntialiased()) {
471         glEnable(GL_LINE_SMOOTH);
472         glAlphaFunc(GL_GREATER, HUDprop->alphaClamp());
473         glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
474         //glLineWidth(1.5);
475     } else {
476         //glLineWidth(1.0);
477     }
478
479     HUDprop->setColor();
480     for_each(HUD_deque.begin(), HUD_deque.end(), HUDdraw());
481
482     //HUD_TextList.add( fgText(40, 10, get_formated_gmt_time(), 0) );
483
484
485     int apY = 480 - 80;
486
487
488     if (strcmp( heading_enabled->getStringValue(), "dg-heading-hold") == 0 ) {
489         snprintf( hud_hdg_text, 256, "hdg = %.1f\n",
490                   fgGetDouble("/autopilot/settings/heading-bug-deg") );
491         HUD_TextList.add( fgText( 40, apY, hud_hdg_text ) );
492         apY -= 15;
493     } else if ( strcmp(heading_enabled->getStringValue(), "true-heading-hold") == 0 ) {
494         snprintf( hud_hdg_text, 256, "hdg = %.1f\n",
495                   fgGetDouble("/autopilot/settings/true-heading-deg") );
496         HUD_TextList.add( fgText( 40, apY, hud_hdg_text ) );
497         apY -= 15;
498
499         string wp0_id = fgGetString( "/autopilot/route-manager/wp[0]/id" );
500         if ( wp0_id.length() > 0 ) {
501             snprintf( hud_wp0_text, 256, "%5s %6.1fnm %s", wp0_id.c_str(),
502                       fgGetDouble( "/autopilot/route-manager/wp[0]/dist" ),
503                       fgGetString( "/autopilot/route-manager/wp[0]/eta" ) );
504             HUD_TextList.add( fgText( 40, apY, hud_wp0_text ) );
505             apY -= 15;
506         }
507         string wp1_id = fgGetString( "/autopilot/route-manager/wp[1]/id" );
508         if ( wp1_id.length() > 0 ) {
509             snprintf( hud_wp1_text, 256, "%5s %6.1fnm %s", wp1_id.c_str(),
510                       fgGetDouble( "/autopilot/route-manager/wp[1]/dist" ),
511                       fgGetString( "/autopilot/route-manager/wp[1]/eta" ) );
512             HUD_TextList.add( fgText( 40, apY, hud_wp1_text ) );
513             apY -= 15;
514         }
515         string wp2_id = fgGetString( "/autopilot/route-manager/wp-last/id" );
516         if ( wp2_id.length() > 0 ) {
517             snprintf( hud_wp2_text, 256, "%5s %6.1fnm %s", wp2_id.c_str(),
518                       fgGetDouble( "/autopilot/route-manager/wp-last/dist" ),
519                       fgGetString( "/autopilot/route-manager/wp-last/eta" ) );
520             HUD_TextList.add( fgText( 40, apY, hud_wp2_text ) );
521             apY -= 15;
522         }
523     }
524
525     if ( strcmp( altitude_enabled->getStringValue(), "altitude-hold" ) == 0 ) {
526         snprintf( hud_alt_text, 256, "alt = %.0f\n",
527                   fgGetDouble("/autopilot/settings/target-altitude-ft") );
528         HUD_TextList.add( fgText( 40, apY, hud_alt_text ) );
529         apY -= 15;
530     } else if ( strcmp( altitude_enabled->getStringValue(), "agl-hold" ) == 0 ){
531         snprintf( hud_alt_text, 256, "agl = %.0f\n",
532                   fgGetDouble("/autopilot/settings/target-agl-ft") );
533         HUD_TextList.add( fgText( 40, apY, hud_alt_text ) );
534         apY -= 15;
535     }
536
537     HUD_TextList.draw();
538     HUD_LineList.draw();
539
540     // glEnable(GL_LINE_STIPPLE);
541     // glLineStipple( 1, 0x00FF );
542     // HUD_StippleLineList.draw();
543     // glDisable(GL_LINE_STIPPLE);
544
545     if (HUDprop->isAntialiased()) {
546         glDisable(GL_ALPHA_TEST);
547         glDisable(GL_LINE_SMOOTH);
548         //glLineWidth(1.0);
549     }
550
551     glEnable(GL_DEPTH_TEST);
552     glEnable(GL_LIGHTING);
553 }
554
555
556 void fgTextList::draw()
557 {
558     if (!Font)
559         return;
560
561     vector<fgText>::iterator curString = List.begin();
562     vector<fgText>::iterator lastString = List.end();
563
564     glPushAttrib(GL_COLOR_BUFFER_BIT);
565     glEnable(GL_BLEND);
566     if (HUDprop->isTransparent())
567         glBlendFunc(GL_SRC_ALPHA, GL_ONE);
568     else
569         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
570
571     if (HUDprop->isAntialiased()) {
572         glEnable(GL_ALPHA_TEST);
573         glAlphaFunc(GL_GREATER, HUDprop->alphaClamp());
574     }
575
576     Font->begin();
577     for (; curString != lastString; curString++)
578         curString->Draw(Font,curString->digit);
579     Font->end();
580
581     glDisable(GL_TEXTURE_2D);
582     glPopAttrib();
583 }
584
585
586 // HUD property listener class
587 //
588 HUD_Properties::HUD_Properties() :
589     _current(fgGetNode("/sim/hud/current-color", true)),
590     _visibility(fgGetNode("/sim/hud/visibility", true)),
591     _antialiasing(fgGetNode("/sim/hud/color/antialiased", true)),
592     _transparency(fgGetNode("/sim/hud/color/transparent", true)),
593     _red(fgGetNode("/sim/hud/color/red", true)),
594     _green(fgGetNode("/sim/hud/color/green", true)),
595     _blue(fgGetNode("/sim/hud/color/blue", true)),
596     _alpha(fgGetNode("/sim/hud/color/alpha", true)),
597     _alpha_clamp(fgGetNode("/sim/hud/color/alpha-clamp", true)),
598     _brightness(fgGetNode("/sim/hud/color/brightness", true)),
599     _visible(false),
600     _antialiased(false),
601     _transparent(false),
602     _a(0.67),
603     _cl(0.01)
604 {
605     _visibility->addChangeListener(this);
606     _antialiasing->addChangeListener(this);
607     _transparency->addChangeListener(this);
608     _red->addChangeListener(this);
609     _green->addChangeListener(this);
610     _blue->addChangeListener(this);
611     _alpha->addChangeListener(this);
612     _alpha_clamp->addChangeListener(this);
613     _brightness->addChangeListener(this);
614     _current->addChangeListener(this, true);
615 }
616
617
618 void HUD_Properties::valueChanged(SGPropertyNode *node)
619 {
620     if (!strcmp(node->getName(), "current-color")) {
621         int i = node->getIntValue();
622         if (i < 0)
623             i = 0;
624         SGPropertyNode *n = fgGetNode("/sim/hud/palette", true);
625         if ((n = n->getChild("color", i, false))) {
626             if (n->hasValue("red"))
627                 _red->setFloatValue(n->getFloatValue("red", 1.0));
628             if (n->hasValue("green"))
629                 _green->setFloatValue(n->getFloatValue("green", 1.0));
630             if (n->hasValue("blue"))
631                 _blue->setFloatValue(n->getFloatValue("blue", 1.0));
632             if (n->hasValue("alpha"))
633                 _alpha->setFloatValue(n->getFloatValue("alpha", 0.67));
634             if (n->hasValue("alpha-clamp"))
635                 _alpha_clamp->setFloatValue(n->getFloatValue("alpha-clamp", 0.01));
636             if (n->hasValue("brightness"))
637                 _brightness->setFloatValue(n->getFloatValue("brightness", 0.75));
638             if (n->hasValue("antialiased"))
639                 _antialiasing->setBoolValue(n->getBoolValue("antialiased", false));
640             if (n->hasValue("transparent"))
641                 _transparency->setBoolValue(n->getBoolValue("transparent", false));
642         }
643     }
644     _visible = _visibility->getBoolValue();
645     _transparent = _transparency->getBoolValue();
646     _antialiased = _antialiasing->getBoolValue();
647     float brt = _brightness->getFloatValue();
648     _r = clamp(brt * _red->getFloatValue());
649     _g = clamp(brt * _green->getFloatValue());
650     _b = clamp(brt * _blue->getFloatValue());
651     _a = clamp(_alpha->getFloatValue());
652     _cl = clamp(_alpha_clamp->getFloatValue());
653 }
654
655
656 void HUD_Properties::setColor() const
657 {
658     if (_antialiased)
659         glColor4f(_r, _g, _b, _a);
660     else
661         glColor3f(_r, _g, _b);
662 }
663
664