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