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