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>
43 #include <Include/general.h>
45 #include <Aircraft/aircraft.hxx>
46 #include <Airports/simple.hxx>
47 #include <Astro/sky.hxx>
48 #include <Astro/stars.hxx>
49 #include <Astro/solarsystem.hxx>
50 #include <Autopilot/autopilot.hxx>
51 #include <Cockpit/cockpit.hxx>
52 // #include <Debug/fg_debug.h>
53 #include <Debug/logstream.hxx>
54 #include <Joystick/joystick.hxx>
55 #include <Math/fg_geodesy.hxx>
56 #include <Math/fg_random.h>
57 #include <Math/point3d.hxx>
58 #include <Math/polar3d.hxx>
59 #include <Scenery/scenery.hxx>
60 #include <Scenery/tilemgr.hxx>
61 #include <Time/event.hxx>
62 #include <Time/fg_time.hxx>
63 #include <Time/light.hxx>
64 #include <Time/sunpos.hxx>
65 #include <Weather/weather.hxx>
67 #include "fg_init.hxx"
68 #include "options.hxx"
72 extern const char *default_root;
75 // Set initial position and orientation
76 int fgInitPosition( void ) {
80 f = current_aircraft.fdm_state;
82 id = current_options.get_airport_id();
84 // set initial position from airport id
89 FG_LOG( FG_GENERAL, FG_INFO,
90 "Attempting to set starting position from airport code "
93 airports.load("apt_simple");
94 if ( ! airports.search( id, &a ) ) {
95 FG_LOG( FG_GENERAL, FG_ALERT,
96 "Failed to find " << id << " in database." );
99 f->set_Longitude( a.longitude * DEG_TO_RAD );
100 f->set_Latitude( a.latitude * DEG_TO_RAD );
103 // set initial position from default or command line coordinates
105 f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
106 f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
108 FG_LOG( FG_GENERAL, FG_INFO,
109 "starting altitude is = " << current_options.get_altitude() );
111 f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
112 f->set_Runway_altitude( f->get_Altitude() - 3.758099 );
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 )
161 Point3D geod_pos, abs_view_pos;
163 l = &cur_light_params;
164 t = &cur_time_params;
167 FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
168 FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
170 // seed the random number generater
173 // allocates structures so must happen before any of the flight
174 // model or control parameters are set
175 fgAircraftInit(); // In the future this might not be the case.
176 f = current_aircraft.fdm_state;
178 // set the initial position
181 // Initialize the Scenery Management subsystem
182 if ( fgSceneryInit() ) {
183 // Scenery initialized ok.
185 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Scenery initialization!" );
189 if( fgTileMgrInit() ) {
190 // Load the local scenery data
193 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
197 // Calculate ground elevation at starting point (we didn't have
198 // abs_view_pos calculated when fgTileMgrUpdate() was called above
200 // calculalate a cartesian point somewhere along the line between
201 // the center of the earth and our view position. Doesn't have to
202 // be the exact elevation (this is good because we don't know it
204 geod_pos = Point3D( f->get_Longitude(), f->get_Latitude(), 0.0);
205 abs_view_pos = fgGeodToCart(geod_pos);
207 FG_LOG( FG_GENERAL, FG_DEBUG,
208 "Altitude before update " << scenery.cur_elev );
210 fgTileMgrCurElevOLD( f->get_Longitude(),
213 FG_LOG( FG_GENERAL, FG_DEBUG,
214 "Altitude after update " << scenery.cur_elev );
215 f->set_Runway_altitude( scenery.cur_elev * METER_TO_FEET );
217 // Reset our altitude if we are below ground
218 if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
219 f->set_Altitude( f->get_Runway_altitude() + 3.758099 );
222 FG_LOG( FG_GENERAL, FG_INFO,
223 "Updated position (after elevation adj): ("
224 << (f->get_Latitude() * RAD_TO_DEG) << ", "
225 << (f->get_Longitude() * RAD_TO_DEG) << ", "
226 << (f->get_Altitude() * FEET_TO_METER) << ")" );
227 // end of thing that I just stuck in that I should probably move
229 // The following section sets up the flight model EOM parameters
230 // and should really be read in from one or more files.
233 f->set_Velocities_Local( 0.0, 0.0, 0.0 );
235 // Initial Orientation
236 f->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
237 current_options.get_pitch() * DEG_TO_RAD,
238 current_options.get_heading() * DEG_TO_RAD );
240 // Initial Angular Body rates
241 f->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
243 f->set_Earth_position_angle( 0.0 );
245 // Mass properties and geometry values
246 f->set_Inertias( 8.547270E+01,
247 1.048000E+03, 3.000000E+03, 3.530000E+03, 0.000000E+00 );
249 // CG position w.r.t. ref. point
250 f->set_CG_Position( 0.0, 0.0, 0.0 );
252 // Initialize the event manager
253 global_events.Init();
255 // Output event stats every 60 seconds
256 global_events.Register( "fgEVENT_MGR::PrintStats()",
257 fgMethodCallback<fgEVENT_MGR>( &global_events,
258 &fgEVENT_MGR::PrintStats),
259 fgEVENT::FG_EVENT_READY, 60000 );
261 // Initialize the time dependent variables
265 // Initialize view parameters
266 FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
268 FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
269 v->UpdateViewMath(f);
270 FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->abs_view_pos );
271 v->UpdateWorldToEye(f);
273 // Build the solar system
274 //fgSolarSystemInit(*t);
275 FG_LOG(FG_GENERAL, FG_INFO, "Building SolarSystem");
276 SolarSystem::theSolarSystem = new SolarSystem(t);
278 // Initialize the Stars subsystem
279 if( fgStarsInit() ) {
280 // Stars initialized ok.
282 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Stars initialization!" );
286 // Initialize the planetary subsystem
287 // global_events.Register( "fgPlanetsInit()", fgPlanetsInit,
288 // fgEVENT::FG_EVENT_READY, 600000);
290 // Initialize the sun's position
291 // global_events.Register( "fgSunInit()", fgSunInit,
292 // fgEVENT::FG_EVENT_READY, 30000 );
294 // Intialize the moon's position
295 // global_events.Register( "fgMoonInit()", fgMoonInit,
296 // fgEVENT::FG_EVENT_READY, 600000 );
298 // register the periodic update of Sun, moon, and planets
299 global_events.Register( "ssolsysUpdate", solarSystemRebuild,
300 fgEVENT::FG_EVENT_READY, 600000);
302 // fgUpdateSunPos() needs a few position and view parameters set
303 // so it can calculate local relative sun angle and a few other
304 // things for correctly orienting the sky.
306 global_events.Register( "fgUpdateSunPos()", fgUpdateSunPos,
307 fgEVENT::FG_EVENT_READY, 60000);
309 // Initialize Lighting interpolation tables
312 // update the lighting parameters (based on sun angle)
313 global_events.Register( "fgLight::Update()",
314 fgMethodCallback<fgLIGHT>( &cur_light_params,
316 fgEVENT::FG_EVENT_READY, 30000 );
318 // Initialize the weather modeling subsystem
319 current_weather.Init();
321 // Initialize the Cockpit subsystem
322 if( fgCockpitInit( ¤t_aircraft )) {
323 // Cockpit initialized ok.
325 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Cockpit initialization!" );
329 // Initialize the "sky"
332 // Initialize the flight model subsystem data structures base on
335 fgFlightModelInit( current_options.get_flight_model(), cur_fdm_state,
336 1.0 / DEFAULT_MODEL_HZ );
338 // I'm just sticking this here for now, it should probably move
340 scenery.cur_elev = f->get_Runway_altitude() * FEET_TO_METER;
342 if ( f->get_Altitude() < f->get_Runway_altitude() + 3.758099) {
343 f->set_Altitude( f->get_Runway_altitude() + 3.758099 );
346 FG_LOG( FG_GENERAL, FG_INFO,
347 "Updated position (after elevation adj): ("
348 << (f->get_Latitude() * RAD_TO_DEG) << ", "
349 << (f->get_Longitude() * RAD_TO_DEG) << ", "
350 << (f->get_Altitude() * FEET_TO_METER) << ")" );
351 // end of thing that I just stuck in that I should probably move
354 if ( fgJoystickInit() ) {
355 // Joystick initialized ok.
357 FG_LOG( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!" );
360 // Autopilot init added here, by Jeff Goeke-Smith
361 fgAPInit(¤t_aircraft);
363 // Initialize serial ports
366 FG_LOG( FG_GENERAL, FG_INFO, endl);
373 // Revision 1.56 1998/12/06 13:51:23 curt
374 // Turned "struct fgWEATHER" into "class FGWeather".
376 // Revision 1.55 1998/12/05 15:54:20 curt
377 // Renamed class fgFLIGHT to class FGState as per request by JSB.
379 // Revision 1.54 1998/12/05 14:19:53 curt
380 // Looking into a problem with cur_view_params.abs_view_pos initialization.
382 // Revision 1.53 1998/12/03 04:25:05 curt
383 // Working on fixing up new fgFLIGHT class.
385 // Revision 1.52 1998/12/03 01:17:17 curt
386 // Converted fgFLIGHT to a class.
388 // Revision 1.51 1998/11/20 01:02:37 curt
389 // Try to detect Mesa/Glide/Voodoo and chose the appropriate resolution.
391 // Revision 1.50 1998/11/16 14:00:01 curt
392 // Added pow() macro bug work around.
393 // Added support for starting FGFS at various resolutions.
394 // Added some initial serial port support.
395 // Specify default log levels in main().
397 // Revision 1.49 1998/11/11 00:24:02 curt
398 // Added Michael Johnson's audio patches for testing.
399 // Also did a few tweaks to avoid numerical problems when starting at a place
400 // with no (or bogus) scenery.
402 // Revision 1.48 1998/11/07 19:07:10 curt
403 // Enable release builds using the --without-logging option to the configure
404 // script. Also a couple log message cleanups, plus some C to C++ comment
407 // Revision 1.47 1998/11/06 21:18:10 curt
408 // Converted to new logstream debugging facility. This allows release
409 // builds with no messages at all (and no performance impact) by using
410 // the -DFG_NDEBUG flag.
412 // Revision 1.46 1998/10/27 02:14:38 curt
413 // Changes to support GLUT joystick routines as fall back.
415 // Revision 1.45 1998/10/25 10:57:21 curt
416 // Changes to use the new joystick library if it is available.
418 // Revision 1.44 1998/10/18 01:17:17 curt
421 // Revision 1.43 1998/10/17 01:34:22 curt
424 // Revision 1.42 1998/10/16 23:27:54 curt
427 // Revision 1.41 1998/10/16 00:54:01 curt
428 // Converted to Point3D class.
430 // Revision 1.40 1998/10/02 12:46:49 curt
431 // Added an "auto throttle"
433 // Revision 1.39 1998/09/29 02:03:39 curt
436 // Revision 1.38 1998/09/15 04:27:30 curt
437 // Changes for new Astro code.
439 // Revision 1.37 1998/09/15 02:09:26 curt
440 // Include/fg_callback.hxx
441 // Moved code inline to stop g++ 2.7 from complaining.
443 // Simulator/Time/event.[ch]xx
444 // Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
445 // complain bitterly.
447 // Minor bugfix and changes.
449 // Simulator/Main/GLUTmain.cxx
450 // Added missing type to idle_state definition - eliminates a warning.
452 // Simulator/Main/fg_init.cxx
453 // Changes to airport lookup.
455 // Simulator/Main/options.cxx
456 // Uses fg_gzifstream when loading config file.
458 // Revision 1.36 1998/09/08 21:40:08 curt
459 // Fixes by Charlie Hotchkiss.
461 // Revision 1.35 1998/08/29 13:09:26 curt
462 // Changes to event manager from Bernie Bright.
464 // Revision 1.34 1998/08/27 17:02:06 curt
465 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
466 // - use strings for fg_root and airport_id and added methods to return
468 // - inlined all access methods,
469 // - made the parsing functions private methods,
470 // - deleted some unused functions.
471 // - propogated some of these changes out a bit further.
473 // Revision 1.33 1998/08/25 20:53:32 curt
474 // Shuffled $FG_ROOT file layout.
476 // Revision 1.32 1998/08/25 16:59:09 curt
477 // Directory reshuffling.
479 // Revision 1.31 1998/08/22 14:49:57 curt
480 // Attempting to iron out seg faults and crashes.
481 // Did some shuffling to fix a initialization order problem between view
482 // position, scenery elevation.
484 // Revision 1.30 1998/08/20 20:32:33 curt
485 // Reshuffled some of the code in and around views.[ch]xx
487 // Revision 1.29 1998/07/30 23:48:27 curt
488 // Output position & orientation when pausing.
489 // Eliminated libtool use.
490 // Added options to specify initial position and orientation.
491 // Changed default fov to 55 degrees.
492 // Added command line option to start in paused or unpaused state.
494 // Revision 1.28 1998/07/27 18:41:25 curt
495 // Added a pause command "p"
496 // Fixed some initialization order problems between pui and glut.
497 // Added an --enable/disable-sound option.
499 // Revision 1.27 1998/07/24 21:39:10 curt
500 // Debugging output tweaks.
501 // Cast glGetString to (char *) to avoid compiler errors.
502 // Optimizations to fgGluLookAt() by Norman Vine.
504 // Revision 1.26 1998/07/22 21:40:44 curt
505 // Clear to adjusted fog color (for sunrise/sunset effects)
506 // Make call to fog sunrise/sunset adjustment method.
507 // Add a stdc++ library bug work around to fg_init.cxx
509 // Revision 1.25 1998/07/13 21:01:38 curt
510 // Wrote access functions for current fgOPTIONS.
512 // Revision 1.24 1998/07/13 15:32:39 curt
513 // Clear color buffer if drawing wireframe.
514 // When specifying and airport, start elevation at -1000 and let the system
515 // position you at ground level.
517 // Revision 1.23 1998/07/12 03:14:43 curt
518 // Added ground collision detection.
519 // Did some serious horsing around to be able to "hug" the ground properly
520 // and still be able to take off.
521 // Set the near clip plane to 1.0 meters when less than 10 meters above the
523 // Did some serious horsing around getting the initial airplane position to be
524 // correct based on rendered terrain elevation.
525 // Added a little cheat/hack that will prevent the view position from ever
526 // dropping below the terrain, even when the flight model doesn't quite
527 // put you as high as you'd like.
529 // Revision 1.22 1998/07/04 00:52:25 curt
530 // Add my own version of gluLookAt() (which is nearly identical to the
531 // Mesa/glu version.) But, by calculating the Model View matrix our selves
532 // we can save this matrix without having to read it back in from the video
533 // card. This hopefully allows us to save a few cpu cycles when rendering
534 // out the fragments because we can just use glLoadMatrixd() with the
535 // precalculated matrix for each tile rather than doing a push(), translate(),
536 // pop() for every fragment.
538 // Panel status defaults to off for now until it gets a bit more developed.
540 // Extract OpenGL driver info on initialization.
542 // Revision 1.21 1998/06/27 16:54:33 curt
543 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
544 // Don't change the view port when displaying the panel.
546 // Revision 1.20 1998/06/17 21:35:12 curt
547 // Refined conditional audio support compilation.
548 // Moved texture parameter setup calls to ../Scenery/materials.cxx
549 // #include <string.h> before various STL includes.
550 // Make HUD default state be enabled.
552 // Revision 1.19 1998/06/08 17:57:05 curt
553 // Minor sound/startup position tweaks.
555 // Revision 1.18 1998/06/03 00:47:14 curt
556 // Updated to compile in audio support if OSS available.
557 // Updated for new version of Steve's audio library.
558 // STL includes don't use .h
559 // Small view optimizations.
561 // Revision 1.17 1998/06/01 17:54:42 curt
562 // Added Linux audio support.
563 // avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
566 // Revision 1.16 1998/05/29 20:37:24 curt
567 // Tweaked material properties & lighting a bit in GLUTmain.cxx.
568 // Read airport list into a "map" STL for dynamic list sizing and fast tree
571 // Revision 1.15 1998/05/22 21:28:53 curt
572 // Modifications to use the new fgEVENT_MGR class.
574 // Revision 1.14 1998/05/20 20:51:35 curt
575 // Tweaked smooth shaded texture lighting properties.
576 // Converted fgLIGHT to a C++ class.
578 // Revision 1.13 1998/05/16 13:08:35 curt
579 // C++ - ified views.[ch]xx
580 // Shuffled some additional view parameters into the fgVIEW class.
581 // Changed tile-radius to tile-diameter because it is a much better
583 // Added a WORLD_TO_EYE transformation to views.cxx. This allows us
584 // to transform world space to eye space for view frustum culling.
586 // Revision 1.12 1998/05/13 18:29:58 curt
587 // Added a keyboard binding to dynamically adjust field of view.
588 // Added a command line option to specify fov.
589 // Adjusted terrain color.
590 // Root path info moved to fgOPTIONS.
591 // Added ability to parse options out of a config file.
593 // Revision 1.11 1998/05/07 23:14:15 curt
594 // Added "D" key binding to set autopilot heading.
595 // Made frame rate calculation average out over last 10 frames.
596 // Borland C++ floating point exception workaround.
597 // Added a --tile-radius=n option.
599 // Revision 1.10 1998/05/06 03:16:24 curt
600 // Added an averaged global frame rate counter.
601 // Added an option to control tile radius.
603 // Revision 1.9 1998/05/03 00:47:31 curt
604 // Added an option to enable/disable full-screen mode.
606 // Revision 1.8 1998/04/30 12:34:18 curt
607 // Added command line rendering options:
608 // enable/disable fog/haze
609 // specify smooth/flat shading
610 // disable sky blending and just use a solid color
611 // enable wireframe drawing mode
613 // Revision 1.7 1998/04/28 01:20:22 curt
614 // Type-ified fgTIME and fgVIEW.
615 // Added a command line option to disable textures.
617 // Revision 1.6 1998/04/26 05:10:03 curt
618 // "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
620 // Revision 1.5 1998/04/25 22:06:30 curt
621 // Edited cvs log messages in source files ... bad bad bad!
623 // Revision 1.4 1998/04/25 20:24:01 curt
624 // Cleaned up initialization sequence to eliminate interdependencies
625 // between sun position, lighting, and view position. This creates a
626 // valid single pass initialization path.
628 // Revision 1.3 1998/04/25 15:11:11 curt
629 // Added an command line option to set starting position based on airport ID.
631 // Revision 1.2 1998/04/24 00:49:20 curt
632 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
633 // Trying out some different option parsing code.
634 // Some code reorganization.
636 // Revision 1.1 1998/04/22 13:25:44 curt
637 // C++ - ifing the code.
638 // Starting a bit of reorganization of lighting code.
640 // Revision 1.56 1998/04/18 04:11:28 curt
641 // Moved fg_debug to it's own library, added zlib support.
643 // Revision 1.55 1998/04/14 02:21:03 curt
644 // Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
645 // <jgoeke@voyager.net>
647 // Revision 1.54 1998/04/08 23:35:36 curt
648 // Tweaks to Gnu automake/autoconf system.
650 // Revision 1.53 1998/04/03 22:09:06 curt
651 // Converting to Gnu autoconf system.
653 // Revision 1.52 1998/03/23 21:24:38 curt
654 // Source code formating tweaks.
656 // Revision 1.51 1998/03/14 00:31:22 curt
657 // Beginning initial terrain texturing experiments.
659 // Revision 1.50 1998/03/09 22:46:19 curt
662 // Revision 1.49 1998/02/23 19:07:59 curt
663 // Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
664 // calculation code between sun display, and other FG sections that use this
665 // for things like lighting.
667 // Revision 1.48 1998/02/21 14:53:15 curt
668 // Added Charlie's HUD changes.
670 // Revision 1.47 1998/02/19 13:05:53 curt
671 // Incorporated some HUD tweaks from Michelle America.
672 // Tweaked the sky's sunset/rise colors.
673 // Other misc. tweaks.
675 // Revision 1.46 1998/02/18 15:07:06 curt
676 // Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
677 // drivers will work.)
679 // Revision 1.45 1998/02/16 13:39:43 curt
680 // Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
681 // tiles to occasionally be missing.
683 // Revision 1.44 1998/02/12 21:59:50 curt
684 // Incorporated code changes contributed by Charlie Hotchkiss
685 // <chotchkiss@namg.us.anritsu.com>
687 // Revision 1.43 1998/02/11 02:50:40 curt
690 // Revision 1.42 1998/02/09 22:56:58 curt
691 // Removed "depend" files from cvs control. Other minor make tweaks.
693 // Revision 1.41 1998/02/09 15:07:50 curt
696 // Revision 1.40 1998/02/07 15:29:44 curt
697 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
698 // <chotchkiss@namg.us.anritsu.com>
700 // Revision 1.39 1998/02/03 23:20:25 curt
701 // Lots of little tweaks to fix various consistency problems discovered by
702 // Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
703 // passed arguments along to the real printf(). Also incorporated HUD changes
704 // by Michele America.
706 // Revision 1.38 1998/02/02 20:53:58 curt
707 // Incorporated Durk's changes.
709 // Revision 1.37 1998/02/01 03:39:54 curt
712 // Revision 1.36 1998/01/31 00:43:13 curt
713 // Added MetroWorks patches from Carmen Volpe.
715 // Revision 1.35 1998/01/27 00:47:57 curt
716 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
717 // system and commandline/config file processing code.
719 // Revision 1.34 1998/01/22 02:59:37 curt
720 // Changed #ifdef FILE_H to #ifdef _FILE_H
722 // Revision 1.33 1998/01/21 21:11:34 curt
725 // Revision 1.32 1998/01/19 19:27:08 curt
726 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
727 // This should simplify things tremendously.
729 // Revision 1.31 1998/01/19 18:40:32 curt
730 // Tons of little changes to clean up the code and to remove fatal errors
731 // when building with the c++ compiler.
733 // Revision 1.30 1998/01/13 00:23:09 curt
734 // Initial changes to support loading and management of scenery tiles. Note,
735 // there's still a fair amount of work left to be done.
737 // Revision 1.29 1998/01/08 02:22:08 curt
738 // Beginning to integrate Tile management subsystem.
740 // Revision 1.28 1998/01/07 03:18:58 curt
741 // Moved astronomical stuff from .../Src/Scenery to .../Src/Astro/
743 // Revision 1.27 1998/01/05 18:44:35 curt
744 // Add an option to advance/decrease time from keyboard.
746 // Revision 1.26 1997/12/30 23:09:04 curt
747 // Tweaking initialization sequences.
749 // Revision 1.25 1997/12/30 22:22:33 curt
750 // Further integration of event manager.
752 // Revision 1.24 1997/12/30 20:47:44 curt
753 // Integrated new event manager with subsystem initializations.
755 // Revision 1.23 1997/12/30 16:36:50 curt
756 // Merged in Durk's changes ...
758 // Revision 1.22 1997/12/19 23:34:05 curt
759 // Lot's of tweaking with sky rendering and lighting.
761 // Revision 1.21 1997/12/19 16:45:00 curt
762 // Working on scene rendering order and options.
764 // Revision 1.20 1997/12/18 23:32:33 curt
765 // First stab at sky dome actually starting to look reasonable. :-)
767 // Revision 1.19 1997/12/17 23:13:36 curt
768 // Began working on rendering a sky.
770 // Revision 1.18 1997/12/15 23:54:49 curt
771 // Add xgl wrappers for debugging.
772 // Generate terrain normals on the fly.
774 // Revision 1.17 1997/12/15 20:59:09 curt
777 // Revision 1.16 1997/12/12 19:52:48 curt
778 // Working on lightling and material properties.
780 // Revision 1.15 1997/12/11 04:43:55 curt
781 // Fixed sun vector and lighting problems. I thing the moon is now lit
784 // Revision 1.14 1997/12/10 22:37:47 curt
785 // Prepended "fg" on the name of all global structures that didn't have it yet.
786 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
788 // Revision 1.13 1997/11/25 19:25:32 curt
789 // Changes to integrate Durk's moon/sun code updates + clean up.
791 // Revision 1.12 1997/11/15 18:16:35 curt
794 // Revision 1.11 1997/10/30 12:38:42 curt
795 // Working on new scenery subsystem.
797 // Revision 1.10 1997/10/25 03:24:23 curt
798 // Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
800 // Revision 1.9 1997/09/23 00:29:39 curt
801 // Tweaks to get things to compile with gcc-win32.
803 // Revision 1.8 1997/09/22 14:44:20 curt
804 // Continuing to try to align stars correctly.
806 // Revision 1.7 1997/09/16 15:50:30 curt
807 // Working on star alignment and time issues.
809 // Revision 1.6 1997/09/05 14:17:30 curt
810 // More tweaking with stars.
812 // Revision 1.5 1997/09/04 02:17:36 curt
815 // Revision 1.4 1997/08/27 21:32:26 curt
816 // Restructured view calculation code. Added stars.
818 // Revision 1.3 1997/08/27 03:30:19 curt
819 // Changed naming scheme of basic shared structures.
821 // Revision 1.2 1997/08/25 20:27:23 curt
822 // Merged in initial HUD and Joystick code.
824 // Revision 1.1 1997/08/23 01:46:20 curt