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>
54 #ifdef ENABLE_JOYSTICK_SUPPORT
55 # include <Joystick/joystick.hxx>
58 #include <Math/fg_geodesy.hxx>
59 #include <Math/fg_random.h>
60 #include <Math/point3d.hxx>
61 #include <Math/polar3d.hxx>
62 #include <Scenery/scenery.hxx>
63 #include <Scenery/tilemgr.hxx>
64 #include <Time/event.hxx>
65 #include <Time/fg_time.hxx>
66 #include <Time/light.hxx>
67 #include <Time/sunpos.hxx>
68 #include <Weather/weather.hxx>
70 #include "fg_init.hxx"
71 #include "options.hxx"
75 extern const char *default_root;
78 // Set initial position and orientation
79 int fgInitPosition( void ) {
83 f = current_aircraft.flight;
85 id = current_options.get_airport_id();
87 // set initial position from airport id
92 fgPrintf( FG_GENERAL, FG_INFO,
93 "Attempting to set starting position from airport code %s.\n",
96 airports.load("apt_simple");
97 if ( ! airports.search( id, &a ) ) {
98 fgPrintf( FG_GENERAL, FG_EXIT,
99 "Failed to find %s in database.\n", id.c_str() );
101 FG_Longitude = a.longitude * DEG_TO_RAD;
102 FG_Latitude = a.latitude * DEG_TO_RAD;
105 // set initial position from default or command line coordinates
107 FG_Longitude = current_options.get_lon() * DEG_TO_RAD;
108 FG_Latitude = current_options.get_lat() * DEG_TO_RAD;
110 printf("starting altitude is = %.2f\n", current_options.get_altitude());
112 FG_Altitude = current_options.get_altitude() * METER_TO_FEET;
113 FG_Runway_altitude = FG_Altitude - 3.758099;
115 fgPrintf( FG_GENERAL, FG_INFO,
116 "Initial position is: (%.4f, %.4f, %.2f)\n",
117 FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
118 FG_Altitude * FEET_TO_METER);
124 // General house keeping initializations
125 int fgInitGeneral( void ) {
132 fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" );
133 fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" );
135 g->glVendor = (char *)glGetString ( GL_VENDOR );
136 g->glRenderer = (char *)glGetString ( GL_RENDERER );
137 g->glVersion = (char *)glGetString ( GL_VERSION );
139 root = current_options.get_fg_root();
140 if ( ! root.length() ) {
141 // No root path set? Then bail ...
142 fgPrintf( FG_GENERAL, FG_EXIT, "%s %s\n",
143 "Cannot continue without environment variable FG_ROOT",
146 fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", root.c_str() );
148 // prime the frame rate counter pump
149 for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
157 // This is the top level init routine which calls all the other
158 // initialization routines. If you are adding a subsystem to flight
159 // gear, its initialization call should located in this routine.
160 // Returns non-zero if a problem encountered.
161 int fgInitSubsystems( void )
167 Point3D geod_pos, abs_view_pos;
169 l = &cur_light_params;
170 t = &cur_time_params;
173 fgPrintf( FG_GENERAL, FG_INFO, "Initialize Subsystems\n");
174 fgPrintf( FG_GENERAL, FG_INFO, "========== ==========\n");
176 // seed the random number generater
179 // allocates structures so must happen before any of the flight
180 // model or control parameters are set
181 fgAircraftInit(); // In the future this might not be the case.
182 f = current_aircraft.flight;
184 // set the initial position
187 // Initialize the Scenery Management subsystem
188 if ( fgSceneryInit() ) {
189 // Scenery initialized ok.
191 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Scenery initialization!\n" );
194 if( fgTileMgrInit() ) {
195 // Load the local scenery data
198 fgPrintf( FG_GENERAL, FG_EXIT,
199 "Error in Tile Manager initialization!\n" );
202 // calculalate a cartesian point somewhere along the line between
203 // the center of the earth and our view position. Doesn't have to
204 // be the exact elevation (this is good because we don't know it
206 geod_pos = Point3D( FG_Longitude, FG_Latitude, 0.0);
207 abs_view_pos = fgGeodToCart(geod_pos);
209 // Calculate ground elevation at starting point
211 fgTileMgrCurElev( FG_Longitude, FG_Latitude, abs_view_pos );
212 FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET;
214 // Reset our altitude if we are below ground
215 if ( FG_Altitude < FG_Runway_altitude + 3.758099) {
216 FG_Altitude = FG_Runway_altitude + 3.758099;
219 fgPrintf( FG_GENERAL, FG_INFO,
220 "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
221 FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
222 FG_Altitude * FEET_TO_METER);
223 // end of thing that I just stuck in that I should probably move
225 // The following section sets up the flight model EOM parameters
226 // and should really be read in from one or more files.
229 FG_V_north = 0.0; // 7.287719E+00
230 FG_V_east = 0.0; // 1.521770E+03
231 FG_V_down = 0.0; // -1.265722E-05
233 // Initial Orientation
234 FG_Phi = current_options.get_roll() * DEG_TO_RAD;
235 FG_Theta = current_options.get_pitch() * DEG_TO_RAD;
236 FG_Psi = current_options.get_heading() * DEG_TO_RAD;
238 // Initial Angular B rates
239 FG_P_body = 7.206685E-05;
240 FG_Q_body = 0.000000E+00;
241 FG_R_body = 9.492658E-05;
243 FG_Earth_position_angle = 0.000000E+00;
245 // Mass properties and geometry values
246 FG_Mass = 8.547270E+01;
247 FG_I_xx = 1.048000E+03;
248 FG_I_yy = 3.000000E+03;
249 FG_I_zz = 3.530000E+03;
250 FG_I_xz = 0.000000E+00;
252 // CG position w.r.t. ref. point
253 FG_Dx_cg = 0.000000E+00;
254 FG_Dy_cg = 0.000000E+00;
255 FG_Dz_cg = 0.000000E+00;
257 // Initialize the event manager
258 global_events.Init();
260 // Output event stats every 60 seconds
261 global_events.Register( "fgEVENT_MGR::PrintStats()",
262 fgMethodCallback<fgEVENT_MGR>( &global_events,
263 &fgEVENT_MGR::PrintStats),
264 fgEVENT::FG_EVENT_READY, 60000 );
266 // Initialize the time dependent variables
270 // Initialize view parameters
272 v->UpdateViewMath(f);
273 v->UpdateWorldToEye(f);
275 // Build the solar system
276 //fgSolarSystemInit(*t);
277 fgPrintf(FG_GENERAL, FG_INFO, "Building SolarSystem\n");
278 SolarSystem::theSolarSystem = new SolarSystem(t);
280 // Initialize the Stars subsystem
281 if( fgStarsInit() ) {
282 // Stars initialized ok.
284 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Stars initialization!\n" );
287 // Initialize the planetary subsystem
288 // global_events.Register( "fgPlanetsInit()", fgPlanetsInit,
289 // fgEVENT::FG_EVENT_READY, 600000);
291 // Initialize the sun's position
292 // global_events.Register( "fgSunInit()", fgSunInit,
293 // fgEVENT::FG_EVENT_READY, 30000 );
295 // Intialize the moon's position
296 // global_events.Register( "fgMoonInit()", fgMoonInit,
297 // fgEVENT::FG_EVENT_READY, 600000 );
299 // register the periodic update of Sun, moon, and planets
300 global_events.Register( "ssolsysUpdate", solarSystemRebuild,
301 fgEVENT::FG_EVENT_READY, 600000);
303 // fgUpdateSunPos() needs a few position and view parameters set
304 // so it can calculate local relative sun angle and a few other
305 // things for correctly orienting the sky.
307 global_events.Register( "fgUpdateSunPos()", fgUpdateSunPos,
308 fgEVENT::FG_EVENT_READY, 60000);
310 // Initialize Lighting interpolation tables
313 // update the lighting parameters (based on sun angle)
314 global_events.Register( "fgLight::Update()",
315 fgMethodCallback<fgLIGHT>( &cur_light_params,
317 fgEVENT::FG_EVENT_READY, 30000 );
319 // Initialize the weather modeling subsystem
322 // Initialize the Cockpit subsystem
323 if( fgCockpitInit( ¤t_aircraft )) {
324 // Cockpit initialized ok.
326 fgPrintf( FG_GENERAL, FG_EXIT, "Error in Cockpit initialization!\n" );
329 // Initialize the "sky"
332 // Initialize the flight model subsystem data structures base on
335 fgFlightModelInit( current_options.get_flight_model(), f,
336 1.0 / DEFAULT_MODEL_HZ );
338 // I'm just sticking this here for now, it should probably move
340 scenery.cur_elev = FG_Runway_altitude * FEET_TO_METER;
342 if ( FG_Altitude < FG_Runway_altitude + 3.758099) {
343 FG_Altitude = FG_Runway_altitude + 3.758099;
346 fgPrintf( FG_GENERAL, FG_INFO,
347 "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
348 FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
349 FG_Altitude * FEET_TO_METER);
350 // end of thing that I just stuck in that I should probably move
352 #ifdef ENABLE_JOYSTICK_SUPPORT
354 if ( fgJoystickInit() ) {
355 // Joystick initialized ok.
357 fgPrintf( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!\n" );
361 // Autopilot init added here, by Jeff Goeke-Smith
362 fgAPInit(¤t_aircraft);
364 fgPrintf(FG_GENERAL, FG_INFO,"\n");
371 // Revision 1.45 1998/10/25 10:57:21 curt
372 // Changes to use the new joystick library if it is available.
374 // Revision 1.44 1998/10/18 01:17:17 curt
377 // Revision 1.43 1998/10/17 01:34:22 curt
380 // Revision 1.42 1998/10/16 23:27:54 curt
383 // Revision 1.41 1998/10/16 00:54:01 curt
384 // Converted to Point3D class.
386 // Revision 1.40 1998/10/02 12:46:49 curt
387 // Added an "auto throttle"
389 // Revision 1.39 1998/09/29 02:03:39 curt
392 // Revision 1.38 1998/09/15 04:27:30 curt
393 // Changes for new Astro code.
395 // Revision 1.37 1998/09/15 02:09:26 curt
396 // Include/fg_callback.hxx
397 // Moved code inline to stop g++ 2.7 from complaining.
399 // Simulator/Time/event.[ch]xx
400 // Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
401 // complain bitterly.
403 // Minor bugfix and changes.
405 // Simulator/Main/GLUTmain.cxx
406 // Added missing type to idle_state definition - eliminates a warning.
408 // Simulator/Main/fg_init.cxx
409 // Changes to airport lookup.
411 // Simulator/Main/options.cxx
412 // Uses fg_gzifstream when loading config file.
414 // Revision 1.36 1998/09/08 21:40:08 curt
415 // Fixes by Charlie Hotchkiss.
417 // Revision 1.35 1998/08/29 13:09:26 curt
418 // Changes to event manager from Bernie Bright.
420 // Revision 1.34 1998/08/27 17:02:06 curt
421 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
422 // - use strings for fg_root and airport_id and added methods to return
424 // - inlined all access methods,
425 // - made the parsing functions private methods,
426 // - deleted some unused functions.
427 // - propogated some of these changes out a bit further.
429 // Revision 1.33 1998/08/25 20:53:32 curt
430 // Shuffled $FG_ROOT file layout.
432 // Revision 1.32 1998/08/25 16:59:09 curt
433 // Directory reshuffling.
435 // Revision 1.31 1998/08/22 14:49:57 curt
436 // Attempting to iron out seg faults and crashes.
437 // Did some shuffling to fix a initialization order problem between view
438 // position, scenery elevation.
440 // Revision 1.30 1998/08/20 20:32:33 curt
441 // Reshuffled some of the code in and around views.[ch]xx
443 // Revision 1.29 1998/07/30 23:48:27 curt
444 // Output position & orientation when pausing.
445 // Eliminated libtool use.
446 // Added options to specify initial position and orientation.
447 // Changed default fov to 55 degrees.
448 // Added command line option to start in paused or unpaused state.
450 // Revision 1.28 1998/07/27 18:41:25 curt
451 // Added a pause command "p"
452 // Fixed some initialization order problems between pui and glut.
453 // Added an --enable/disable-sound option.
455 // Revision 1.27 1998/07/24 21:39:10 curt
456 // Debugging output tweaks.
457 // Cast glGetString to (char *) to avoid compiler errors.
458 // Optimizations to fgGluLookAt() by Norman Vine.
460 // Revision 1.26 1998/07/22 21:40:44 curt
461 // Clear to adjusted fog color (for sunrise/sunset effects)
462 // Make call to fog sunrise/sunset adjustment method.
463 // Add a stdc++ library bug work around to fg_init.cxx
465 // Revision 1.25 1998/07/13 21:01:38 curt
466 // Wrote access functions for current fgOPTIONS.
468 // Revision 1.24 1998/07/13 15:32:39 curt
469 // Clear color buffer if drawing wireframe.
470 // When specifying and airport, start elevation at -1000 and let the system
471 // position you at ground level.
473 // Revision 1.23 1998/07/12 03:14:43 curt
474 // Added ground collision detection.
475 // Did some serious horsing around to be able to "hug" the ground properly
476 // and still be able to take off.
477 // Set the near clip plane to 1.0 meters when less than 10 meters above the
479 // Did some serious horsing around getting the initial airplane position to be
480 // correct based on rendered terrain elevation.
481 // Added a little cheat/hack that will prevent the view position from ever
482 // dropping below the terrain, even when the flight model doesn't quite
483 // put you as high as you'd like.
485 // Revision 1.22 1998/07/04 00:52:25 curt
486 // Add my own version of gluLookAt() (which is nearly identical to the
487 // Mesa/glu version.) But, by calculating the Model View matrix our selves
488 // we can save this matrix without having to read it back in from the video
489 // card. This hopefully allows us to save a few cpu cycles when rendering
490 // out the fragments because we can just use glLoadMatrixd() with the
491 // precalculated matrix for each tile rather than doing a push(), translate(),
492 // pop() for every fragment.
494 // Panel status defaults to off for now until it gets a bit more developed.
496 // Extract OpenGL driver info on initialization.
498 // Revision 1.21 1998/06/27 16:54:33 curt
499 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
500 // Don't change the view port when displaying the panel.
502 // Revision 1.20 1998/06/17 21:35:12 curt
503 // Refined conditional audio support compilation.
504 // Moved texture parameter setup calls to ../Scenery/materials.cxx
505 // #include <string.h> before various STL includes.
506 // Make HUD default state be enabled.
508 // Revision 1.19 1998/06/08 17:57:05 curt
509 // Minor sound/startup position tweaks.
511 // Revision 1.18 1998/06/03 00:47:14 curt
512 // Updated to compile in audio support if OSS available.
513 // Updated for new version of Steve's audio library.
514 // STL includes don't use .h
515 // Small view optimizations.
517 // Revision 1.17 1998/06/01 17:54:42 curt
518 // Added Linux audio support.
519 // avoid glClear( COLOR_BUFFER_BIT ) when not using it to set the sky color.
522 // Revision 1.16 1998/05/29 20:37:24 curt
523 // Tweaked material properties & lighting a bit in GLUTmain.cxx.
524 // Read airport list into a "map" STL for dynamic list sizing and fast tree
527 // Revision 1.15 1998/05/22 21:28:53 curt
528 // Modifications to use the new fgEVENT_MGR class.
530 // Revision 1.14 1998/05/20 20:51:35 curt
531 // Tweaked smooth shaded texture lighting properties.
532 // Converted fgLIGHT to a C++ class.
534 // Revision 1.13 1998/05/16 13:08:35 curt
535 // C++ - ified views.[ch]xx
536 // Shuffled some additional view parameters into the fgVIEW class.
537 // Changed tile-radius to tile-diameter because it is a much better
539 // Added a WORLD_TO_EYE transformation to views.cxx. This allows us
540 // to transform world space to eye space for view frustum culling.
542 // Revision 1.12 1998/05/13 18:29:58 curt
543 // Added a keyboard binding to dynamically adjust field of view.
544 // Added a command line option to specify fov.
545 // Adjusted terrain color.
546 // Root path info moved to fgOPTIONS.
547 // Added ability to parse options out of a config file.
549 // Revision 1.11 1998/05/07 23:14:15 curt
550 // Added "D" key binding to set autopilot heading.
551 // Made frame rate calculation average out over last 10 frames.
552 // Borland C++ floating point exception workaround.
553 // Added a --tile-radius=n option.
555 // Revision 1.10 1998/05/06 03:16:24 curt
556 // Added an averaged global frame rate counter.
557 // Added an option to control tile radius.
559 // Revision 1.9 1998/05/03 00:47:31 curt
560 // Added an option to enable/disable full-screen mode.
562 // Revision 1.8 1998/04/30 12:34:18 curt
563 // Added command line rendering options:
564 // enable/disable fog/haze
565 // specify smooth/flat shading
566 // disable sky blending and just use a solid color
567 // enable wireframe drawing mode
569 // Revision 1.7 1998/04/28 01:20:22 curt
570 // Type-ified fgTIME and fgVIEW.
571 // Added a command line option to disable textures.
573 // Revision 1.6 1998/04/26 05:10:03 curt
574 // "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
576 // Revision 1.5 1998/04/25 22:06:30 curt
577 // Edited cvs log messages in source files ... bad bad bad!
579 // Revision 1.4 1998/04/25 20:24:01 curt
580 // Cleaned up initialization sequence to eliminate interdependencies
581 // between sun position, lighting, and view position. This creates a
582 // valid single pass initialization path.
584 // Revision 1.3 1998/04/25 15:11:11 curt
585 // Added an command line option to set starting position based on airport ID.
587 // Revision 1.2 1998/04/24 00:49:20 curt
588 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
589 // Trying out some different option parsing code.
590 // Some code reorganization.
592 // Revision 1.1 1998/04/22 13:25:44 curt
593 // C++ - ifing the code.
594 // Starting a bit of reorganization of lighting code.
596 // Revision 1.56 1998/04/18 04:11:28 curt
597 // Moved fg_debug to it's own library, added zlib support.
599 // Revision 1.55 1998/04/14 02:21:03 curt
600 // Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
601 // <jgoeke@voyager.net>
603 // Revision 1.54 1998/04/08 23:35:36 curt
604 // Tweaks to Gnu automake/autoconf system.
606 // Revision 1.53 1998/04/03 22:09:06 curt
607 // Converting to Gnu autoconf system.
609 // Revision 1.52 1998/03/23 21:24:38 curt
610 // Source code formating tweaks.
612 // Revision 1.51 1998/03/14 00:31:22 curt
613 // Beginning initial terrain texturing experiments.
615 // Revision 1.50 1998/03/09 22:46:19 curt
618 // Revision 1.49 1998/02/23 19:07:59 curt
619 // Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
620 // calculation code between sun display, and other FG sections that use this
621 // for things like lighting.
623 // Revision 1.48 1998/02/21 14:53:15 curt
624 // Added Charlie's HUD changes.
626 // Revision 1.47 1998/02/19 13:05:53 curt
627 // Incorporated some HUD tweaks from Michelle America.
628 // Tweaked the sky's sunset/rise colors.
629 // Other misc. tweaks.
631 // Revision 1.46 1998/02/18 15:07:06 curt
632 // Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
633 // drivers will work.)
635 // Revision 1.45 1998/02/16 13:39:43 curt
636 // Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
637 // tiles to occasionally be missing.
639 // Revision 1.44 1998/02/12 21:59:50 curt
640 // Incorporated code changes contributed by Charlie Hotchkiss
641 // <chotchkiss@namg.us.anritsu.com>
643 // Revision 1.43 1998/02/11 02:50:40 curt
646 // Revision 1.42 1998/02/09 22:56:58 curt
647 // Removed "depend" files from cvs control. Other minor make tweaks.
649 // Revision 1.41 1998/02/09 15:07:50 curt
652 // Revision 1.40 1998/02/07 15:29:44 curt
653 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
654 // <chotchkiss@namg.us.anritsu.com>
656 // Revision 1.39 1998/02/03 23:20:25 curt
657 // Lots of little tweaks to fix various consistency problems discovered by
658 // Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
659 // passed arguments along to the real printf(). Also incorporated HUD changes
660 // by Michele America.
662 // Revision 1.38 1998/02/02 20:53:58 curt
663 // Incorporated Durk's changes.
665 // Revision 1.37 1998/02/01 03:39:54 curt
668 // Revision 1.36 1998/01/31 00:43:13 curt
669 // Added MetroWorks patches from Carmen Volpe.
671 // Revision 1.35 1998/01/27 00:47:57 curt
672 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
673 // system and commandline/config file processing code.
675 // Revision 1.34 1998/01/22 02:59:37 curt
676 // Changed #ifdef FILE_H to #ifdef _FILE_H
678 // Revision 1.33 1998/01/21 21:11:34 curt
681 // Revision 1.32 1998/01/19 19:27:08 curt
682 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
683 // This should simplify things tremendously.
685 // Revision 1.31 1998/01/19 18:40:32 curt
686 // Tons of little changes to clean up the code and to remove fatal errors
687 // when building with the c++ compiler.
689 // Revision 1.30 1998/01/13 00:23:09 curt
690 // Initial changes to support loading and management of scenery tiles. Note,
691 // there's still a fair amount of work left to be done.
693 // Revision 1.29 1998/01/08 02:22:08 curt
694 // Beginning to integrate Tile management subsystem.
696 // Revision 1.28 1998/01/07 03:18:58 curt
697 // Moved astronomical stuff from .../Src/Scenery to .../Src/Astro/
699 // Revision 1.27 1998/01/05 18:44:35 curt
700 // Add an option to advance/decrease time from keyboard.
702 // Revision 1.26 1997/12/30 23:09:04 curt
703 // Tweaking initialization sequences.
705 // Revision 1.25 1997/12/30 22:22:33 curt
706 // Further integration of event manager.
708 // Revision 1.24 1997/12/30 20:47:44 curt
709 // Integrated new event manager with subsystem initializations.
711 // Revision 1.23 1997/12/30 16:36:50 curt
712 // Merged in Durk's changes ...
714 // Revision 1.22 1997/12/19 23:34:05 curt
715 // Lot's of tweaking with sky rendering and lighting.
717 // Revision 1.21 1997/12/19 16:45:00 curt
718 // Working on scene rendering order and options.
720 // Revision 1.20 1997/12/18 23:32:33 curt
721 // First stab at sky dome actually starting to look reasonable. :-)
723 // Revision 1.19 1997/12/17 23:13:36 curt
724 // Began working on rendering a sky.
726 // Revision 1.18 1997/12/15 23:54:49 curt
727 // Add xgl wrappers for debugging.
728 // Generate terrain normals on the fly.
730 // Revision 1.17 1997/12/15 20:59:09 curt
733 // Revision 1.16 1997/12/12 19:52:48 curt
734 // Working on lightling and material properties.
736 // Revision 1.15 1997/12/11 04:43:55 curt
737 // Fixed sun vector and lighting problems. I thing the moon is now lit
740 // Revision 1.14 1997/12/10 22:37:47 curt
741 // Prepended "fg" on the name of all global structures that didn't have it yet.
742 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
744 // Revision 1.13 1997/11/25 19:25:32 curt
745 // Changes to integrate Durk's moon/sun code updates + clean up.
747 // Revision 1.12 1997/11/15 18:16:35 curt
750 // Revision 1.11 1997/10/30 12:38:42 curt
751 // Working on new scenery subsystem.
753 // Revision 1.10 1997/10/25 03:24:23 curt
754 // Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
756 // Revision 1.9 1997/09/23 00:29:39 curt
757 // Tweaks to get things to compile with gcc-win32.
759 // Revision 1.8 1997/09/22 14:44:20 curt
760 // Continuing to try to align stars correctly.
762 // Revision 1.7 1997/09/16 15:50:30 curt
763 // Working on star alignment and time issues.
765 // Revision 1.6 1997/09/05 14:17:30 curt
766 // More tweaking with stars.
768 // Revision 1.5 1997/09/04 02:17:36 curt
771 // Revision 1.4 1997/08/27 21:32:26 curt
772 // Restructured view calculation code. Added stars.
774 // Revision 1.3 1997/08/27 03:30:19 curt
775 // Changed naming scheme of basic shared structures.
777 // Revision 1.2 1997/08/25 20:27:23 curt
778 // Merged in initial HUD and Joystick code.
780 // Revision 1.1 1997/08/23 01:46:20 curt