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.h>
46 #include <Airports/simple.hxx>
47 #include <Astro/moon.hxx>
48 #include <Astro/planets.hxx>
49 #include <Astro/sky.hxx>
50 #include <Astro/stars.hxx>
51 #include <Astro/sun.hxx>
52 #include <Autopilot/autopilot.h>
53 #include <Cockpit/cockpit.hxx>
54 #include <Debug/fg_debug.h>
55 #include <Joystick/joystick.h>
56 #include <Math/fg_geodesy.h>
57 #include <Math/fg_random.h>
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.h>
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.flight;
82 id = current_options.get_airport_id();
84 // set initial position from airport id
89 fgPrintf( FG_GENERAL, FG_INFO,
90 "Attempting to set starting position from airport code %s.\n",
93 airports.load("apt_simple");
94 if ( ! airports.search( id, &a ) ) {
95 fgPrintf( FG_GENERAL, FG_EXIT,
96 "Failed to find %s in database.\n", id.c_str() );
98 FG_Longitude = a.longitude * DEG_TO_RAD;
99 FG_Latitude = a.latitude * DEG_TO_RAD;
102 // set initial position from default or command line coordinates
104 FG_Longitude = current_options.get_lon() * DEG_TO_RAD;
105 FG_Latitude = current_options.get_lat() * DEG_TO_RAD;
107 printf("starting altitude is = %.2f\n", current_options.get_altitude());
109 FG_Altitude = current_options.get_altitude() * METER_TO_FEET;
110 FG_Runway_altitude = FG_Altitude - 3.758099;
112 fgPrintf( FG_GENERAL, FG_INFO,
113 "Initial position is: (%.4f, %.4f, %.2f)\n",
114 FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
115 FG_Altitude * FEET_TO_METER);
121 // General house keeping initializations
122 int fgInitGeneral( void ) {
129 fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" );
130 fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" );
132 g->glVendor = (char *)glGetString ( GL_VENDOR );
133 g->glRenderer = (char *)glGetString ( GL_RENDERER );
134 g->glVersion = (char *)glGetString ( GL_VERSION );
136 root = current_options.get_fg_root();
137 if ( ! root.length() ) {
138 // No root path set? Then bail ...
139 fgPrintf( FG_GENERAL, FG_EXIT, "%s %s\n",
140 "Cannot continue without environment variable FG_ROOT",
143 fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", root.c_str() );
145 // prime the frame rate counter pump
146 for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
154 // convert a geodetic point lon(radians), lat(radians), elev(meter) to
156 fgPoint3d geod_to_cart(double geod[3]) {
159 double gc_lon, gc_lat, sl_radius;
161 // printf("A geodetic point is (%.2f, %.2f, %.2f)\n",
162 // geod[0], geod[1], geod[2]);
165 fgGeodToGeoc(geod[1], geod[2], &sl_radius, &gc_lat);
167 // printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon,
168 // gc_lat, sl_radius+geod[2]);
172 pp.radius = sl_radius + geod[2];
173 cp = fgPolarToCart3d(pp);
175 // printf("A cart point is (%.8f, %.8f, %.8f)\n", cp.x, cp.y, cp.z);
181 // This is the top level init routine which calls all the other
182 // initialization routines. If you are adding a subsystem to flight
183 // gear, its initialization call should located in this routine.
184 // Returns non-zero if a problem encountered.
185 int fgInitSubsystems( void )
192 fgPoint3d abs_view_pos;
194 l = &cur_light_params;
195 t = &cur_time_params;
198 fgPrintf( FG_GENERAL, FG_INFO, "Initialize Subsystems\n");
199 fgPrintf( FG_GENERAL, FG_INFO, "========== ==========\n");
201 // seed the random number generater
204 // allocates structures so must happen before any of the flight
205 // model or control parameters are set
206 fgAircraftInit(); // In the future this might not be the case.
207 f = current_aircraft.flight;
209 // set the initial position
212 // Initialize the Scenery Management subsystem
213 if ( fgSceneryInit() ) {
214 // Scenery initialized ok.
216 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Scenery initialization!\n" );
219 if( fgTileMgrInit() ) {
220 // Load the local scenery data
223 fgPrintf( FG_GENERAL, FG_EXIT,
224 "Error in Tile Manager initialization!\n" );
227 // calculalate a cartesian point somewhere along the line between
228 // the center of the earth and our view position
229 geod_pos[0] = FG_Longitude;
230 geod_pos[1] = FG_Latitude;
231 // doesn't have to be the exact elevation (this is good because we
232 // don't know it yet :-)
234 abs_view_pos = geod_to_cart(geod_pos);
236 // Calculate ground elevation at starting point
238 fgTileMgrCurElev( FG_Longitude, FG_Latitude, &abs_view_pos );
239 FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET;
241 // Reset our altitude if we are below ground
242 if ( FG_Altitude < FG_Runway_altitude + 3.758099) {
243 FG_Altitude = FG_Runway_altitude + 3.758099;
246 fgPrintf( FG_GENERAL, FG_INFO,
247 "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
248 FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
249 FG_Altitude * FEET_TO_METER);
250 // end of thing that I just stuck in that I should probably move
252 // The following section sets up the flight model EOM parameters
253 // and should really be read in from one or more files.
256 FG_V_north = 0.0; // 7.287719E+00
257 FG_V_east = 0.0; // 1.521770E+03
258 FG_V_down = 0.0; // -1.265722E-05
260 // Initial Orientation
261 FG_Phi = current_options.get_roll() * DEG_TO_RAD;
262 FG_Theta = current_options.get_pitch() * DEG_TO_RAD;
263 FG_Psi = current_options.get_heading() * DEG_TO_RAD;
265 // Initial Angular B rates
266 FG_P_body = 7.206685E-05;
267 FG_Q_body = 0.000000E+00;
268 FG_R_body = 9.492658E-05;
270 FG_Earth_position_angle = 0.000000E+00;
272 // Mass properties and geometry values
273 FG_Mass = 8.547270E+01;
274 FG_I_xx = 1.048000E+03;
275 FG_I_yy = 3.000000E+03;
276 FG_I_zz = 3.530000E+03;
277 FG_I_xz = 0.000000E+00;
279 // CG position w.r.t. ref. point
280 FG_Dx_cg = 0.000000E+00;
281 FG_Dy_cg = 0.000000E+00;
282 FG_Dz_cg = 0.000000E+00;
284 // Initialize the event manager
285 global_events.Init();
287 // Output event stats every 60 seconds
288 global_events.Register( "fgEVENT_MGR::PrintStats()",
289 fgMethodCallback<fgEVENT_MGR>( &global_events,
290 &fgEVENT_MGR::PrintStats),
291 fgEVENT::FG_EVENT_READY, 60000 );
293 // Initialize the time dependent variables
297 // Initialize view parameters
299 v->UpdateViewMath(f);
300 v->UpdateWorldToEye(f);
302 // Initialize the orbital elements of sun, moon and mayor planets
303 fgSolarSystemInit(*t);
305 // Initialize the Stars subsystem
306 if( fgStarsInit() ) {
307 // Stars initialized ok.
309 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Stars initialization!\n" );
312 // Initialize the planetary subsystem
313 global_events.Register( "fgPlanetsInit()", fgPlanetsInit,
314 fgEVENT::FG_EVENT_READY, 600000);
316 // Initialize the sun's position
317 global_events.Register( "fgSunInit()", fgSunInit,
318 fgEVENT::FG_EVENT_READY, 30000 );
320 // Intialize the moon's position
321 global_events.Register( "fgMoonInit()", fgMoonInit,
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.
329 // Initialize Lighting interpolation tables
332 // update the lighting parameters (based on sun angle)
333 global_events.Register( "fgLight::Update()",
334 fgMethodCallback<fgLIGHT>( &cur_light_params,
336 fgEVENT::FG_EVENT_READY, 30000 );
338 // Initialize the weather modeling subsystem
341 // update the weather for our current position
342 global_events.Register( "fgWeatherUpdate()", fgWeatherUpdate,
343 fgEVENT::FG_EVENT_READY, 120000 );
345 // Initialize the Cockpit subsystem
346 if( fgCockpitInit( ¤t_aircraft )) {
347 // Cockpit initialized ok.
349 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Cockpit initialization!\n" );
352 // Initialize the "sky"
355 // Initialize the flight model subsystem data structures base on
358 fgFlightModelInit( current_options.get_flight_model(), f,
359 1.0 / DEFAULT_MODEL_HZ );
361 // I'm just sticking this here for now, it should probably move
363 scenery.cur_elev = FG_Runway_altitude * FEET_TO_METER;
365 if ( FG_Altitude < FG_Runway_altitude + 3.758099) {
366 FG_Altitude = FG_Runway_altitude + 3.758099;
369 fgPrintf( FG_GENERAL, FG_INFO,
370 "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
371 FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
372 FG_Altitude * FEET_TO_METER);
373 // end of thing that I just stuck in that I should probably move
376 if (fgJoystickInit(0) ) {
377 // Joystick initialized ok.
379 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Joystick initialization!\n" );
382 // Autopilot init added here, by Jeff Goeke-Smith
383 fgAPInit(¤t_aircraft);
385 fgPrintf(FG_GENERAL, FG_INFO,"\n");
392 // Revision 1.37 1998/09/15 02:09:26 curt
393 // Include/fg_callback.hxx
394 // Moved code inline to stop g++ 2.7 from complaining.
396 // Simulator/Time/event.[ch]xx
397 // Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
398 // complain bitterly.
400 // Minor bugfix and changes.
402 // Simulator/Main/GLUTmain.cxx
403 // Added missing type to idle_state definition - eliminates a warning.
405 // Simulator/Main/fg_init.cxx
406 // Changes to airport lookup.
408 // Simulator/Main/options.cxx
409 // Uses fg_gzifstream when loading config file.
411 // Revision 1.36 1998/09/08 21:40:08 curt
412 // Fixes by Charlie Hotchkiss.
414 // Revision 1.35 1998/08/29 13:09:26 curt
415 // Changes to event manager from Bernie Bright.
417 // Revision 1.34 1998/08/27 17:02:06 curt
418 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
419 // - use strings for fg_root and airport_id and added methods to return
421 // - inlined all access methods,
422 // - made the parsing functions private methods,
423 // - deleted some unused functions.
424 // - propogated some of these changes out a bit further.
426 // Revision 1.33 1998/08/25 20:53:32 curt
427 // Shuffled $FG_ROOT file layout.
429 // Revision 1.32 1998/08/25 16:59:09 curt
430 // Directory reshuffling.
432 // Revision 1.31 1998/08/22 14:49:57 curt
433 // Attempting to iron out seg faults and crashes.
434 // Did some shuffling to fix a initialization order problem between view
435 // position, scenery elevation.
437 // Revision 1.30 1998/08/20 20:32:33 curt
438 // Reshuffled some of the code in and around views.[ch]xx
440 // Revision 1.29 1998/07/30 23:48:27 curt
441 // Output position & orientation when pausing.
442 // Eliminated libtool use.
443 // Added options to specify initial position and orientation.
444 // Changed default fov to 55 degrees.
445 // Added command line option to start in paused or unpaused state.
447 // Revision 1.28 1998/07/27 18:41:25 curt
448 // Added a pause command "p"
449 // Fixed some initialization order problems between pui and glut.
450 // Added an --enable/disable-sound option.
452 // Revision 1.27 1998/07/24 21:39:10 curt
453 // Debugging output tweaks.
454 // Cast glGetString to (char *) to avoid compiler errors.
455 // Optimizations to fgGluLookAt() by Norman Vine.
457 // Revision 1.26 1998/07/22 21:40:44 curt
458 // Clear to adjusted fog color (for sunrise/sunset effects)
459 // Make call to fog sunrise/sunset adjustment method.
460 // Add a stdc++ library bug work around to fg_init.cxx
462 // Revision 1.25 1998/07/13 21:01:38 curt
463 // Wrote access functions for current fgOPTIONS.
465 // Revision 1.24 1998/07/13 15:32:39 curt
466 // Clear color buffer if drawing wireframe.
467 // When specifying and airport, start elevation at -1000 and let the system
468 // position you at ground level.
470 // Revision 1.23 1998/07/12 03:14:43 curt
471 // Added ground collision detection.
472 // Did some serious horsing around to be able to "hug" the ground properly
473 // and still be able to take off.
474 // Set the near clip plane to 1.0 meters when less than 10 meters above the
476 // Did some serious horsing around getting the initial airplane position to be
477 // correct based on rendered terrain elevation.
478 // Added a little cheat/hack that will prevent the view position from ever
479 // dropping below the terrain, even when the flight model doesn't quite
480 // put you as high as you'd like.
482 // Revision 1.22 1998/07/04 00:52:25 curt
483 // Add my own version of gluLookAt() (which is nearly identical to the
484 // Mesa/glu version.) But, by calculating the Model View matrix our selves
485 // we can save this matrix without having to read it back in from the video
486 // card. This hopefully allows us to save a few cpu cycles when rendering
487 // out the fragments because we can just use glLoadMatrixd() with the
488 // precalculated matrix for each tile rather than doing a push(), translate(),
489 // pop() for every fragment.
491 // Panel status defaults to off for now until it gets a bit more developed.
493 // Extract OpenGL driver info on initialization.
495 // Revision 1.21 1998/06/27 16:54:33 curt
496 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
497 // Don't change the view port when displaying the panel.
499 // Revision 1.20 1998/06/17 21:35:12 curt
500 // Refined conditional audio support compilation.
501 // Moved texture parameter setup calls to ../Scenery/materials.cxx
502 // #include <string.h> before various STL includes.
503 // Make HUD default state be enabled.
505 // Revision 1.19 1998/06/08 17:57:05 curt
506 // Minor sound/startup position tweaks.
508 // Revision 1.18 1998/06/03 00:47:14 curt
509 // Updated to compile in audio support if OSS available.
510 // Updated for new version of Steve's audio library.
511 // STL includes don't use .h
512 // Small view optimizations.
514 // Revision 1.17 1998/06/01 17:54:42 curt
515 // Added Linux audio support.
516 // avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
519 // Revision 1.16 1998/05/29 20:37:24 curt
520 // Tweaked material properties & lighting a bit in GLUTmain.cxx.
521 // Read airport list into a "map" STL for dynamic list sizing and fast tree
524 // Revision 1.15 1998/05/22 21:28:53 curt
525 // Modifications to use the new fgEVENT_MGR class.
527 // Revision 1.14 1998/05/20 20:51:35 curt
528 // Tweaked smooth shaded texture lighting properties.
529 // Converted fgLIGHT to a C++ class.
531 // Revision 1.13 1998/05/16 13:08:35 curt
532 // C++ - ified views.[ch]xx
533 // Shuffled some additional view parameters into the fgVIEW class.
534 // Changed tile-radius to tile-diameter because it is a much better
536 // Added a WORLD_TO_EYE transformation to views.cxx. This allows us
537 // to transform world space to eye space for view frustum culling.
539 // Revision 1.12 1998/05/13 18:29:58 curt
540 // Added a keyboard binding to dynamically adjust field of view.
541 // Added a command line option to specify fov.
542 // Adjusted terrain color.
543 // Root path info moved to fgOPTIONS.
544 // Added ability to parse options out of a config file.
546 // Revision 1.11 1998/05/07 23:14:15 curt
547 // Added "D" key binding to set autopilot heading.
548 // Made frame rate calculation average out over last 10 frames.
549 // Borland C++ floating point exception workaround.
550 // Added a --tile-radius=n option.
552 // Revision 1.10 1998/05/06 03:16:24 curt
553 // Added an averaged global frame rate counter.
554 // Added an option to control tile radius.
556 // Revision 1.9 1998/05/03 00:47:31 curt
557 // Added an option to enable/disable full-screen mode.
559 // Revision 1.8 1998/04/30 12:34:18 curt
560 // Added command line rendering options:
561 // enable/disable fog/haze
562 // specify smooth/flat shading
563 // disable sky blending and just use a solid color
564 // enable wireframe drawing mode
566 // Revision 1.7 1998/04/28 01:20:22 curt
567 // Type-ified fgTIME and fgVIEW.
568 // Added a command line option to disable textures.
570 // Revision 1.6 1998/04/26 05:10:03 curt
571 // "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
573 // Revision 1.5 1998/04/25 22:06:30 curt
574 // Edited cvs log messages in source files ... bad bad bad!
576 // Revision 1.4 1998/04/25 20:24:01 curt
577 // Cleaned up initialization sequence to eliminate interdependencies
578 // between sun position, lighting, and view position. This creates a
579 // valid single pass initialization path.
581 // Revision 1.3 1998/04/25 15:11:11 curt
582 // Added an command line option to set starting position based on airport ID.
584 // Revision 1.2 1998/04/24 00:49:20 curt
585 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
586 // Trying out some different option parsing code.
587 // Some code reorganization.
589 // Revision 1.1 1998/04/22 13:25:44 curt
590 // C++ - ifing the code.
591 // Starting a bit of reorganization of lighting code.
593 // Revision 1.56 1998/04/18 04:11:28 curt
594 // Moved fg_debug to it's own library, added zlib support.
596 // Revision 1.55 1998/04/14 02:21:03 curt
597 // Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
598 // <jgoeke@voyager.net>
600 // Revision 1.54 1998/04/08 23:35:36 curt
601 // Tweaks to Gnu automake/autoconf system.
603 // Revision 1.53 1998/04/03 22:09:06 curt
604 // Converting to Gnu autoconf system.
606 // Revision 1.52 1998/03/23 21:24:38 curt
607 // Source code formating tweaks.
609 // Revision 1.51 1998/03/14 00:31:22 curt
610 // Beginning initial terrain texturing experiments.
612 // Revision 1.50 1998/03/09 22:46:19 curt
615 // Revision 1.49 1998/02/23 19:07:59 curt
616 // Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
617 // calculation code between sun display, and other FG sections that use this
618 // for things like lighting.
620 // Revision 1.48 1998/02/21 14:53:15 curt
621 // Added Charlie's HUD changes.
623 // Revision 1.47 1998/02/19 13:05:53 curt
624 // Incorporated some HUD tweaks from Michelle America.
625 // Tweaked the sky's sunset/rise colors.
626 // Other misc. tweaks.
628 // Revision 1.46 1998/02/18 15:07:06 curt
629 // Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
630 // drivers will work.)
632 // Revision 1.45 1998/02/16 13:39:43 curt
633 // Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
634 // tiles to occasionally be missing.
636 // Revision 1.44 1998/02/12 21:59:50 curt
637 // Incorporated code changes contributed by Charlie Hotchkiss
638 // <chotchkiss@namg.us.anritsu.com>
640 // Revision 1.43 1998/02/11 02:50:40 curt
643 // Revision 1.42 1998/02/09 22:56:58 curt
644 // Removed "depend" files from cvs control. Other minor make tweaks.
646 // Revision 1.41 1998/02/09 15:07:50 curt
649 // Revision 1.40 1998/02/07 15:29:44 curt
650 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
651 // <chotchkiss@namg.us.anritsu.com>
653 // Revision 1.39 1998/02/03 23:20:25 curt
654 // Lots of little tweaks to fix various consistency problems discovered by
655 // Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
656 // passed arguments along to the real printf(). Also incorporated HUD changes
657 // by Michele America.
659 // Revision 1.38 1998/02/02 20:53:58 curt
660 // Incorporated Durk's changes.
662 // Revision 1.37 1998/02/01 03:39:54 curt
665 // Revision 1.36 1998/01/31 00:43:13 curt
666 // Added MetroWorks patches from Carmen Volpe.
668 // Revision 1.35 1998/01/27 00:47:57 curt
669 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
670 // system and commandline/config file processing code.
672 // Revision 1.34 1998/01/22 02:59:37 curt
673 // Changed #ifdef FILE_H to #ifdef _FILE_H
675 // Revision 1.33 1998/01/21 21:11:34 curt
678 // Revision 1.32 1998/01/19 19:27:08 curt
679 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
680 // This should simplify things tremendously.
682 // Revision 1.31 1998/01/19 18:40:32 curt
683 // Tons of little changes to clean up the code and to remove fatal errors
684 // when building with the c++ compiler.
686 // Revision 1.30 1998/01/13 00:23:09 curt
687 // Initial changes to support loading and management of scenery tiles. Note,
688 // there's still a fair amount of work left to be done.
690 // Revision 1.29 1998/01/08 02:22:08 curt
691 // Beginning to integrate Tile management subsystem.
693 // Revision 1.28 1998/01/07 03:18:58 curt
694 // Moved astronomical stuff from .../Src/Scenery to .../Src/Astro/
696 // Revision 1.27 1998/01/05 18:44:35 curt
697 // Add an option to advance/decrease time from keyboard.
699 // Revision 1.26 1997/12/30 23:09:04 curt
700 // Tweaking initialization sequences.
702 // Revision 1.25 1997/12/30 22:22:33 curt
703 // Further integration of event manager.
705 // Revision 1.24 1997/12/30 20:47:44 curt
706 // Integrated new event manager with subsystem initializations.
708 // Revision 1.23 1997/12/30 16:36:50 curt
709 // Merged in Durk's changes ...
711 // Revision 1.22 1997/12/19 23:34:05 curt
712 // Lot's of tweaking with sky rendering and lighting.
714 // Revision 1.21 1997/12/19 16:45:00 curt
715 // Working on scene rendering order and options.
717 // Revision 1.20 1997/12/18 23:32:33 curt
718 // First stab at sky dome actually starting to look reasonable. :-)
720 // Revision 1.19 1997/12/17 23:13:36 curt
721 // Began working on rendering a sky.
723 // Revision 1.18 1997/12/15 23:54:49 curt
724 // Add xgl wrappers for debugging.
725 // Generate terrain normals on the fly.
727 // Revision 1.17 1997/12/15 20:59:09 curt
730 // Revision 1.16 1997/12/12 19:52:48 curt
731 // Working on lightling and material properties.
733 // Revision 1.15 1997/12/11 04:43:55 curt
734 // Fixed sun vector and lighting problems. I thing the moon is now lit
737 // Revision 1.14 1997/12/10 22:37:47 curt
738 // Prepended "fg" on the name of all global structures that didn't have it yet.
739 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
741 // Revision 1.13 1997/11/25 19:25:32 curt
742 // Changes to integrate Durk's moon/sun code updates + clean up.
744 // Revision 1.12 1997/11/15 18:16:35 curt
747 // Revision 1.11 1997/10/30 12:38:42 curt
748 // Working on new scenery subsystem.
750 // Revision 1.10 1997/10/25 03:24:23 curt
751 // Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
753 // Revision 1.9 1997/09/23 00:29:39 curt
754 // Tweaks to get things to compile with gcc-win32.
756 // Revision 1.8 1997/09/22 14:44:20 curt
757 // Continuing to try to align stars correctly.
759 // Revision 1.7 1997/09/16 15:50:30 curt
760 // Working on star alignment and time issues.
762 // Revision 1.6 1997/09/05 14:17:30 curt
763 // More tweaking with stars.
765 // Revision 1.5 1997/09/04 02:17:36 curt
768 // Revision 1.4 1997/08/27 21:32:26 curt
769 // Restructured view calculation code. Added stars.
771 // Revision 1.3 1997/08/27 03:30:19 curt
772 // Changed naming scheme of basic shared structures.
774 // Revision 1.2 1997/08/25 20:27:23 curt
775 // Merged in initial HUD and Joystick code.
777 // Revision 1.1 1997/08/23 01:46:20 curt