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