2 // fg_init.cxx -- Flight Gear top level initialization routines
4 // Written by Curtis Olson, started August 1997.
6 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.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.
24 // (Log is kept at end of this file)
34 // work around a stdc++ lib bug in some versions of linux, but doesn't
35 // seem to hurt to have this here for all versions of Linux.
37 # define _G_NO_EXTERN_TEMPLATES
42 #include <Include/fg_constants.h>
44 #include <Aircraft/aircraft.hxx>
45 #include <Airports/simple.hxx>
46 #include <Astro/sky.hxx>
47 #include <Astro/stars.hxx>
48 #include <Astro/solarsystem.hxx>
49 #include <Autopilot/autopilot.hxx>
50 #include <Cockpit/cockpit.hxx>
51 #include <Debug/logstream.hxx>
52 #include <Joystick/joystick.hxx>
53 #include <Math/fg_geodesy.hxx>
54 #include <Math/fg_random.h>
55 #include <Math/point3d.hxx>
56 #include <Math/polar3d.hxx>
57 #include <Scenery/scenery.hxx>
58 #include <Scenery/tilemgr.hxx>
59 #include <Time/event.hxx>
60 #include <Time/fg_time.hxx>
61 #include <Time/light.hxx>
62 #include <Time/sunpos.hxx>
63 #include <Weather/weather.hxx>
65 #include "fg_init.hxx"
66 #include "options.hxx"
68 #include "fg_serial.hxx"
71 extern const char *default_root;
74 // Set initial position and orientation
75 int fgInitPosition( void ) {
79 f = current_aircraft.fdm_state;
81 id = current_options.get_airport_id();
83 // set initial position from airport id
88 FG_LOG( FG_GENERAL, FG_INFO,
89 "Attempting to set starting position from airport code "
92 airports.load("apt_simple");
93 if ( ! airports.search( id, &a ) ) {
94 FG_LOG( FG_GENERAL, FG_ALERT,
95 "Failed to find " << id << " in database." );
98 f->set_Longitude( a.longitude * DEG_TO_RAD );
99 f->set_Latitude( a.latitude * DEG_TO_RAD );
102 // set initial position from default or command line coordinates
104 f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
105 f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
107 FG_LOG( FG_GENERAL, FG_INFO,
108 "starting altitude is = " << current_options.get_altitude() );
110 f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
111 fgFDMSetGroundElevation( current_options.get_flight_model(),
112 (f->get_Altitude() - 3.758099) * FEET_TO_METER );
114 FG_LOG( FG_GENERAL, FG_INFO,
115 "Initial position is: ("
116 << (f->get_Longitude() * RAD_TO_DEG) << ", "
117 << (f->get_Latitude() * RAD_TO_DEG) << ", "
118 << (f->get_Altitude() * FEET_TO_METER) << ")" );
124 // General house keeping initializations
125 int fgInitGeneral( void ) {
129 FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
130 FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
132 root = current_options.get_fg_root();
133 if ( ! root.length() ) {
134 // No root path set? Then bail ...
135 FG_LOG( FG_GENERAL, FG_ALERT,
136 "Cannot continue without environment variable FG_ROOT"
137 << "being defined." );
140 FG_LOG( FG_GENERAL, FG_INFO, "FG_ROOT = " << root << endl );
142 // prime the frame rate counter pump
143 // for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
144 // general.frames[i] = 0.0;
151 // This is the top level init routine which calls all the other
152 // initialization routines. If you are adding a subsystem to flight
153 // gear, its initialization call should located in this routine.
154 // Returns non-zero if a problem encountered.
155 int fgInitSubsystems( void )
157 FGState *f; // assigned later
158 fgLIGHT *l = &cur_light_params;
159 fgTIME *t = &cur_time_params;
160 FGView *v = ¤t_view;
162 FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
163 FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
165 // seed the random number generater
168 // allocates structures so must happen before any of the flight
169 // model or control parameters are set
170 fgAircraftInit(); // In the future this might not be the case.
171 f = current_aircraft.fdm_state;
173 // set the initial position
176 // Initialize the Scenery Management subsystem
177 if ( fgSceneryInit() ) {
178 // Scenery initialized ok.
180 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Scenery initialization!" );
184 if( fgTileMgrInit() ) {
185 // Load the local scenery data
188 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
192 FG_LOG( FG_GENERAL, FG_DEBUG,
193 "Current terrain elevation after tile mgr init " <<
196 // Calculate ground elevation at starting point (we didn't have
197 // tmp_abs_view_pos calculated when fgTileMgrUpdate() was called above
199 // calculalate a cartesian point somewhere along the line between
200 // the center of the earth and our view position. Doesn't have to
201 // be the exact elevation (this is good because we don't know it
204 // now handled inside of the fgTileMgrUpdate()
207 geod_pos = Point3D( f->get_Longitude(), f->get_Latitude(), 0.0);
208 tmp_abs_view_pos = fgGeodToCart(geod_pos);
210 FG_LOG( FG_GENERAL, FG_DEBUG,
211 "Initial abs_view_pos = " << tmp_abs_view_pos );
213 fgTileMgrCurElev( f->get_Longitude(), f->get_Latitude(),
215 FG_LOG( FG_GENERAL, FG_DEBUG,
216 "Altitude after update " << scenery.cur_elev );
219 fgFDMSetGroundElevation( current_options.get_flight_model(),
222 // Reset our altitude if we are below ground
223 FG_LOG( FG_GENERAL, FG_DEBUG, "Current altitude = " << f->get_Altitude() );
224 FG_LOG( FG_GENERAL, FG_DEBUG, "Current runway altitude = " <<
225 f->get_Runway_altitude() );
227 if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
228 f->set_Altitude( f->get_Runway_altitude() + 3.758099 );
231 FG_LOG( FG_GENERAL, FG_INFO,
232 "Updated position (after elevation adj): ("
233 << (f->get_Latitude() * RAD_TO_DEG) << ", "
234 << (f->get_Longitude() * RAD_TO_DEG) << ", "
235 << (f->get_Altitude() * FEET_TO_METER) << ")" );
237 // We need to calculate a few more values here that would normally
238 // be calculated by the FDM so that the v->UpdateViewMath()
239 // routine doesn't get hosed.
241 double sea_level_radius_meters;
243 // Set the FG variables first
244 fgGeodToGeoc( f->get_Latitude(), f->get_Altitude(),
245 &sea_level_radius_meters, &lat_geoc);
246 f->set_Geocentric_Position( lat_geoc, f->get_Longitude(),
248 (sea_level_radius_meters * METER_TO_FEET) );
249 f->set_Sea_level_radius( sea_level_radius_meters * METER_TO_FEET );
251 // The following section sets up the flight model EOM parameters
252 // and should really be read in from one or more files.
255 f->set_Velocities_Local( 0.0, 0.0, 0.0 );
257 // Initial Orientation
258 f->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
259 current_options.get_pitch() * DEG_TO_RAD,
260 current_options.get_heading() * DEG_TO_RAD );
262 // Initial Angular Body rates
263 f->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
265 f->set_Earth_position_angle( 0.0 );
267 // Mass properties and geometry values
268 f->set_Inertias( 8.547270E+01,
269 1.048000E+03, 3.000000E+03, 3.530000E+03, 0.000000E+00 );
271 // CG position w.r.t. ref. point
272 f->set_CG_Position( 0.0, 0.0, 0.0 );
274 // Initialize the event manager
275 global_events.Init();
277 // Output event stats every 60 seconds
278 global_events.Register( "fgEVENT_MGR::PrintStats()",
279 fgMethodCallback<fgEVENT_MGR>( &global_events,
280 &fgEVENT_MGR::PrintStats),
281 fgEVENT::FG_EVENT_READY, 60000 );
283 // Initialize the time dependent variables
287 // Initialize view parameters
288 FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
290 FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
291 v->UpdateViewMath(f);
292 FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos());
293 v->UpdateWorldToEye(f);
295 // Build the solar system
296 //fgSolarSystemInit(*t);
297 FG_LOG(FG_GENERAL, FG_INFO, "Building SolarSystem");
298 SolarSystem::theSolarSystem = new SolarSystem(t);
300 // Initialize the Stars subsystem
301 if( fgStarsInit() ) {
302 // Stars initialized ok.
304 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Stars initialization!" );
308 // Initialize the planetary subsystem
309 // global_events.Register( "fgPlanetsInit()", fgPlanetsInit,
310 // fgEVENT::FG_EVENT_READY, 600000);
312 // Initialize the sun's position
313 // global_events.Register( "fgSunInit()", fgSunInit,
314 // fgEVENT::FG_EVENT_READY, 30000 );
316 // Intialize the moon's position
317 // global_events.Register( "fgMoonInit()", fgMoonInit,
318 // fgEVENT::FG_EVENT_READY, 600000 );
320 // register the periodic update of Sun, moon, and planets
321 global_events.Register( "ssolsysUpdate", solarSystemRebuild,
322 fgEVENT::FG_EVENT_READY, 600000);
324 // fgUpdateSunPos() needs a few position and view parameters set
325 // so it can calculate local relative sun angle and a few other
326 // things for correctly orienting the sky.
328 global_events.Register( "fgUpdateSunPos()", fgUpdateSunPos,
329 fgEVENT::FG_EVENT_READY, 60000);
331 // Initialize Lighting interpolation tables
334 // update the lighting parameters (based on sun angle)
335 global_events.Register( "fgLight::Update()",
336 fgMethodCallback<fgLIGHT>( &cur_light_params,
338 fgEVENT::FG_EVENT_READY, 30000 );
340 // Initialize the weather modeling subsystem
341 current_weather.Init();
343 // Initialize the Cockpit subsystem
344 if( fgCockpitInit( ¤t_aircraft )) {
345 // Cockpit initialized ok.
347 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Cockpit initialization!" );
351 // Initialize the "sky"
354 // Initialize the flight model subsystem data structures base on
357 fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
358 1.0 / DEFAULT_MODEL_HZ );
360 // I'm just sticking this here for now, it should probably move
362 scenery.cur_elev = f->get_Runway_altitude() * FEET_TO_METER;
364 if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
365 f->set_Altitude( f->get_Runway_altitude() + 3.758099 );
368 FG_LOG( FG_GENERAL, FG_INFO,
369 "Updated position (after elevation adj): ("
370 << (f->get_Latitude() * RAD_TO_DEG) << ", "
371 << (f->get_Longitude() * RAD_TO_DEG) << ", "
372 << (f->get_Altitude() * FEET_TO_METER) << ")" );
373 // end of thing that I just stuck in that I should probably move
376 if ( fgJoystickInit() ) {
377 // Joystick initialized ok.
379 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!" );
382 // Autopilot init added here, by Jeff Goeke-Smith
383 fgAPInit(¤t_aircraft);
385 // Initialize serial ports
388 FG_LOG( FG_GENERAL, FG_INFO, endl);
395 // Revision 1.65 1999/02/02 20:13:36 curt
396 // MSVC++ portability changes by Bernie Bright:
398 // Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
399 // Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
400 // Simulator/Cockpit/hud.cxx: Added Standard headers
401 // Simulator/Cockpit/panel.cxx: Redefinition of default parameter
402 // Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
403 // Simulator/Main/fg_init.cxx:
404 // Simulator/Main/GLUTmain.cxx:
405 // Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
406 // Simulator/Objects/material.hxx:
407 // Simulator/Time/timestamp.hxx: VC++ friend kludge
408 // Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
409 // Simulator/Main/views.hxx: Added a constant
411 // Revision 1.64 1999/02/01 21:15:43 curt
412 // Removed unused variables.
414 // Revision 1.63 1999/01/27 04:49:19 curt
415 // Game mode fixes from Norman Vine.
416 // Initial altitude setting tweaks and fixes (especially for when starting
419 // Revision 1.62 1999/01/20 13:42:25 curt
420 // Tweaked FDM interface.
421 // Testing check sum support for NMEA serial output.
423 // Revision 1.61 1999/01/08 03:23:57 curt
424 // Beginning work on compensating for sim time vs. real world time "jitter".
426 // Revision 1.60 1999/01/07 20:25:09 curt
427 // Updated struct fgGENERAL to class FGGeneral.
429 // Revision 1.59 1998/12/18 23:40:57 curt
430 // New frame rate counting mechanism.
432 // Revision 1.58 1998/12/09 18:50:25 curt
433 // Converted "class fgVIEW" to "class FGView" and updated to make data
434 // members private and make required accessor functions.
436 // Revision 1.57 1998/12/06 14:52:56 curt
437 // Fixed a problem with the initial starting altitude. "v->abs_view_pos" wasn't
438 // being calculated correctly at the beginning causing the first terrain
439 // intersection to fail, returning a ground altitude of zero, causing the plane
440 // to free fall for one frame, until the ground altitude was corrected, but now
441 // being under the ground we got a big bounce and the plane always ended up
444 // Revision 1.56 1998/12/06 13:51:23 curt
445 // Turned "struct fgWEATHER" into "class FGWeather".
447 // Revision 1.55 1998/12/05 15:54:20 curt
448 // Renamed class fgFLIGHT to class FGState as per request by JSB.
450 // Revision 1.54 1998/12/05 14:19:53 curt
451 // Looking into a problem with cur_view_params.abs_view_pos initialization.
453 // Revision 1.53 1998/12/03 04:25:05 curt
454 // Working on fixing up new fgFLIGHT class.
456 // Revision 1.52 1998/12/03 01:17:17 curt
457 // Converted fgFLIGHT to a class.
459 // Revision 1.51 1998/11/20 01:02:37 curt
460 // Try to detect Mesa/Glide/Voodoo and chose the appropriate resolution.
462 // Revision 1.50 1998/11/16 14:00:01 curt
463 // Added pow() macro bug work around.
464 // Added support for starting FGFS at various resolutions.
465 // Added some initial serial port support.
466 // Specify default log levels in main().
468 // Revision 1.49 1998/11/11 00:24:02 curt
469 // Added Michael Johnson's audio patches for testing.
470 // Also did a few tweaks to avoid numerical problems when starting at a place
471 // with no (or bogus) scenery.
473 // Revision 1.48 1998/11/07 19:07:10 curt
474 // Enable release builds using the --without-logging option to the configure
475 // script. Also a couple log message cleanups, plus some C to C++ comment
478 // Revision 1.47 1998/11/06 21:18:10 curt
479 // Converted to new logstream debugging facility. This allows release
480 // builds with no messages at all (and no performance impact) by using
481 // the -DFG_NDEBUG flag.
483 // Revision 1.46 1998/10/27 02:14:38 curt
484 // Changes to support GLUT joystick routines as fall back.
486 // Revision 1.45 1998/10/25 10:57:21 curt
487 // Changes to use the new joystick library if it is available.
489 // Revision 1.44 1998/10/18 01:17:17 curt
492 // Revision 1.43 1998/10/17 01:34:22 curt
495 // Revision 1.42 1998/10/16 23:27:54 curt
498 // Revision 1.41 1998/10/16 00:54:01 curt
499 // Converted to Point3D class.
501 // Revision 1.40 1998/10/02 12:46:49 curt
502 // Added an "auto throttle"
504 // Revision 1.39 1998/09/29 02:03:39 curt
507 // Revision 1.38 1998/09/15 04:27:30 curt
508 // Changes for new Astro code.
510 // Revision 1.37 1998/09/15 02:09:26 curt
511 // Include/fg_callback.hxx
512 // Moved code inline to stop g++ 2.7 from complaining.
514 // Simulator/Time/event.[ch]xx
515 // Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
516 // complain bitterly.
518 // Minor bugfix and changes.
520 // Simulator/Main/GLUTmain.cxx
521 // Added missing type to idle_state definition - eliminates a warning.
523 // Simulator/Main/fg_init.cxx
524 // Changes to airport lookup.
526 // Simulator/Main/options.cxx
527 // Uses fg_gzifstream when loading config file.
529 // Revision 1.36 1998/09/08 21:40:08 curt
530 // Fixes by Charlie Hotchkiss.
532 // Revision 1.35 1998/08/29 13:09:26 curt
533 // Changes to event manager from Bernie Bright.
535 // Revision 1.34 1998/08/27 17:02:06 curt
536 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
537 // - use strings for fg_root and airport_id and added methods to return
539 // - inlined all access methods,
540 // - made the parsing functions private methods,
541 // - deleted some unused functions.
542 // - propogated some of these changes out a bit further.
544 // Revision 1.33 1998/08/25 20:53:32 curt
545 // Shuffled $FG_ROOT file layout.
547 // Revision 1.32 1998/08/25 16:59:09 curt
548 // Directory reshuffling.
550 // Revision 1.31 1998/08/22 14:49:57 curt
551 // Attempting to iron out seg faults and crashes.
552 // Did some shuffling to fix a initialization order problem between view
553 // position, scenery elevation.
555 // Revision 1.30 1998/08/20 20:32:33 curt
556 // Reshuffled some of the code in and around views.[ch]xx
558 // Revision 1.29 1998/07/30 23:48:27 curt
559 // Output position & orientation when pausing.
560 // Eliminated libtool use.
561 // Added options to specify initial position and orientation.
562 // Changed default fov to 55 degrees.
563 // Added command line option to start in paused or unpaused state.
565 // Revision 1.28 1998/07/27 18:41:25 curt
566 // Added a pause command "p"
567 // Fixed some initialization order problems between pui and glut.
568 // Added an --enable/disable-sound option.
570 // Revision 1.27 1998/07/24 21:39:10 curt
571 // Debugging output tweaks.
572 // Cast glGetString to (char *) to avoid compiler errors.
573 // Optimizations to fgGluLookAt() by Norman Vine.
575 // Revision 1.26 1998/07/22 21:40:44 curt
576 // Clear to adjusted fog color (for sunrise/sunset effects)
577 // Make call to fog sunrise/sunset adjustment method.
578 // Add a stdc++ library bug work around to fg_init.cxx
580 // Revision 1.25 1998/07/13 21:01:38 curt
581 // Wrote access functions for current fgOPTIONS.
583 // Revision 1.24 1998/07/13 15:32:39 curt
584 // Clear color buffer if drawing wireframe.
585 // When specifying and airport, start elevation at -1000 and let the system
586 // position you at ground level.
588 // Revision 1.23 1998/07/12 03:14:43 curt
589 // Added ground collision detection.
590 // Did some serious horsing around to be able to "hug" the ground properly
591 // and still be able to take off.
592 // Set the near clip plane to 1.0 meters when less than 10 meters above the
594 // Did some serious horsing around getting the initial airplane position to be
595 // correct based on rendered terrain elevation.
596 // Added a little cheat/hack that will prevent the view position from ever
597 // dropping below the terrain, even when the flight model doesn't quite
598 // put you as high as you'd like.
600 // Revision 1.22 1998/07/04 00:52:25 curt
601 // Add my own version of gluLookAt() (which is nearly identical to the
602 // Mesa/glu version.) But, by calculating the Model View matrix our selves
603 // we can save this matrix without having to read it back in from the video
604 // card. This hopefully allows us to save a few cpu cycles when rendering
605 // out the fragments because we can just use glLoadMatrixd() with the
606 // precalculated matrix for each tile rather than doing a push(), translate(),
607 // pop() for every fragment.
609 // Panel status defaults to off for now until it gets a bit more developed.
611 // Extract OpenGL driver info on initialization.
613 // Revision 1.21 1998/06/27 16:54:33 curt
614 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
615 // Don't change the view port when displaying the panel.
617 // Revision 1.20 1998/06/17 21:35:12 curt
618 // Refined conditional audio support compilation.
619 // Moved texture parameter setup calls to ../Scenery/materials.cxx
620 // #include <string.h> before various STL includes.
621 // Make HUD default state be enabled.
623 // Revision 1.19 1998/06/08 17:57:05 curt
624 // Minor sound/startup position tweaks.
626 // Revision 1.18 1998/06/03 00:47:14 curt
627 // Updated to compile in audio support if OSS available.
628 // Updated for new version of Steve's audio library.
629 // STL includes don't use .h
630 // Small view optimizations.
632 // Revision 1.17 1998/06/01 17:54:42 curt
633 // Added Linux audio support.
634 // avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
637 // Revision 1.16 1998/05/29 20:37:24 curt
638 // Tweaked material properties & lighting a bit in GLUTmain.cxx.
639 // Read airport list into a "map" STL for dynamic list sizing and fast tree
642 // Revision 1.15 1998/05/22 21:28:53 curt
643 // Modifications to use the new fgEVENT_MGR class.
645 // Revision 1.14 1998/05/20 20:51:35 curt
646 // Tweaked smooth shaded texture lighting properties.
647 // Converted fgLIGHT to a C++ class.
649 // Revision 1.13 1998/05/16 13:08:35 curt
650 // C++ - ified views.[ch]xx
651 // Shuffled some additional view parameters into the fgVIEW class.
652 // Changed tile-radius to tile-diameter because it is a much better
654 // Added a WORLD_TO_EYE transformation to views.cxx. This allows us
655 // to transform world space to eye space for view frustum culling.
657 // Revision 1.12 1998/05/13 18:29:58 curt
658 // Added a keyboard binding to dynamically adjust field of view.
659 // Added a command line option to specify fov.
660 // Adjusted terrain color.
661 // Root path info moved to fgOPTIONS.
662 // Added ability to parse options out of a config file.
664 // Revision 1.11 1998/05/07 23:14:15 curt
665 // Added "D" key binding to set autopilot heading.
666 // Made frame rate calculation average out over last 10 frames.
667 // Borland C++ floating point exception workaround.
668 // Added a --tile-radius=n option.
670 // Revision 1.10 1998/05/06 03:16:24 curt
671 // Added an averaged global frame rate counter.
672 // Added an option to control tile radius.
674 // Revision 1.9 1998/05/03 00:47:31 curt
675 // Added an option to enable/disable full-screen mode.
677 // Revision 1.8 1998/04/30 12:34:18 curt
678 // Added command line rendering options:
679 // enable/disable fog/haze
680 // specify smooth/flat shading
681 // disable sky blending and just use a solid color
682 // enable wireframe drawing mode
684 // Revision 1.7 1998/04/28 01:20:22 curt
685 // Type-ified fgTIME and fgVIEW.
686 // Added a command line option to disable textures.
688 // Revision 1.6 1998/04/26 05:10:03 curt
689 // "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
691 // Revision 1.5 1998/04/25 22:06:30 curt
692 // Edited cvs log messages in source files ... bad bad bad!
694 // Revision 1.4 1998/04/25 20:24:01 curt
695 // Cleaned up initialization sequence to eliminate interdependencies
696 // between sun position, lighting, and view position. This creates a
697 // valid single pass initialization path.
699 // Revision 1.3 1998/04/25 15:11:11 curt
700 // Added an command line option to set starting position based on airport ID.
702 // Revision 1.2 1998/04/24 00:49:20 curt
703 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
704 // Trying out some different option parsing code.
705 // Some code reorganization.
707 // Revision 1.1 1998/04/22 13:25:44 curt
708 // C++ - ifing the code.
709 // Starting a bit of reorganization of lighting code.
711 // Revision 1.56 1998/04/18 04:11:28 curt
712 // Moved fg_debug to it's own library, added zlib support.
714 // Revision 1.55 1998/04/14 02:21:03 curt
715 // Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
716 // <jgoeke@voyager.net>
718 // Revision 1.54 1998/04/08 23:35:36 curt
719 // Tweaks to Gnu automake/autoconf system.
721 // Revision 1.53 1998/04/03 22:09:06 curt
722 // Converting to Gnu autoconf system.
724 // Revision 1.52 1998/03/23 21:24:38 curt
725 // Source code formating tweaks.
727 // Revision 1.51 1998/03/14 00:31:22 curt
728 // Beginning initial terrain texturing experiments.
730 // Revision 1.50 1998/03/09 22:46:19 curt
733 // Revision 1.49 1998/02/23 19:07:59 curt
734 // Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
735 // calculation code between sun display, and other FG sections that use this
736 // for things like lighting.
738 // Revision 1.48 1998/02/21 14:53:15 curt
739 // Added Charlie's HUD changes.
741 // Revision 1.47 1998/02/19 13:05:53 curt
742 // Incorporated some HUD tweaks from Michelle America.
743 // Tweaked the sky's sunset/rise colors.
744 // Other misc. tweaks.
746 // Revision 1.46 1998/02/18 15:07:06 curt
747 // Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
748 // drivers will work.)
750 // Revision 1.45 1998/02/16 13:39:43 curt
751 // Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
752 // tiles to occasionally be missing.
754 // Revision 1.44 1998/02/12 21:59:50 curt
755 // Incorporated code changes contributed by Charlie Hotchkiss
756 // <chotchkiss@namg.us.anritsu.com>
758 // Revision 1.43 1998/02/11 02:50:40 curt
761 // Revision 1.42 1998/02/09 22:56:58 curt
762 // Removed "depend" files from cvs control. Other minor make tweaks.
764 // Revision 1.41 1998/02/09 15:07:50 curt
767 // Revision 1.40 1998/02/07 15:29:44 curt
768 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
769 // <chotchkiss@namg.us.anritsu.com>
771 // Revision 1.39 1998/02/03 23:20:25 curt
772 // Lots of little tweaks to fix various consistency problems discovered by
773 // Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
774 // passed arguments along to the real printf(). Also incorporated HUD changes
775 // by Michele America.
777 // Revision 1.38 1998/02/02 20:53:58 curt
778 // Incorporated Durk's changes.
780 // Revision 1.37 1998/02/01 03:39:54 curt
783 // Revision 1.36 1998/01/31 00:43:13 curt
784 // Added MetroWorks patches from Carmen Volpe.
786 // Revision 1.35 1998/01/27 00:47:57 curt
787 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
788 // system and commandline/config file processing code.
790 // Revision 1.34 1998/01/22 02:59:37 curt
791 // Changed #ifdef FILE_H to #ifdef _FILE_H
793 // Revision 1.33 1998/01/21 21:11:34 curt
796 // Revision 1.32 1998/01/19 19:27:08 curt
797 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
798 // This should simplify things tremendously.
800 // Revision 1.31 1998/01/19 18:40:32 curt
801 // Tons of little changes to clean up the code and to remove fatal errors
802 // when building with the c++ compiler.
804 // Revision 1.30 1998/01/13 00:23:09 curt
805 // Initial changes to support loading and management of scenery tiles. Note,
806 // there's still a fair amount of work left to be done.
808 // Revision 1.29 1998/01/08 02:22:08 curt
809 // Beginning to integrate Tile management subsystem.
811 // Revision 1.28 1998/01/07 03:18:58 curt
812 // Moved astronomical stuff from .../Src/Scenery to .../Src/Astro/
814 // Revision 1.27 1998/01/05 18:44:35 curt
815 // Add an option to advance/decrease time from keyboard.
817 // Revision 1.26 1997/12/30 23:09:04 curt
818 // Tweaking initialization sequences.
820 // Revision 1.25 1997/12/30 22:22:33 curt
821 // Further integration of event manager.
823 // Revision 1.24 1997/12/30 20:47:44 curt
824 // Integrated new event manager with subsystem initializations.
826 // Revision 1.23 1997/12/30 16:36:50 curt
827 // Merged in Durk's changes ...
829 // Revision 1.22 1997/12/19 23:34:05 curt
830 // Lot's of tweaking with sky rendering and lighting.
832 // Revision 1.21 1997/12/19 16:45:00 curt
833 // Working on scene rendering order and options.
835 // Revision 1.20 1997/12/18 23:32:33 curt
836 // First stab at sky dome actually starting to look reasonable. :-)
838 // Revision 1.19 1997/12/17 23:13:36 curt
839 // Began working on rendering a sky.
841 // Revision 1.18 1997/12/15 23:54:49 curt
842 // Add xgl wrappers for debugging.
843 // Generate terrain normals on the fly.
845 // Revision 1.17 1997/12/15 20:59:09 curt
848 // Revision 1.16 1997/12/12 19:52:48 curt
849 // Working on lightling and material properties.
851 // Revision 1.15 1997/12/11 04:43:55 curt
852 // Fixed sun vector and lighting problems. I thing the moon is now lit
855 // Revision 1.14 1997/12/10 22:37:47 curt
856 // Prepended "fg" on the name of all global structures that didn't have it yet.
857 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
859 // Revision 1.13 1997/11/25 19:25:32 curt
860 // Changes to integrate Durk's moon/sun code updates + clean up.
862 // Revision 1.12 1997/11/15 18:16:35 curt
865 // Revision 1.11 1997/10/30 12:38:42 curt
866 // Working on new scenery subsystem.
868 // Revision 1.10 1997/10/25 03:24:23 curt
869 // Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
871 // Revision 1.9 1997/09/23 00:29:39 curt
872 // Tweaks to get things to compile with gcc-win32.
874 // Revision 1.8 1997/09/22 14:44:20 curt
875 // Continuing to try to align stars correctly.
877 // Revision 1.7 1997/09/16 15:50:30 curt
878 // Working on star alignment and time issues.
880 // Revision 1.6 1997/09/05 14:17:30 curt
881 // More tweaking with stars.
883 // Revision 1.5 1997/09/04 02:17:36 curt
886 // Revision 1.4 1997/08/27 21:32:26 curt
887 // Restructured view calculation code. Added stars.
889 // Revision 1.3 1997/08/27 03:30:19 curt
890 // Changed naming scheme of basic shared structures.
892 // Revision 1.2 1997/08/25 20:27:23 curt
893 // Merged in initial HUD and Joystick code.
895 // Revision 1.1 1997/08/23 01:46:20 curt