1 /**************************************************************************
2 * hud.cxx -- hud defines and prototypes
4 * Written by Michele America, started September 1997.
6 * Copyright (C) 1997 Michele F. America - micheleamerica@geocities.com
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * (Log is kept at end of this file)
24 **************************************************************************/
40 # include <values.h> // for MAXINT
43 #include <Aircraft/aircraft.h>
44 #include <Debug/fg_debug.h>
45 #include <Include/fg_constants.h>
46 #include <Math/fg_random.h>
47 #include <Math/mat3.h>
48 #include <Math/polar3d.h>
49 #include <Scenery/scenery.hxx>
50 #include <Time/fg_timer.hxx>
51 #include <Weather/weather.h>
56 // The following routines obtain information concerntin the aircraft's
57 // current state and return it to calling instrument display routines.
58 // They should eventually be member functions of the aircraft.
61 //using namespace std;
70 instr_ptr ( instr_item * pHudInstr = 0) : pHI( pHudInstr){}
71 ~instr_ptr() { if( pHI ) delete pHI; }
72 instr_ptr & operator = (const instr_ptr & rhs);
73 instr_ptr( const instr_ptr & image );
78 operator = ( const instr_ptr & rhs )
80 if( !(this == &rhs )) {
81 pHI = new instr_item( *(rhs.pHI));
87 instr_ptr ( const instr_ptr & image ) :
89 pHI = new instr_item( *(image.pHI));
92 deque< instr_item * > HUD_deque;
98 locRECT( UINT left, UINT top, UINT right, UINT bottom);
99 RECT get_rect(void) { return rect;}
102 locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
107 rect.bottom = bottom;
112 // #define drawOneLine(x1,y1,x2,y2) glBegin(GL_LINES);
113 // glVertex2f ((x1),(y1)); glVertex2f ((x2),(y2)); glEnd();
116 void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
124 void drawOneLine( RECT &rect)
127 glVertex2f(rect.left, rect.top);
128 glVertex2f(rect.right, rect.bottom);
133 // The following code deals with painting the "instrument" on the display
135 /* textString - Bitmap font string */
137 static void textString(int x, int y, char *msg, void *font)
141 glutBitmapCharacter(font, *msg);
146 /* strokeString - Stroke font string */
148 static void strokeString(int x, int y, char *msg, void *font)
151 glTranslatef(x, y, 0);
152 glScalef(.04, .04, .04);
154 glutStrokeCharacter(font, *msg);
163 // Abstract Base Class instr_item
165 UINT instr_item :: instances; // Initial value of zero
167 // constructor ( No default provided )
170 instr_item( RECT scr_pos,
171 DBLFNPTR data_source,
172 ReadOriented orientation,
174 handle ( ++instances ),
175 scrn_pos ( scr_pos ),
176 load_value_fn ( data_source ),
177 oriented ( orientation ),
178 is_enabled ( working ),
180 brightness ( BRT_DARK )
182 int hitemp, widetemp;
185 // Check for inverted rect coords. We must have top/right > bottom
186 // left corners or derived classes will draw their boxes very oddly.
187 // This is the only place we can reliably validate this data. Note
188 // that the box may be entirely or partly located off the screen.
189 // This needs consideration and possibly a member function to move
190 // the box, a keen idea for supporting "editing" of the HUD.
191 if( scrn_pos.top < scrn_pos.bottom ) {
192 xtemp = scrn_pos.bottom;
193 scrn_pos.bottom = scrn_pos.top;
194 scrn_pos.top = xtemp;
196 if( scrn_pos.left > scrn_pos.right ) {
197 xtemp = scrn_pos.left;
198 scrn_pos.left = scrn_pos.right;
199 scrn_pos.right = xtemp;
202 // Insure that the midpoint marker will fall exactly at the
203 // middle of the bar.
204 if( !((scr_pos.top-scr_pos.bottom) % 2)) {
207 if( !((scr_pos.right - scr_pos.left ) % 2)) {
210 // Set up convenience values for centroid of the box and
211 // the span values according to orientation
213 hitemp = scr_pos.top - scr_pos.bottom;
214 widetemp = scr_pos.right - scr_pos.left;
215 if((orientation == ReadTOP) || (orientation == ReadBOTTOM)) {
221 // Here we work out the centroid for the corrected box.
222 mid_span.x = scr_pos.left + ((scr_pos.right - scr_pos.left) >> 1);
223 mid_span.y = scr_pos.bottom + ((scr_pos.top - scr_pos.bottom) >> 1);
228 instr_item ( const instr_item & image ):
229 handle ( ++instances ),
230 scrn_pos ( image.scrn_pos ),
231 load_value_fn( image.load_value_fn),
232 oriented ( image.oriented ),
233 is_enabled ( image.is_enabled ),
234 broken ( image.broken ),
235 brightness ( image.brightness ),
236 scr_span ( image.scr_span ),
237 mid_span ( image.mid_span )
241 // assignment operator
243 instr_item & instr_item :: operator = ( const instr_item & rhs )
245 if( !(this == &rhs )) { // Not an identity assignment
246 scrn_pos = rhs.scrn_pos;
247 load_value_fn = rhs.load_value_fn;
248 oriented = rhs.oriented;
249 is_enabled = rhs.is_enabled;
251 brightness = rhs.brightness;
258 instr_item :: ~instr_item ()
270 // break_display This is emplaced to provide hooks for making
271 // instruments unreliable. The default behavior is
272 // to simply not display, but more sophisticated behavior is available
273 // by over riding the function which is virtual in this class.
276 break_display ( bool bad )
283 SetBrightness ( int level )
285 brightness = level; // This is all we will do for now. Later the
286 // brightness levels will be sensitive both to
287 // the control knob and the outside light levels
288 // to emulated night vision effects.
291 UINT instr_item :: get_Handle( void )
296 //======================= Top of instr_label class =========================
298 instr_label( RECT region,
299 DBLFNPTR data_source,
300 const char *label_format,
301 const char *pre_label_string,
302 const char *post_label_string,
303 ReadOriented orientation,
304 fgLabelJust justification,
308 instr_item( region, data_source,
309 orientation, working ),
310 pformat ( label_format ),
311 pre_str ( pre_label_string ),
312 post_str ( post_label_string ),
313 justify ( justification ),
314 fontSize ( font_size ),
319 // I put this in to make it easy to construct a class member using the current
323 instr_label :: ~instr_label()
328 instr_label :: instr_label( const instr_label & image) :
329 instr_item((const instr_item &)image),
330 pformat ( image.pformat ),
331 pre_str ( image.pre_str ),
332 post_str ( image.post_str ),
333 blink ( image.blink )
337 instr_label & instr_label ::operator = (const instr_label & rhs )
339 if( !(this == &rhs)) {
340 instr_item::operator = (rhs);
341 pformat = rhs.pformat;
342 fontSize = rhs.fontSize;
344 justify = rhs.justify;
345 pre_str = rhs.pre_str;
346 post_str = rhs.post_str;
353 // draw Draws a label anywhere in the HUD
357 draw( void ) // Required method in base class
359 char format_buffer[80];
360 char label_buffer[80];
363 RECT scrn_rect = get_location();
365 if( pre_str != NULL) {
366 if( post_str != NULL ) {
367 sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
370 sprintf( format_buffer, "%s%s", pre_str, pformat );
374 if( post_str != NULL ) {
375 sprintf( format_buffer, "%s%s", pformat, post_str );
377 } // else do nothing if both pre and post strings are nulls. Interesting.
379 sprintf( label_buffer, format_buffer, get_value() );
381 fgPrintf( FG_COCKPIT, FG_DEBUG, format_buffer );
382 fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
383 fgPrintf( FG_COCKPIT, FG_DEBUG, label_buffer );
384 fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
386 lenstr = strlen( label_buffer );
388 posincr = 0; // default to RIGHT_JUST ... center located calc: -lenstr*8;
390 if( justify == CENTER_JUST ) {
391 posincr = - (lenstr << 2); // -lenstr*4;
394 if( justify == LEFT_JUST ) {
395 posincr = - (lenstr << 8); // 0;
399 if( fontSize == SMALL ) {
400 textString( scrn_rect.left + posincr, scrn_rect.bottom,
401 label_buffer, GLUT_BITMAP_8_BY_13);
404 if( fontSize == LARGE ) {
405 textString( scrn_rect.left + posincr, scrn_rect.bottom,
406 label_buffer, GLUT_BITMAP_9_BY_15);
411 //============== Top of instr_scale class memeber definitions ===============
414 // 1. instr_scales divide the specified location into half and then
415 // the half opposite the read direction in half again. A bar is
416 // then drawn along the second divider. Scale ticks are drawn
417 // between the middle and quarter section lines (minor division
418 // markers) or just over the middle line.
420 // 2. This class was not intended to be instanciated. See moving_scale
421 // and guage_instr classes.
422 //============================================================================
424 instr_scale ( RECT the_box,
434 instr_item( the_box, load_fn, orient, working),
435 range_shown ( show_range ),
436 Maximum_value( maxValue ),
437 Minimum_value( minValue ),
438 Maj_div ( major_divs ),
439 Min_div ( minor_divs ),
444 scale_factor = (double)get_span() / range_shown;
445 if( show_range < 0 ) {
446 range_shown = -range_shown;
448 temp = (Maximum_value - Minimum_value) / 100;
449 if( range_shown < temp ) {
455 instr_scale( const instr_scale & image ) :
456 instr_item( (const instr_item &) image),
457 range_shown ( image.range_shown ),
458 Maximum_value( image.Maximum_value ),
459 Minimum_value( image.Minimum_value ),
460 Maj_div ( image.Maj_div ),
461 Min_div ( image.Min_div ),
462 Modulo ( image.Modulo ),
463 scale_factor ( image.scale_factor )
467 instr_scale & instr_scale :: operator = (const instr_scale & rhs )
469 if( !(this == &rhs)) {
470 instr_item::operator = (rhs);
471 Minimum_value = rhs.Minimum_value;
472 Maximum_value = rhs.Maximum_value;
473 Maj_div = rhs.Maj_div;
474 Min_div = rhs.Min_div;
476 scale_factor = rhs.scale_factor;
477 range_shown = rhs.range_shown;
482 instr_scale :: ~ instr_scale () {}
484 //========== Top of moving_scale_instr class member definitions =============
487 moving_scale( RECT the_box,
488 DBLFNPTR data_source,
489 ReadOriented orientation,
497 instr_scale( the_box,
498 data_source, orientation,
500 max_value, min_value,
501 major_divs, minor_divs, modulus,
503 val_span ( value_span)
505 half_width_units = range_to_show() / 2.0;
512 moving_scale( const moving_scale & image):
513 instr_scale( (const instr_scale & ) image)
517 moving_scale & moving_scale ::
518 operator = (const moving_scale & rhs )
520 if( !( this == &rhs)){
521 instr_scale::operator = (rhs);
527 draw( void ) // (HUD_scale * pscale )
536 POINT mid_scr = get_centroid();
537 POINT bias_bar; // eliminates some orientation checks
538 double cur_value = get_value();
539 RECT scrn_rect = get_location();
540 ReadOriented orientation = get_orientation();
542 vmin = cur_value - half_width_units; // width units == needle travel
543 vmax = cur_value + half_width_units; // or picture unit span.
546 if( (orientation == ReadLEFT) ||( orientation == ReadRIGHT)) // Vertical scale
548 if( orientation == ReadLEFT ) { // Calculate x marker offset
549 marker_x = scrn_rect.left - 6;
550 bias_bar.x = ((scrn_rect.right - mid_scr.x)>>1) + mid_scr.x;
552 else { // We'll default this for now.
553 marker_x = mid_scr.x; // scrn_rect.right;
554 bias_bar.x = ((mid_scr.x - scrn_rect.left)>>1) + scrn_rect.left;
557 // Draw the basic markings for the scale...
559 drawOneLine( bias_bar.x, // Vertical scale bar
565 if( orientation == ReadLEFT )
568 drawOneLine( bias_bar.x, // Bottom tick bar
573 drawOneLine( bias_bar.x, // Top tick bar
578 drawOneLine( scrn_rect.right, // Middle tick bar /Index
585 drawOneLine( bias_bar.x,
590 drawOneLine( bias_bar.x,
595 drawOneLine( scrn_rect.left,
601 // Work through from bottom to top of scale. Calculating where to put
602 // minor and major ticks.
604 for( i = (int)vmin; i <= (int)vmax; i++ )
606 // if( sub_type == LIMIT ) { // Don't show ticks
607 condition = (i >= min_val()); // below Minimum value.
610 // if( sub_type == NOLIMIT ) {
614 if( condition ) // Show a tick if necessary
616 // Calculate the location of this tick
617 marker_y = scrn_rect.bottom + (int)((i - vmin) * factor());
619 // Block calculation artifact from drawing ticks below min coordinate.
620 // Calculation here accounts for text height.
622 if( marker_y < (scrn_rect.bottom + 4)) { // Magic number!!!
626 if( (i%div_min()) == 0) {
627 // if( orientation == ReadLEFT )
629 // drawOneLine( marker_x + 3, marker_y, marker_x + 6, marker_y );
630 drawOneLine( bias_bar.x, marker_y, mid_scr.x, marker_y );
633 // if( orientation == ReadRIGHT )
635 // drawOneLine( marker_x, marker_y, marker_x + 3, marker_y );
636 // drawOneLine( bias_bar.x, marker_y, mid_scr.x, marker_y );
642 if( (i%div_max()) == 0 ) {
643 // drawOneLine( marker_x, marker_y,
644 // marker_x + 6, marker_y );
646 disp_val = i % modulo();
648 disp_val += modulo();
654 sprintf( TextScale, "%d", disp_val );
655 if( orientation == ReadLEFT ) {
656 drawOneLine( mid_scr.x - 3, marker_y, bias_bar.x, marker_y );
658 textString( marker_x - 8 * strlen(TextScale) - 2, marker_y - 4,
659 TextScale, GLUT_BITMAP_8_BY_13 );
662 drawOneLine( mid_scr.x + 3, marker_y, bias_bar.x, marker_y );
663 textString( marker_x + 10, marker_y - 4,
664 TextScale, GLUT_BITMAP_8_BY_13 );
665 } // Else read oriented right
666 } // End if modulo division by major interval is zero
667 } // End if major interval divisor non-zero
668 } // End if condition
669 } // End for range of i from vmin to vmax
670 } // End if VERTICAL SCALE TYPE
671 else { // Horizontal scale by default
673 if( orientation == ReadTOP ) {
674 bias_bar.y = ((mid_scr.y - scrn_rect.bottom)>>1 ) + scrn_rect.bottom;
675 marker_y = bias_bar.y; // Don't use now
677 else { // We will assume no other possibility at this time.
678 bias_bar.y = ((scrn_rect.top - mid_scr.y)>>1 ) + mid_scr.y;
679 marker_y = bias_bar.y; // Don't use now
682 drawOneLine( scrn_rect.left,
687 if( orientation == ReadTOP )
689 drawOneLine( scrn_rect.left,
694 drawOneLine( scrn_rect.right,
699 drawOneLine( mid_scr.x,
706 if( orientation == ReadBOTTOM )
708 drawOneLine( scrn_rect.left,
713 drawOneLine( scrn_rect.right,
718 drawOneLine( mid_scr.x,
725 for( i = (int)vmin; i <= (int)vmax; i++ ) // increment is faster than addition
727 // if( sub_type == LIMIT ) {
728 condition = (i >= min_val());
731 // if( sub_type == NOLIMIT ) {
736 marker_x = scrn_rect.left + (int)((i - vmin) * factor());
738 if( (i%(int)div_min()) == 0 ) {
739 // if( orientation == ReadTOP )
741 // drawOneLine( marker_x, marker_y, marker_x, marker_y + 3 );
742 drawOneLine( marker_x, bias_bar.y, marker_x, mid_scr.y );
745 // drawOneLine( marker_x, marker_y + 3, marker_x, marker_y + 6 );
746 // drawOneLine( marker_x, bias_bar.y, marker_x, mid_scr.y );
751 if( (i%(int)div_max())==0 )
754 disp_val = i % modulo();
756 disp_val += modulo();
762 sprintf( TextScale, "%d", disp_val );
763 if( orientation == ReadTOP )
765 // drawOneLine( marker_x, marker_y, marker_x, marker_y+6 );
766 drawOneLine( marker_x, mid_scr.y + 3,marker_x, bias_bar.y );
767 textString ( marker_x - 4 * strlen(TextScale), marker_y + 14,
768 TextScale, GLUT_BITMAP_8_BY_13 );
771 // drawOneLine( marker_x, marker_y, marker_x, marker_y+6 );
772 drawOneLine( marker_x, mid_scr.y - 3,marker_x, bias_bar.y );
773 textString ( marker_x - 4 * strlen(TextScale), mid_scr.y - 14,
774 TextScale, GLUT_BITMAP_8_BY_13 );
784 //============== Top of guage_instr class member definitions ==============
787 guage_instr( RECT the_box,
789 ReadOriented readway,
796 instr_scale( the_box,
798 maxValue, maxValue, minValue,
799 major_divs, minor_divs,
811 guage_instr( const guage_instr & image):
812 instr_scale( (instr_scale &) image)
816 guage_instr & guage_instr ::
817 operator = (const guage_instr & rhs )
819 if( !(this == &rhs)) {
820 instr_scale::operator = (rhs);
825 // As implemented, draw only correctly draws a horizontal or vertical
826 // scale. It should contain a variation that permits clock type displays.
827 // Now is supports "tickless" displays such as control surface indicators.
828 // This routine should be worked over before using. Current value would be
829 // fetched and not used if not commented out. Clearly that is intollerable.
831 void guage_instr :: draw (void)
839 double vmin = min_val();
840 double vmax = max_val();
841 POINT mid_scr = get_centroid();
842 // double cur_value = get_value();
843 RECT scrn_rect = get_location();
844 ReadOriented orientation = get_orientation();
846 if( (orientation == ReadLEFT) ||( orientation == ReadRIGHT)) // Vertical scale
848 mid_scr = get_centroid();
849 if( orientation == ReadLEFT ) // Calculate x marker offset
850 marker_x = scrn_rect.left - 6;
851 else // We'll default this for now.
852 marker_x = scrn_rect.right;
854 // Draw the basic markings for the scale...
856 if( orientation == ReadLEFT )
859 drawOneLine( scrn_rect.right - 3, // Bottom tick bar
864 drawOneLine( scrn_rect.right - 3, // Top tick bar
870 drawOneLine( scrn_rect.right,
875 drawOneLine( scrn_rect.right,
881 // Work through from bottom to top of scale. Calculating where to put
882 // minor and major ticks.
884 for( i = (int)vmin; i <= (int)vmax; i++ )
886 // Calculate the location of this tick
887 marker_y = scrn_rect.bottom + (int)((i - vmin) * factor());
890 if( (i%div_min()) == 0) {
891 if( orientation == ReadLEFT )
893 drawOneLine( marker_x + 3, marker_y, marker_x + 6, marker_y );
896 drawOneLine( marker_x, marker_y, marker_x + 3, marker_y );
901 if( (i%div_max()) == 0 ) {
902 drawOneLine( marker_x, marker_y,
903 marker_x + 6, marker_y );
905 disp_val = i % modulo();
907 disp_val += modulo();
913 sprintf( TextScale, "%d", disp_val );
914 if( orientation == ReadLEFT ) {
915 textString( marker_x - 8 * strlen(TextScale) - 2, marker_y - 4,
916 TextScale, GLUT_BITMAP_8_BY_13 );
919 if( orientation == ReadRIGHT ) {
920 textString( marker_x + 10, marker_y - 4,
921 TextScale, GLUT_BITMAP_8_BY_13 );
925 } // End if condition
926 } // End for range of i from vmin to vmax
927 } // End if VERTICAL SCALE TYPE
928 else { // Horizontal scale by default
930 if( orientation == ReadTOP ) {
931 marker_y = scrn_rect.bottom;
934 if( orientation == ReadBOTTOM ) {
935 marker_y = scrn_rect.bottom - 6;
938 drawOneLine( scrn_rect.left,
943 if( orientation == ReadTOP )
945 drawOneLine( scrn_rect.left,
948 scrn_rect.bottom + 3 );
950 drawOneLine( scrn_rect.right,
953 scrn_rect.bottom + 6 );
956 if( orientation == ReadBOTTOM )
958 drawOneLine( scrn_rect.left,
961 scrn_rect.bottom - 6 );
963 drawOneLine( scrn_rect.right,
966 scrn_rect.bottom - 6 );
970 for( i = (int)vmin; i <= (int)vmax; i++ ) // increment is faster than addition
972 marker_x = scrn_rect.left + (int)((i - vmin) * factor());
974 if( (i%div_min()) == 0 ) {
975 if( orientation == ReadTOP )
977 drawOneLine( marker_x, marker_y, marker_x, marker_y + 3 );
980 if( orientation == ReadBOTTOM )
982 drawOneLine( marker_x, marker_y + 3, marker_x, marker_y + 6 );
985 } // End if minor tick called for.
986 } // End if minor ticks are of interest
988 if( (i%div_max())==0 )
990 // Modulo implies a "clock" style instrument. Needs work.
992 disp_val = i % modulo();
994 disp_val += modulo();
997 else { // Scale doesn't roll around.
1000 sprintf( TextScale, "%d", disp_val );
1001 if( orientation == ReadTOP )
1003 drawOneLine( marker_x, marker_y, marker_x, marker_y+6 );
1004 textString ( marker_x - 4 * strlen(TextScale), marker_y + 14,
1005 TextScale, GLUT_BITMAP_8_BY_13 );
1008 if( orientation == ReadBOTTOM )
1010 drawOneLine( marker_x, marker_y, marker_x, marker_y+6 );
1011 textString ( marker_x - 4 * strlen(TextScale), marker_y - 14,
1012 TextScale, GLUT_BITMAP_8_BY_13 );
1014 } // End else if not ReadTOP
1015 } // End if major division point.
1016 } // End if major divisions of interest.
1022 //============ Top of dual_instr_item class member definitions ============
1025 dual_instr_item ( RECT the_box,
1026 DBLFNPTR chn1_source,
1027 DBLFNPTR chn2_source,
1029 ReadOriented readway ):
1030 instr_item( the_box, chn1_source, readway, working),
1031 alt_data_source( chn2_source )
1036 dual_instr_item( const dual_instr_item & image) :
1037 instr_item ((instr_item &) image ),
1038 alt_data_source( image.alt_data_source)
1042 dual_instr_item & dual_instr_item ::
1043 operator = (const dual_instr_item & rhs )
1045 if( !(this == &rhs)) {
1046 instr_item::operator = (rhs);
1047 alt_data_source = rhs.alt_data_source;
1052 //============ Top of fgTBI_instr class member definitions ==============
1055 fgTBI_instr( RECT the_box,
1056 DBLFNPTR chn1_source,
1057 DBLFNPTR chn2_source,
1062 dual_instr_item( the_box,
1067 BankLimit (maxBankAngle),
1068 SlewLimit (maxSlipAngle),
1069 scr_hole (gap_width )
1073 fgTBI_instr :: ~fgTBI_instr() {}
1075 fgTBI_instr :: fgTBI_instr( const fgTBI_instr & image):
1076 dual_instr_item( (const dual_instr_item &) image),
1077 BankLimit( image.BankLimit),
1078 SlewLimit( image.SlewLimit),
1079 scr_hole ( image.scr_hole )
1083 fgTBI_instr & fgTBI_instr ::
1084 operator = (const fgTBI_instr & rhs )
1086 if( !(this == &rhs)) {
1087 dual_instr_item::operator = (rhs);
1088 BankLimit = rhs.BankLimit;
1089 SlewLimit = rhs.SlewLimit;
1090 scr_hole = rhs.scr_hole;
1096 // Draws a Turn Bank Indicator on the screen
1099 void fgTBI_instr :: draw( void )
1103 int x_t_inc1, y_t_inc1;
1105 int d_bottom_x, d_bottom_y;
1106 int d_right_x, d_right_y;
1107 int d_top_x, d_top_y;
1108 int d_left_x, d_left_y;
1110 int inc_b_x, inc_b_y;
1111 int inc_r_x, inc_r_y;
1112 int inc_t_x, inc_t_y;
1113 int inc_l_x, inc_l_y;
1114 RECT My_box = get_location();
1115 POINT centroid = get_centroid();
1116 int tee_height = My_box.top - My_box.bottom; // Hack, hack.
1118 // struct fgFLIGHT *f = ¤t_aircraft.flight;
1119 double sin_bank, cos_bank;
1120 double bank_angle, sideslip_angle;
1121 double ss_const; // sideslip angle pixels per rad
1123 bank_angle = current_ch2(); // Roll limit +/- 30 degrees
1124 if( bank_angle < -FG_PI_2/3 ) {
1125 bank_angle = -FG_PI_2/3;
1126 }else if( bank_angle > FG_PI_2/3 ) {
1127 bank_angle = FG_PI_2/3;
1129 sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
1130 if( sideslip_angle < -FG_PI/9 ) {
1131 sideslip_angle = -FG_PI/9;
1132 } else if( sideslip_angle > FG_PI/9 ) {
1133 sideslip_angle = FG_PI/9;
1136 // sin_bank = sin( FG_2PI-FG_Phi );
1137 // cos_bank = cos( FG_2PI-FG_Phi );
1138 sin_bank = sin(FG_2PI-bank_angle);
1139 cos_bank = cos(FG_2PI-bank_angle);
1141 x_inc1 = (int)(get_span() * cos_bank);
1142 y_inc1 = (int)(get_span() * sin_bank);
1143 x_inc2 = (int)(scr_hole * cos_bank);
1144 y_inc2 = (int)(scr_hole * sin_bank);
1146 x_t_inc1 = (int)(tee_height * sin_bank);
1147 y_t_inc1 = (int)(tee_height * cos_bank);
1150 d_bottom_y = (int)(-scr_hole);
1151 d_right_x = (int)(scr_hole);
1154 d_top_y = (int)(scr_hole);
1155 d_left_x = (int)(-scr_hole);
1158 ss_const = (get_span()*2)/(FG_2PI/9); // width represents 40 degrees
1160 d_bottom_x += (int)(sideslip_angle*ss_const);
1161 d_right_x += (int)(sideslip_angle*ss_const);
1162 d_left_x += (int)(sideslip_angle*ss_const);
1163 d_top_x += (int)(sideslip_angle*ss_const);
1165 inc_b_x = (int)(d_bottom_x*cos_bank-d_bottom_y*sin_bank);
1166 inc_b_y = (int)(d_bottom_x*sin_bank+d_bottom_y*cos_bank);
1167 inc_r_x = (int)(d_right_x*cos_bank-d_right_y*sin_bank);
1168 inc_r_y = (int)(d_right_x*sin_bank+d_right_y*cos_bank);
1169 inc_t_x = (int)(d_top_x*cos_bank-d_top_y*sin_bank);
1170 inc_t_y = (int)(d_top_x*sin_bank+d_top_y*cos_bank);
1171 inc_l_x = (int)(d_left_x*cos_bank-d_left_y*sin_bank);
1172 inc_l_y = (int)(d_left_x*sin_bank+d_left_y*cos_bank);
1176 drawOneLine( centroid.x - x_inc1, centroid.y - y_inc1, \
1177 centroid.x + x_inc1, centroid.y + y_inc1 );
1181 drawOneLine( centroid.x - x_inc1, centroid.y - y_inc1, \
1182 centroid.x - x_inc2, centroid.y - y_inc2 );
1183 drawOneLine( centroid.x + x_inc2, centroid.y + y_inc2, \
1184 centroid.x + x_inc1, centroid.y + y_inc1 );
1188 drawOneLine( centroid.x + x_inc2, \
1189 centroid.y + y_inc2, \
1190 centroid.x + x_inc2 + x_t_inc1, \
1191 centroid.y + y_inc2 - y_t_inc1 );
1192 drawOneLine( centroid.x - x_inc2, \
1193 centroid.y - y_inc2, \
1194 centroid.x - x_inc2 + x_t_inc1, \
1195 centroid.y - y_inc2 - y_t_inc1 );
1197 // draw sideslip diamond (it is not yet positioned correctly )
1198 drawOneLine( centroid.x + inc_b_x, \
1199 centroid.y + inc_b_y, \
1200 centroid.x + inc_r_x, \
1201 centroid.y + inc_r_y );
1202 drawOneLine( centroid.x + inc_r_x, \
1203 centroid.y + inc_r_y, \
1204 centroid.x + inc_t_x, \
1205 centroid.y + inc_t_y );
1206 drawOneLine( centroid.x + inc_t_x, \
1207 centroid.y + inc_t_y, \
1208 centroid.x + inc_l_x, \
1209 centroid.y + inc_l_y );
1210 drawOneLine( centroid.x + inc_l_x, \
1211 centroid.y + inc_l_y, \
1212 centroid.x + inc_b_x, \
1213 centroid.y + inc_b_y );
1217 //====================== Top of HudLadder Class =======================
1219 HudLadder( RECT the_box,
1220 DBLFNPTR ptch_source,
1221 DBLFNPTR roll_source,
1228 dual_instr_item( the_box,
1233 width_units ( span_units ),
1234 div_units ( major_div < 0? -major_div: major_div ),
1235 minor_div ( minor_div ),
1236 label_pos ( lbl_pos ),
1237 scr_hole ( screen_hole ),
1238 vmax ( span_units/2 ),
1241 if( !width_units ) {
1244 factor = (double)get_span() / (double) width_units;
1253 HudLadder( const HudLadder & image ) :
1254 dual_instr_item( (dual_instr_item &) image),
1255 width_units ( image.width_units ),
1256 div_units ( image.div_units ),
1257 label_pos ( image.label_pos ),
1258 scr_hole ( image.scr_hole ),
1259 vmax ( image.vmax ),
1260 vmin ( image.vmin ),
1261 factor ( image.factor )
1264 HudLadder & HudLadder ::
1265 operator = ( const HudLadder & rhs )
1267 if( !(this == &rhs)) {
1268 (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
1269 width_units = rhs.width_units;
1270 div_units = rhs.div_units;
1271 label_pos = rhs.label_pos;
1272 scr_hole = rhs.scr_hole;
1275 factor = rhs.factor;
1281 // Draws a climb ladder in the center of the HUD
1284 void HudLadder :: draw( void )
1286 double roll_value, pitch_value;
1293 int new_x_ini, new_x_end;
1294 int new_y_ini, new_y_end;
1296 POINT centroid = get_centroid();
1297 RECT box = get_location();
1298 int half_span = (box.right - box.left) >> 1;
1299 char TextLadder[80];
1302 roll_value = current_ch2();
1303 pitch_value = current_ch1() * RAD_TO_DEG;
1305 vmin = (int)(pitch_value - (double)width_units/2.0);
1306 vmax = (int)(pitch_value + (double)width_units/2.0);
1308 scr_min = box.bottom; // centroid.y - ((box.top - box.bottom) >> 1);
1309 // scr_max = box.top; // scr_min + (box.top - box.bottom);
1310 // marker_x = centroid.x - half_span;
1313 drawOneLine( centroid.x - 5, centroid.y, centroid.x, centroid.y + 5);
1314 drawOneLine( centroid.x, centroid.y + 5, centroid.x + 5, centroid.y);
1315 drawOneLine( centroid.x + 5, centroid.y, centroid.x, centroid.y - 5);
1316 drawOneLine( centroid.x, centroid.y - 5, centroid.x - 5, centroid.y);
1318 for( i=(int)vmin; i<=(int)vmax; i+=1 )
1323 marker_y = scr_min + (int)((i-vmin)*factor);
1325 if( i%div_units==0 )
1327 sprintf( TextLadder, "%d", i );
1331 x_ini = centroid.x - half_span;
1334 x_ini = centroid.x - half_span - 10;
1337 x_end = centroid.x + half_span;
1339 new_x_ini = centroid.x + (int)( \
1340 (x_ini - centroid.x) * cos(roll_value) - \
1341 (y_ini - centroid.y) * sin(roll_value));
1342 new_y_ini = centroid.y + (int)( \
1343 (x_ini - centroid.x) * sin(roll_value) + \
1344 (y_ini - centroid.y) * cos(roll_value));
1345 new_x_end = centroid.x + (int)( \
1346 (x_end - centroid.x) * cos(roll_value) - \
1347 (y_end - centroid.y) * sin(roll_value));
1348 new_y_end = centroid.y + (int)( \
1349 (x_end - centroid.x) * sin(roll_value) + \
1350 (y_end - centroid.y) * cos(roll_value));
1354 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
1358 glEnable(GL_LINE_STIPPLE);
1359 glLineStipple( 1, 0x00FF );
1360 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
1361 glDisable(GL_LINE_STIPPLE);
1363 textString( new_x_ini - 8 * strlen(TextLadder) - 8,
1365 TextLadder, GLUT_BITMAP_8_BY_13 );
1366 textString( new_x_end + 10,
1368 TextLadder, GLUT_BITMAP_8_BY_13 );
1373 x_ini = centroid.x - half_span;
1376 x_ini = centroid.x - half_span - 10;
1379 x_end = centroid.x - half_span + scr_hole/2;
1381 new_x_ini = centroid.x+ (int)( \
1382 (x_ini - centroid.x) * cos(roll_value) -\
1383 (y_ini - centroid.y) * sin(roll_value));
1384 new_y_ini = centroid.y+ (int)( \
1385 (x_ini - centroid.x) * sin(roll_value) +\
1386 (y_ini - centroid.y) * cos(roll_value));
1387 new_x_end = centroid.x+ (int)( \
1388 (x_end - centroid.x) * cos(roll_value) -\
1389 (y_end - centroid.y) * sin(roll_value));
1390 new_y_end = centroid.y+ (int)( \
1391 (x_end - centroid.x) * sin(roll_value) +\
1392 (y_end - centroid.y) * cos(roll_value));
1396 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
1400 glEnable(GL_LINE_STIPPLE);
1401 glLineStipple( 1, 0x00FF );
1402 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
1403 glDisable(GL_LINE_STIPPLE);
1405 textString( new_x_ini - 8 * strlen(TextLadder) - 8,
1407 TextLadder, GLUT_BITMAP_8_BY_13 );
1409 x_ini = centroid.x + half_span - scr_hole/2;
1412 x_end = centroid.x + half_span;
1415 x_end = centroid.x + half_span + 10;
1418 new_x_ini = centroid.x + (int)( \
1419 (x_ini-centroid.x)*cos(roll_value) -\
1420 (y_ini-centroid.y)*sin(roll_value));
1421 new_y_ini = centroid.y + (int)( \
1422 (x_ini-centroid.x)*sin(roll_value) +\
1423 (y_ini-centroid.y)*cos(roll_value));
1424 new_x_end = centroid.x + (int)( \
1425 (x_end-centroid.x)*cos(roll_value) -\
1426 (y_end-centroid.y)*sin(roll_value));
1427 new_y_end = centroid.y + (int)( \
1428 (x_end-centroid.x)*sin(roll_value) +\
1429 (y_end-centroid.y)*cos(roll_value));
1433 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
1437 glEnable(GL_LINE_STIPPLE);
1438 glLineStipple( 1, 0x00FF );
1439 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
1440 glDisable(GL_LINE_STIPPLE);
1442 textString( new_x_end+10, new_y_end-4,
1443 TextLadder, GLUT_BITMAP_8_BY_13 );
1447 /* if( i%div_max()==0 )
1449 drawOneLine( marker_x, marker_y, marker_x+6, marker_y );
1450 sprintf( TextScale, "%d", i );
1451 if( orientation == LEFT )
1453 textString( marker_x-8*strlen(TextScale)-2, marker_y-4,
1454 TextScale, GLUT_BITMAP_8_BY_13 );
1456 else if( orientation == RIGHT )
1458 textString( marker_x+10, marker_y-4,
1459 TextScale, GLUT_BITMAP_8_BY_13 );
1467 //========================= End of Class Implementations===================
1470 // Constructs a HUD object and then adds in instruments. At the present
1471 // the instruments are hard coded into the routine. Ultimately these need
1472 // to be defined by the aircraft's instrumentation records so that the
1473 // display for a Piper Cub doesn't show the speed range of a North American
1474 // mustange and the engine readouts of a B36!
1477 #define INSTRDEFS 17
1479 int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
1485 fgPrintf( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD\n" );
1487 HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
1492 // For now lets just hardcode the hud here.
1493 // In the future, hud information has to come from the same place
1494 // aircraft information came from.
1496 // fgHUDSetTimeMode( hud, NIGHT );
1497 // fgHUDSetBrightness( hud, BRT_LIGHT );
1499 for( index = 0; index <= INSTRDEFS; index++) {
1502 // fgHUDAddHorizon( hud, 330, 100, 40, 5, 10, get_roll, get_sideslip );
1503 loc.left = 330 - 40;
1505 loc.right = 330 + 40;
1507 HIptr = (instr_item *) new fgTBI_instr( loc );
1510 case 1: // Artificial Horizon
1511 // fgHUDAddLadder ( hud, 330, 285, 120, 180, 70, 10,
1512 // NONE, 45, get_roll, get_pitch );
1513 loc.left = 270; // 330 - 60
1514 loc.top = 375; // 285 + 90
1515 loc.right = 390; // 330 + 60
1516 loc.bottom = 195; // 285 - 90
1517 HIptr = (instr_item *) new HudLadder( loc );
1521 // fgHUDAddScale ( hud, VERTICAL, LIMIT, 200, 180, 380, 5, 10,
1522 // LEFT, 0, 100, 50, 0, get_speed );
1527 HIptr = (instr_item *) new moving_scale( loc,
1537 case 3: // Angle of Attack
1538 // fgHUDAddScale ( hud, HORIZONTAL, NOLIMIT, 180, 250, 410, 1, 5,
1539 // BOTTOM, -40, 50, 21, 0, get_aoa );
1544 HIptr = (instr_item *) new moving_scale( loc,
1554 case 4: // GYRO COMPASS
1555 // fgHUDAddScale ( hud, HORIZONTAL, NOLIMIT, 380, 200, 460, 5, 10,
1556 // TOP, 0, 50, 50, 360, get_heading );
1561 HIptr = (instr_item *) new moving_scale( loc,
1572 // fgHUDAddScale ( hud, VERTICAL, LIMIT, 460, 180, 380, 25, 100,
1573 // RIGHT, 0, 15000, 250, 0, get_altitude);
1578 HIptr = (instr_item *) new moving_scale( loc,
1588 case 6: // Digital KIAS
1589 // fgHUDAddLabel ( hud, 160, 150, SMALL, NOBLINK,
1590 // RIGHT_JUST, NULL, " Kts", "%5.0f", get_speed );
1592 loc.top = 180; // Ignore
1593 loc.right = 200; // Ignore
1595 HIptr = (instr_item *) new instr_label ( loc,
1607 case 7: // Digital Altimeter
1608 // fgHUDAddLabel ( hud, 160, 135, SMALL, NOBLINK,
1609 // RIGHT_JUST, NULL, " m", "%5.0f", get_altitude );
1611 loc.top = 145; // Ignore
1612 loc.right = 200; // Ignore
1614 HIptr = (instr_item *) new instr_label ( loc,
1626 case 8: // Roll indication diagnostic
1627 // fgHUDAddLabel ( hud, 160, 120, SMALL, NOBLINK,
1628 // RIGHT_JUST, NULL, " Roll", "%5.2f", get_roll );
1630 loc.top = 130; // Ignore
1631 loc.right = 200; // Ignore
1633 HIptr = (instr_item *) new instr_label ( loc,
1645 case 9: // Angle of attack diagnostic
1646 // fgHUDAddLabel ( hud, 440, 150, SMALL, NOBLINK,
1647 // RIGHT_JUST, NULL, " AOA", "%5.2f", get_aoa );
1649 loc.top = 160; // Ignore
1650 loc.right = 500; // Ignore
1652 HIptr = (instr_item *) new instr_label ( loc,
1665 // fgHUDAddLabel ( hud, 440, 135, SMALL, NOBLINK,
1666 // RIGHT_JUST, NULL, " Heading", "%5.0f", get_heading );
1668 loc.top = 145; // Ignore
1669 loc.right = 500; // Ignore
1671 HIptr = (instr_item *) new instr_label ( loc,
1684 // fgHUDAddLabel ( hud, 440, 120, SMALL, NOBLINK,
1685 // RIGHT_JUST, NULL, " Sideslip", "%5.2f", get_sideslip );
1687 loc.top = 130; // Ignore
1688 loc.right = 500; // Ignore
1690 HIptr = (instr_item *) new instr_label ( loc,
1704 loc.top = 90; // Ignore
1705 loc.right = 440; // Ignore
1707 HIptr = (instr_item *) new instr_label( loc, get_throttleval,
1720 loc.top = 70; // Ignore
1721 loc.right = 500; // Ignore
1723 HIptr = (instr_item *) new instr_label( loc, get_elevatorval,
1736 loc.top = 100; // Ignore
1737 loc.right = 500; // Ignore
1739 HIptr = (instr_item *) new instr_label( loc, get_aileronval,
1752 loc.top = 100; // Ignore
1753 loc.right = 500; // Ignore
1755 HIptr = (instr_item *) new instr_label( loc, get_frame_rate,
1768 loc.top = 100; // Ignore
1769 loc.right = 500; // Ignore
1771 HIptr = (instr_item *) new instr_label( loc, get_vfc_ratio,
1784 loc.top = 100; // Ignore
1785 loc.right = 500; // Ignore
1787 HIptr = (instr_item *) new instr_label( loc, get_fov,
1798 // fgHUDAddControlSurfaces( hud, 10, 10, NULL );
1802 // loc.bottom = 180;
1803 // HIptr = (instr_item *) new
1808 if( HIptr ) { // Anything to install?
1809 HUD_deque.insert( HUD_deque.begin(), HIptr);
1813 // fgHUDAddControl( hud, HORIZONTAL, 50, 25, get_aileronval ); // was 10, 10
1814 // fgHUDAddControl( hud, VERTICAL, 150, 25, get_elevatorval ); // was 10, 10
1815 // fgHUDAddControl( hud, HORIZONTAL, 250, 25, get_rudderval ); // was 10, 10
1816 return 0; // For now. Later we may use this for an error code.
1822 // Performs a once around the list of calls to instruments installed in
1823 // the HUD object with requests for redraw. Kinda. It will when this is
1826 int global_day_night_switch = DAY;
1828 void fgUpdateHUD( void ) {
1831 // int day_night_sw = current_aircraft.controls->day_night_switch;
1832 int day_night_sw = global_day_night_switch;
1833 int hud_displays = HUD_deque.size();
1834 instr_item *pHUDInstr;
1836 if( !hud_displays ) { // Trust everyone, but ALWAYS cut the cards!
1840 pHUDInstr = HUD_deque[0];
1841 brightness = pHUDInstr->get_brightness();
1842 // brightness = HUD_deque.at(0)->get_brightness();
1844 glMatrixMode(GL_PROJECTION);
1848 gluOrtho2D(0, 640, 0, 480);
1849 glMatrixMode(GL_MODELVIEW);
1853 glColor3f(1.0, 1.0, 1.0);
1856 glDisable(GL_DEPTH_TEST);
1857 glDisable(GL_LIGHTING);
1861 for( i = hud_displays; i; --i) { // Draw everything
1862 // if( HUD_deque.at(i)->enabled()) {
1863 pHUDInstr = HUD_deque[i - 1];
1864 if( pHUDInstr->enabled()) {
1865 // We should to respond to a dial instead
1866 // or as well to the of time of day. Of
1867 // course, we have no dial!
1868 if( day_night_sw == DAY) {
1869 switch (brightness) {
1871 glColor3f (0.1, 0.9, 0.1);
1875 glColor3f (0.1, 0.7, 0.0);
1879 glColor3f (0.0, 0.5, 0.0);
1883 if( day_night_sw == NIGHT) {
1884 switch (brightness) {
1886 glColor3f (0.9, 0.1, 0.1);
1890 glColor3f (0.7, 0.0, 0.1);
1895 glColor3f (0.5, 0.0, 0.0);
1898 else { // Just in case default
1899 glColor3f (0.1, 0.9, 0.1);
1902 // fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
1903 // hud->code, hud->status );
1905 // HUD_deque.at(i)->draw(); // Responsible for broken or fixed variants.
1906 // No broken displays honored just now.
1910 glEnable(GL_DEPTH_TEST);
1911 glEnable(GL_LIGHTING);
1912 glMatrixMode(GL_PROJECTION);
1914 glMatrixMode(GL_MODELVIEW);
1919 /* Revision 1.12 1998/06/12 00:55:59 curt
1920 /* Build only static libraries.
1921 /* Declare memmove/memset for Sloaris.
1923 * Revision 1.11 1998/06/05 18:17:10 curt
1924 * Added the declaration of memmove needed by the stl which apparently
1925 * solaris only defines for cc compilations and not for c++ (__STDC__)
1927 * Revision 1.10 1998/05/17 16:58:12 curt
1928 * Added a View Frustum Culling ratio display to the hud.
1930 * Revision 1.9 1998/05/16 13:04:14 curt
1931 * New updates from Charlie Hotchkiss.
1933 * Revision 1.8 1998/05/13 18:27:54 curt
1934 * Added an fov to hud display.
1936 * Revision 1.7 1998/05/11 18:13:11 curt
1937 * Complete C++ rewrite of all cockpit code by Charlie Hotchkiss.
1939 * Revision 1.22 1998/04/18 04:14:02 curt
1940 * Moved fg_debug.c to it's own library.
1942 * Revision 1.21 1998/04/03 21:55:28 curt
1943 * Converting to Gnu autoconf system.
1946 * Revision 1.20 1998/03/09 22:48:40 curt
1947 * Minor "formatting" tweaks.
1949 * Revision 1.19 1998/02/23 20:18:28 curt
1950 * Incorporated Michele America's hud changes.
1952 * Revision 1.18 1998/02/21 14:53:10 curt
1953 * Added Charlie's HUD changes.
1955 * Revision 1.17 1998/02/20 00:16:21 curt
1956 * Thursday's tweaks.
1958 * Revision 1.16 1998/02/19 13:05:49 curt
1959 * Incorporated some HUD tweaks from Michelle America.
1960 * Tweaked the sky's sunset/rise colors.
1961 * Other misc. tweaks.
1963 * Revision 1.15 1998/02/16 13:38:39 curt
1964 * Integrated changes from Charlie Hotchkiss.
1966 * Revision 1.14 1998/02/12 21:59:41 curt
1967 * Incorporated code changes contributed by Charlie Hotchkiss
1968 * <chotchkiss@namg.us.anritsu.com>
1970 * Revision 1.12 1998/02/09 15:07:48 curt
1973 * Revision 1.11 1998/02/07 15:29:34 curt
1974 * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
1975 * <chotchkiss@namg.us.anritsu.com>
1977 * Revision 1.10 1998/02/03 23:20:14 curt
1978 * Lots of little tweaks to fix various consistency problems discovered by
1979 * Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
1980 * passed arguments along to the real printf(). Also incorporated HUD changes
1981 * by Michele America.
1983 * Revision 1.9 1998/01/31 00:43:04 curt
1984 * Added MetroWorks patches from Carmen Volpe.
1986 * Revision 1.8 1998/01/27 00:47:51 curt
1987 * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
1988 * system and commandline/config file processing code.
1990 * Revision 1.7 1998/01/19 18:40:20 curt
1991 * Tons of little changes to clean up the code and to remove fatal errors
1992 * when building with the c++ compiler.
1994 * Revision 1.6 1997/12/15 23:54:34 curt
1995 * Add xgl wrappers for debugging.
1996 * Generate terrain normals on the fly.
1998 * Revision 1.5 1997/12/10 22:37:39 curt
1999 * Prepended "fg" on the name of all global structures that didn't have it yet.
2000 * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
2002 * Revision 1.4 1997/09/23 00:29:32 curt
2003 * Tweaks to get things to compile with gcc-win32.
2005 * Revision 1.3 1997/09/05 14:17:26 curt
2006 * More tweaking with stars.
2008 * Revision 1.2 1997/09/04 02:17:30 curt
2011 * Revision 1.1 1997/08/29 18:03:22 curt