]> git.mxchange.org Git - flightgear.git/blob - Main/options.cxx
Output position & orientation when pausing.
[flightgear.git] / Main / options.cxx
1 //
2 // options.cxx -- class to handle command line options
3 //
4 // Written by Curtis Olson, started April 1998.
5 //
6 // Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
7 //
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.
12 //
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.
17 //
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.
21 //
22 // $Id$
23 // (Log is kept at end of this file)
24
25
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include <math.h>            // rint()
31 #include <stdio.h>
32 #include <stdlib.h>          // atof(), atoi()
33 #include <string.h>
34
35 #include <Debug/fg_debug.h>
36 #include <Flight/flight.h>
37 #include <Include/fg_constants.h>
38 #include <Include/fg_zlib.h>
39
40 #include "options.hxx"
41
42
43 // Defined the shared options class here
44 fgOPTIONS current_options;
45
46
47 // Constructor
48 fgOPTIONS::fgOPTIONS( void ) {
49     // set initial values/defaults
50
51     if ( getenv("FG_ROOT") != NULL ) {
52         // fg_root could be anywhere, so default to environmental
53         // variable $FG_ROOT if it is set.
54
55         strcpy(fg_root, getenv("FG_ROOT"));
56     } else {
57         // Otherwise, default to a random compiled in location if
58         // $FG_ROOT is not set.  This can still be overridden from the
59         // command line or a config file.
60
61 #if defined(WIN32)
62         strcpy(fg_root, "\\FlightGear");
63 #else
64         strcpy(fg_root, "/usr/local/lib/FlightGear");
65 #endif
66     }
67
68     // Starting posistion and orientation
69     strcpy(airport_id, "");  // default airport id
70     lon = 0.0;               // starting longitude in degrees (west = -)
71     lat = 0.0;               // starting latitude in degrees (south = -)
72
73     // If nothing else is specified, default initial position is
74     // Globe, AZ (P13)
75     lon = -110.6642444;
76     lat  =  33.3528917;
77
78     // North of the city of Globe
79     // lon = -110.7;
80     // lat =   33.4;
81
82     // North of the city of Globe
83     // lon = -110.742578;
84     // lat =   33.507122;
85
86     // Near where I used to live in Globe, AZ
87     // lon = -110.766000;
88     // lat =   33.377778;
89
90     // 10125 Jewell St. NE
91     // lon = -93.15;
92     // lat =  45.15;
93
94     // Near KHSP (Hot Springs, VA)
95     // lon = -79.8338964 + 0.01;
96     // lat =  37.9514564 + 0.008;
97
98     // (SEZ) SEDONA airport
99     // lon = -111.7884614 + 0.01;
100     // lat =   34.8486289 - 0.015;
101
102     // Somewhere near the Grand Canyon
103     // lon = -112.5;
104     // lat =   36.5;
105
106     // Jim Brennon's Kingmont Observatory
107     // lon = -121.1131667;
108     // lat =   38.8293917;
109
110     // Huaras, Peru (S09d 31.871'  W077d 31.498')
111     // lon = -77.5249667;
112     // lat =  -9.5311833;
113  
114     // Eclipse Watching w73.5 n10 (approx) 18:00 UT
115     // lon = -73.5;
116     // lat =  10.0;
117
118     // Test Position
119     // lon =  8.5;
120     // lat = 47.5;
121
122     // Timms Hill (WI)
123     // lon = -90.1953055556;
124     // lat =  45.4511388889;
125
126     altitude = -9999.0;      // starting altitude in meters (this will be
127                              // reset to ground level if it is lower
128                              // than the terrain
129
130     // Initial Orientation
131     heading = 270.0;         // heading (yaw) angle in degress (Psi)
132     roll    =   0.0;         // roll angle in degrees (Phi)
133     pitch   =   0.424;       // pitch angle in degrees (Theta)
134
135     // Miscellaneous
136     splash_screen = 1;
137     intro_music = 1;
138     mouse_pointer = 0;
139     pause = 0;
140
141     // Features
142     hud_status = 1;
143     panel_status = 0;
144
145     // Flight Model options
146     flight_model = FG_LARCSIM;
147
148     // Rendering options
149     fog = 2;    // nicest
150     fov = 55.0;
151     fullscreen = 0;
152     shading = 1;
153     skyblend = 1;
154     textures = 1;
155     wireframe = 0;
156
157     // Scenery options
158     tile_diameter = 5;
159
160     // Time options
161     time_offset = 0;
162 }
163
164
165 // Parse an int out of a --foo-bar=n type option 
166 static int parse_int(char *arg) {
167     int result;
168
169     // advance past the '='
170     while ( (arg[0] != '=') && (arg[0] != '\0') ) {
171         arg++;
172     }
173
174     if ( arg[0] == '=' ) {
175         arg++;
176     }
177
178     // printf("parse_int(): arg = %s\n", arg);
179
180     result = atoi(arg);
181
182     // printf("parse_int(): result = %d\n", result);
183
184     return(result);
185 }
186
187
188 // Parse an int out of a --foo-bar=n type option 
189 static double parse_double(char *arg) {
190     double result;
191
192     // advance past the '='
193     while ( (arg[0] != '=') && (arg[0] != '\0') ) {
194         arg++;
195     }
196
197     if ( arg[0] == '=' ) {
198         arg++;
199     }
200
201     // printf("parse_double(): arg = %s\n", arg);
202
203     result = atof(arg);
204
205     // printf("parse_double(): result = %.4f\n", result);
206
207     return(result);
208 }
209
210
211 static double parse_time(char *time_str) {
212     char num[256];
213     double hours, minutes, seconds;
214     double result = 0.0;
215     int sign = 1;
216     int i;
217
218     // printf("parse_time(): %s\n", time_str);
219
220     // check for sign
221     if ( strlen(time_str) ) {
222         if ( time_str[0] == '+' ) {
223             sign = 1;
224             time_str++;
225         } else if ( time_str[0] == '-' ) {
226             sign = -1;
227             time_str++;
228         }
229     }
230     // printf("sign = %d\n", sign);
231
232     // get hours
233     if ( strlen(time_str) ) {
234         i = 0;
235         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
236             num[i] = time_str[0];
237             time_str++;
238             i++;
239         }
240         if ( time_str[0] == ':' ) {
241             time_str++;
242         }
243         num[i] = '\0';
244         hours = atof(num);
245         // printf("hours = %.2lf\n", hours);
246
247         result += hours;
248     }
249
250     // get minutes
251     if ( strlen(time_str) ) {
252         i = 0;
253         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
254             num[i] = time_str[0];
255             time_str++;
256             i++;
257         }
258         if ( time_str[0] == ':' ) {
259             time_str++;
260         }
261         num[i] = '\0';
262         minutes = atof(num);
263         // printf("minutes = %.2lf\n", minutes);
264
265         result += minutes / 60.0;
266     }
267
268     // get seconds
269     if ( strlen(time_str) ) {
270         i = 0;
271         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
272             num[i] = time_str[0];
273             time_str++;
274             i++;
275         }
276         num[i] = '\0';
277         seconds = atof(num);
278         // printf("seconds = %.2lf\n", seconds);
279
280         result += seconds / 3600.0;
281     }
282
283     return(sign * result);
284 }
285
286
287 // parse degree in the form of [+/-]hhh:mm:ss
288 static double parse_degree(char *degree_str) {
289     double result;
290
291     // advance past the '='
292     while ( (degree_str[0] != '=') && (degree_str[0] != '\0') ) {
293         degree_str++;
294     }
295
296     if ( degree_str[0] == '=' ) {
297         degree_str++;
298     }
299
300     result = parse_time(degree_str);
301
302     // printf("Degree = %.4f\n", result);
303
304     return(result);
305 }
306
307
308 // parse time offset command line option
309 static int parse_time_offset(char *time_str) {
310     int result;
311
312     // advance past the '='
313     while ( (time_str[0] != '=') && (time_str[0] != '\0') ) {
314         time_str++;
315     }
316
317     if ( time_str[0] == '=' ) {
318         time_str++;
319     }
320
321     // printf("time offset = %s\n", time_str);
322
323 #ifdef HAVE_RINT
324     result = (int)rint(parse_time(time_str) * 3600.0);
325 #else
326     result = (int)(parse_time(time_str) * 3600.0);
327 #endif
328
329     // printf("parse_time_offset(): %d\n", result);
330
331     return( result );
332 }
333
334
335 // Parse --tile-diameter=n type option 
336
337 #define FG_RADIUS_MIN 1
338 #define FG_RADIUS_MAX 4
339
340 static int parse_tile_radius(char *arg) {
341     int radius;
342
343     radius = parse_int(arg);
344
345     if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
346     if ( radius > FG_RADIUS_MAX ) { radius = FG_RADIUS_MAX; }
347
348     // printf("parse_tile_radius(): radius = %d\n", radius);
349
350     return(radius);
351 }
352
353
354 // Parse --flightmode=abcdefg type option 
355 static int parse_flight_model(char *fm) {
356     fm += 15;
357
358     // printf("flight model = %s\n", fm);
359
360     if ( strcmp(fm, "slew") == 0 ) {
361         return(FG_SLEW);
362     } else if ( strcmp(fm, "larcsim") == 0 ) {
363         return(FG_LARCSIM);
364     } else if ( strcmp(fm, "LaRCsim") == 0 ) {
365         return(FG_LARCSIM);
366     } else {
367         fgPrintf( FG_GENERAL, FG_EXIT, "Unknown flight model = %s\n", fm);
368     }
369
370     // we'll never get here, but it makes the compiler happy.
371     return(-1);
372 }
373
374
375 // Parse --fov=x.xx type option 
376 static double parse_fov(char *arg) {
377     double fov;
378
379     fov = parse_double(arg);
380
381     if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
382     if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
383
384     // printf("parse_fov(): result = %.4f\n", fov);
385
386     return(fov);
387 }
388
389
390 // Parse a single option
391 int fgOPTIONS::parse_option( char *arg ) {
392     // General Options
393     if ( (strcmp(arg, "--help") == 0) ||
394          (strcmp(arg, "-h") == 0) ) {
395         // help/usage request
396         return(FG_OPTIONS_HELP);
397     } else if ( strcmp(arg, "--disable-splash-screen") == 0 ) {
398         splash_screen = 0;
399     } else if ( strcmp(arg, "--enable-splash-screen") == 0 ) {
400         splash_screen = 1;
401     } else if ( strcmp(arg, "--disable-intro-music") == 0 ) {
402         intro_music = 0;
403     } else if ( strcmp(arg, "--enable-intro-music") == 0 ) {
404         intro_music = 1;
405     } else if ( strcmp(arg, "--disable-mouse-pointer") == 0 ) {
406         mouse_pointer = 1;
407     } else if ( strcmp(arg, "--enable-mouse-pointer") == 0 ) {
408         mouse_pointer = 2;
409     } else if ( strcmp(arg, "--disable-pause") == 0 ) {
410         pause = 0;      
411     } else if ( strcmp(arg, "--enable-pause") == 0 ) {
412         pause = 1;      
413     } else if ( strcmp(arg, "--disable-hud") == 0 ) {
414         hud_status = 0; 
415     } else if ( strcmp(arg, "--enable-hud") == 0 ) {
416         hud_status = 1; 
417     } else if ( strcmp(arg, "--disable-panel") == 0 ) {
418         panel_status = 0;
419     } else if ( strcmp(arg, "--enable-panel") == 0 ) {
420         panel_status = 1;
421     } else if ( strcmp(arg, "--disable-sound") == 0 ) {
422         sound = 0;
423     } else if ( strcmp(arg, "--enable-sound") == 0 ) {
424         sound = 1;
425     } else if ( strncmp(arg, "--airport-id=", 13) == 0 ) {
426         arg += 13;
427         strncpy(airport_id, arg, 4);
428     } else if ( strncmp(arg, "--lon=", 6) == 0 ) {
429         lon = parse_degree(arg);
430     } else if ( strncmp(arg, "--lat=", 6) == 0 ) {
431         lat = parse_degree(arg);
432     } else if ( strncmp(arg, "--altitude=", 11) == 0 ) {
433         altitude = parse_double(arg);
434     } else if ( strncmp(arg, "--heading=", 6) == 0 ) {
435         heading = parse_double(arg);
436     } else if ( strncmp(arg, "--roll=", 7) == 0 ) {
437         roll = parse_double(arg);
438     } else if ( strncmp(arg, "--pitch=", 8) == 0 ) {
439         pitch = parse_double(arg);
440     } else if ( strncmp(arg, "--fg-root=", 10) == 0 ) {
441         arg += 10;
442         strcpy(fg_root, arg);
443     } else if ( strncmp(arg, "--flight-model=", 15) == 0 ) {
444         flight_model = parse_flight_model(arg);
445     } else if ( strcmp(arg, "--fog-disable") == 0 ) {
446         fog = 0;        
447     } else if ( strcmp(arg, "--fog-fastest") == 0 ) {
448         fog = 1;        
449     } else if ( strcmp(arg, "--fog-nicest") == 0 ) {
450         fog = 2;        
451     } else if ( strncmp(arg, "--fov=", 6) == 0 ) {
452         fov = parse_fov(arg);
453     } else if ( strcmp(arg, "--disable-fullscreen") == 0 ) {
454         fullscreen = 0; 
455     } else if ( strcmp(arg, "--enable-fullscreen") == 0 ) {
456         fullscreen = 1; 
457     } else if ( strcmp(arg, "--shading-flat") == 0 ) {
458         shading = 0;    
459     } else if ( strcmp(arg, "--shading-smooth") == 0 ) {
460         shading = 1;    
461     } else if ( strcmp(arg, "--disable-skyblend") == 0 ) {
462         skyblend = 0;   
463     } else if ( strcmp(arg, "--enable-skyblend") == 0 ) {
464         skyblend = 1;   
465     } else if ( strcmp(arg, "--disable-textures") == 0 ) {
466         textures = 0;   
467     } else if ( strcmp(arg, "--enable-textures") == 0 ) {
468         textures = 1;   
469     } else if ( strcmp(arg, "--disable-wireframe") == 0 ) {
470         wireframe = 0;  
471     } else if ( strcmp(arg, "--enable-wireframe") == 0 ) {
472         wireframe = 1;  
473     } else if ( strncmp(arg, "--tile-radius=", 14) == 0 ) {
474         tile_radius = parse_tile_radius(arg);
475         tile_diameter = tile_radius * 2 + 1;
476     } else if ( strncmp(arg, "--time-offset=", 14) == 0 ) {
477         time_offset = parse_time_offset(arg);
478     } else {
479         fgPrintf( FG_GENERAL, FG_EXIT, "Unknown option '%s'\n", arg);
480         return(FG_OPTIONS_ERROR);
481     }
482     
483     return(FG_OPTIONS_OK);
484 }
485
486
487 // Parse the command line options
488 int fgOPTIONS::parse_command_line( int argc, char **argv ) {
489     int i = 1;
490     int result;
491
492     fgPrintf(FG_GENERAL, FG_INFO, "Processing command line arguments\n");
493
494     while ( i < argc ) {
495         fgPrintf(FG_GENERAL, FG_DEBUG, "argv[%d] = %s\n", i, argv[i]);
496
497         result = parse_option(argv[i]);
498         if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
499             return(result);
500         }
501
502         i++;
503     }
504     
505     return(FG_OPTIONS_OK);
506 }
507
508
509 // Parse the command line options
510 int fgOPTIONS::parse_config_file( char *path ) {
511     char fgpath[256], line[256];
512     fgFile f;
513     int len, result;
514
515     strcpy(fgpath, path);
516     strcat(fgpath, ".gz");
517
518     // first try "path.gz"
519     if ( (f = fgopen(fgpath, "rb")) == NULL ) {
520         // next try "path"
521         if ( (f = fgopen(path, "rb")) == NULL ) {
522             return(FG_OPTIONS_ERROR);
523         }
524     }
525
526     fgPrintf(FG_GENERAL, FG_INFO, "Processing config file: %s\n", path);
527
528     while ( fggets(f, line, 250) != NULL ) {
529         // strip trailing newline if it exists
530         len = strlen(line);
531         if ( line[len-1] == '\n' ) {
532             line[len-1] = '\0';
533         }
534
535         // strip dos ^M if it exists
536         len = strlen(line);
537         if ( line[len-1] == '\r' ) {
538             line[len-1] = '\0';
539         }
540
541         result = parse_option(line);
542         if ( result == FG_OPTIONS_ERROR ) {
543             fgPrintf( FG_GENERAL, FG_EXIT, 
544                       "Config file parse error: %s '%s'\n", path, line );
545         }
546     }
547
548     fgclose(f);
549     return(FG_OPTIONS_OK);
550 }
551
552
553 // Print usage message
554 void fgOPTIONS::usage ( void ) {
555     printf("Usage: fg [ options ... ]\n");
556     printf("\n");
557
558     printf("General Options:\n");
559     printf("\t--help -h:  print usage\n");
560     printf("\t--fg-root=path:  specify the root path for all the data files\n");
561     printf("\t--disable-splash-screen:  disable splash screen\n");
562     printf("\t--enable-splash-screen:  enable splash screen\n");
563     printf("\t--disable-intro-music:  disable introduction music\n");
564     printf("\t--enable-intro-music:  enable introduction music\n");
565     printf("\t--disable-mouse-pointer:  disable extra mouse pointer\n");
566     printf("\t--enable-mouse-pointer:  enable extra mouse pointer (i.e. for\n");
567     printf("\t\tfull screen voodoo/voodoo-II based cards.)\n");
568     printf("\t--disable-pause:  start out in an active state\n");
569     printf("\t--enable-pause:  start out in a paused state\n");
570     printf("\n");
571
572     printf("Features:\n");
573     printf("\t--disable-hud:  disable heads up display\n");
574     printf("\t--enable-hud:  enable heads up display\n");
575     printf("\t--disable-panel:  disable instrument panel\n");
576     printf("\t--enable-panel:  enable instrumetn panel\n");
577     printf("\t--disable-sound:  disable sound effects\n");
578     printf("\t--enable-sound:  enable sound effects\n");
579     printf("\n");
580  
581     printf("Initial Position and Orientation:\n");
582     printf("\t--airport-id=ABCD:  specify starting postion by airport id\n");
583     printf("\t--lon=degrees:  starting longitude in degrees (west = -)\n");
584     printf("\t--lat=degrees:  starting latitude in degrees (south = -)\n");
585     printf("\t--altitude=meters:  starting altitude in meters\n");
586     printf("\t--heading=degrees:  heading (yaw) angle in degress (Psi)\n");
587     printf("\t--roll=degrees:  roll angle in degrees (Phi)\n");
588     printf("\t--pitch=degrees:  pitch angle in degrees (Theta)\n");
589     printf("\n");
590
591     printf("Rendering Options:\n");
592     printf("\t--fog-disable:  disable fog/haze\n");
593     printf("\t--fog-fastest:  enable fastest fog/haze\n");
594     printf("\t--fog-nicest:  enable nicest fog/haze\n");
595     printf("\t--fov=xx.x:  specify initial field of view angle in degrees\n");
596     printf("\t--disable-fullscreen:  disable fullscreen mode\n");
597     printf("\t--enable-fullscreen:  enable fullscreen mode\n");
598     printf("\t--shading-flat:  enable flat shading\n");
599     printf("\t--shading-smooth:  enable smooth shading\n");
600     printf("\t--disable-skyblend:  disable sky blending\n");
601     printf("\t--enable-skyblend:  enable sky blending\n");
602     printf("\t--disable-textures:  disable textures\n");
603     printf("\t--enable-textures:  enable textures\n");
604     printf("\t--disable-wireframe:  disable wireframe drawing mode\n");
605     printf("\t--enable-wireframe:  enable wireframe drawing mode\n");
606     printf("\n");
607
608     printf("Scenery Options:\n");
609     printf("\t--tile-radius=n:  specify tile radius, must be 1 - 4\n");
610     printf("\n");
611
612     printf("Time Options:\n");
613     printf("\t--time-offset=[+-]hh:mm:ss:  offset local time by this amount\n");
614 }
615
616
617 // Query functions
618 void fgOPTIONS::get_fg_root(char *root) { strcpy(root, fg_root); }
619 void fgOPTIONS::get_airport_id(char *id) { strcpy(id, airport_id); }
620 double fgOPTIONS::get_lon( void ) { return(lon); }
621 double fgOPTIONS::get_lat( void ) { return(lat); }
622 double fgOPTIONS::get_altitude( void ) { return(altitude); }
623 double fgOPTIONS::get_heading( void ) { return(heading); }
624 double fgOPTIONS::get_roll( void ) { return(roll); }
625 double fgOPTIONS::get_pitch( void ) { return(pitch); }
626 int fgOPTIONS::get_splash_screen( void ) { return(splash_screen); }
627 int fgOPTIONS::get_intro_music( void ) { return(intro_music); }
628 int fgOPTIONS::get_mouse_pointer( void ) { return(mouse_pointer); }
629 int fgOPTIONS::get_pause( void ) { return(pause); }
630 int fgOPTIONS::get_hud_status( void ) { return(hud_status); }
631 int fgOPTIONS::get_panel_status( void ) { return(panel_status); }
632 int fgOPTIONS::get_sound( void ) { return(sound); }
633 int fgOPTIONS::get_flight_model( void ) { return(flight_model); }
634 int fgOPTIONS::get_fog( void ) { return(fog); }
635 double fgOPTIONS::get_fov( void ) { return(fov); }
636 int fgOPTIONS::get_fullscreen( void ) { return(fullscreen); }
637 int fgOPTIONS::get_shading( void ) { return(shading); }
638 int fgOPTIONS::get_skyblend( void ) { return(skyblend); }
639 int fgOPTIONS::get_textures( void ) { return(textures); }
640 int fgOPTIONS::get_wireframe( void ) { return(wireframe); }
641 int fgOPTIONS::get_tile_radius( void ) { return(tile_radius); }
642 int fgOPTIONS::get_tile_diameter( void ) { return(tile_diameter); }
643 int fgOPTIONS::get_time_offset( void ) { return(time_offset); }
644
645
646 // Update functions
647 void fgOPTIONS::set_hud_status( int status ) { hud_status = status; }
648 void fgOPTIONS::set_fov( double amount ) { fov = amount; }
649
650 // Destructor
651 fgOPTIONS::~fgOPTIONS( void ) {
652 }
653
654
655 // $Log$
656 // Revision 1.20  1998/07/30 23:48:28  curt
657 // Output position & orientation when pausing.
658 // Eliminated libtool use.
659 // Added options to specify initial position and orientation.
660 // Changed default fov to 55 degrees.
661 // Added command line option to start in paused or unpaused state.
662 //
663 // Revision 1.19  1998/07/27 18:41:25  curt
664 // Added a pause command "p"
665 // Fixed some initialization order problems between pui and glut.
666 // Added an --enable/disable-sound option.
667 //
668 // Revision 1.18  1998/07/22 01:27:03  curt
669 // Strip out \r when parsing config file in case we are on a windoze system.
670 //
671 // Revision 1.17  1998/07/16 17:33:38  curt
672 // "H" / "h" now control hud brightness as well with off being one of the
673 //   states.
674 // Better checking for xmesa/fx 3dfx fullscreen/window support for deciding
675 //   whether or not to build in the feature.
676 // Translucent menu support.
677 // HAVE_AUDIO_SUPPORT -> ENABLE_AUDIO_SUPPORT
678 // Use fork() / wait() for playing mp3 init music in background under unix.
679 // Changed default tile diameter to 5.
680 //
681 // Revision 1.16  1998/07/13 21:01:39  curt
682 // Wrote access functions for current fgOPTIONS.
683 //
684 // Revision 1.15  1998/07/06 21:34:19  curt
685 // Added an enable/disable splash screen option.
686 // Added an enable/disable intro music option.
687 // Added an enable/disable instrument panel option.
688 // Added an enable/disable mouse pointer option.
689 // Added using namespace std for compilers that support this.
690 //
691 // Revision 1.14  1998/07/04 00:52:26  curt
692 // Add my own version of gluLookAt() (which is nearly identical to the
693 // Mesa/glu version.)  But, by calculating the Model View matrix our selves
694 // we can save this matrix without having to read it back in from the video
695 // card.  This hopefully allows us to save a few cpu cycles when rendering
696 // out the fragments because we can just use glLoadMatrixd() with the
697 // precalculated matrix for each tile rather than doing a push(), translate(),
698 // pop() for every fragment.
699 //
700 // Panel status defaults to off for now until it gets a bit more developed.
701 //
702 // Extract OpenGL driver info on initialization.
703 //
704 // Revision 1.13  1998/06/27 16:54:34  curt
705 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
706 // Don't change the view port when displaying the panel.
707 //
708 // Revision 1.12  1998/06/17 21:35:13  curt
709 // Refined conditional audio support compilation.
710 // Moved texture parameter setup calls to ../Scenery/materials.cxx
711 // #include <string.h> before various STL includes.
712 // Make HUD default state be enabled.
713 //
714 // Revision 1.11  1998/06/13 00:40:33  curt
715 // Tweaked fog command line options.
716 //
717 // Revision 1.10  1998/05/16 13:08:36  curt
718 // C++ - ified views.[ch]xx
719 // Shuffled some additional view parameters into the fgVIEW class.
720 // Changed tile-radius to tile-diameter because it is a much better
721 //   name.
722 // Added a WORLD_TO_EYE transformation to views.cxx.  This allows us
723 //  to transform world space to eye space for view frustum culling.
724 //
725 // Revision 1.9  1998/05/13 18:29:59  curt
726 // Added a keyboard binding to dynamically adjust field of view.
727 // Added a command line option to specify fov.
728 // Adjusted terrain color.
729 // Root path info moved to fgOPTIONS.
730 // Added ability to parse options out of a config file.
731 //
732 // Revision 1.8  1998/05/07 23:14:16  curt
733 // Added "D" key binding to set autopilot heading.
734 // Made frame rate calculation average out over last 10 frames.
735 // Borland C++ floating point exception workaround.
736 // Added a --tile-radius=n option.
737 //
738 // Revision 1.7  1998/05/06 03:16:25  curt
739 // Added an averaged global frame rate counter.
740 // Added an option to control tile radius.
741 //
742 // Revision 1.6  1998/05/03 00:47:32  curt
743 // Added an option to enable/disable full-screen mode.
744 //
745 // Revision 1.5  1998/04/30 12:34:19  curt
746 // Added command line rendering options:
747 //   enable/disable fog/haze
748 //   specify smooth/flat shading
749 //   disable sky blending and just use a solid color
750 //   enable wireframe drawing mode
751 //
752 // Revision 1.4  1998/04/28 01:20:22  curt
753 // Type-ified fgTIME and fgVIEW.
754 // Added a command line option to disable textures.
755 //
756 // Revision 1.3  1998/04/26 05:01:19  curt
757 // Added an rint() / HAVE_RINT check.
758 //
759 // Revision 1.2  1998/04/25 15:11:12  curt
760 // Added an command line option to set starting position based on airport ID.
761 //
762 // Revision 1.1  1998/04/24 00:49:21  curt
763 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
764 // Trying out some different option parsing code.
765 // Some code reorganization.
766 //
767 //