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