]> git.mxchange.org Git - flightgear.git/blob - Main/GLUTmain.c
First stab at sky dome actually starting to look reasonable. :-)
[flightgear.git] / Main / GLUTmain.c
1 /**************************************************************************
2  * GLUTmain.c -- top level sim routines
3  *
4  * Written by Curtis Olson for OpenGL, started May 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  * $Id$
23  * (Log is kept at end of this file)
24  **************************************************************************/
25
26
27 #ifdef WIN32
28 #  include <windows.h>                     
29 #endif
30
31 #include <GL/glut.h>
32 #include "../XGL/xgl.h"
33 #include <stdio.h>
34
35 #include "GLUTkey.h"
36 #include "fg_init.h"
37 #include "views.h"
38
39 #include "../Include/constants.h"
40 #include "../Include/general.h"
41
42 #include "../Aircraft/aircraft.h"
43 #include "../Cockpit/cockpit.h"
44 #include "../Joystick/joystick.h"
45 #include "../Math/fg_geodesy.h"
46 #include "../Math/mat3.h"
47 #include "../Math/polar.h"
48 #include "../Scenery/mesh.h"
49 #include "../Scenery/scenery.h"
50 #include "../Scenery/sky.h"
51 #include "../Time/fg_time.h"
52 #include "../Time/fg_timer.h"
53 #include "../Time/sunpos.h"
54 #include "../Weather/weather.h"
55
56
57 /* This is a record containing global housekeeping information */
58 struct fgGENERAL general;
59
60 /* view parameters */
61 static GLfloat win_ratio = 1.0;
62
63 /* fog color */
64 static GLfloat fgFogColor[4] =   {0.65, 0.65, 0.85, 1.0};
65
66 /* temporary hack */
67 /* pointer to scenery structure */
68 /* static GLint scenery, runway; */
69
70 double Simtime;
71
72 /* Another hack */
73 int use_signals = 0;
74
75 /* Yet another hack. This one used by the HUD code. Michele */
76 int show_hud;
77
78
79 /**************************************************************************
80  * fgInitVisuals() -- Initialize various GL/view parameters
81  **************************************************************************/
82
83 static void fgInitVisuals() {
84     struct fgLIGHT *l;
85     struct fgTIME *t;
86     struct fgWEATHER *w;
87
88     l = &cur_light_params;
89     t = &cur_time_params;
90     w = &current_weather;
91
92     xglEnable( GL_DEPTH_TEST );
93     /* xglFrontFace(GL_CW); */
94     xglEnable( GL_CULL_FACE );
95     
96     /* xglDisable( GL_DITHER ); */
97
98     /* If enabled, normal vectors specified with glNormal are scaled
99        to unit length after transformation.  See glNormal. */
100     xglEnable( GL_NORMALIZE );
101
102     xglEnable( GL_LIGHTING );
103     xglEnable( GL_LIGHT0 );
104     xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
105
106     xglShadeModel( GL_FLAT ); /* xglShadeModel( GL_SMOOTH ); */
107
108     xglEnable( GL_FOG );
109     xglFogi (GL_FOG_MODE, GL_LINEAR);
110     /* xglFogf (GL_FOG_START, 1.0); */
111     xglFogf (GL_FOG_END, w->visibility);
112     xglFogfv (GL_FOG_COLOR, fgFogColor);
113     /* xglFogf (GL_FOG_DENSITY, w->visibility); */
114     /* xglHint (GL_FOG_HINT, GL_FASTEST); */
115
116     /* initial screen color */
117     xglClearColor(0.0, 0.0, 0.0, 1.0);
118 }
119
120
121 /**************************************************************************
122  * Update the view volume, position, and orientation
123  **************************************************************************/
124
125 static void fgUpdateViewParams() {
126     struct fgFLIGHT *f;
127     struct fgLIGHT *l;
128     struct fgTIME *t;
129     struct fgVIEW *v;
130
131     double x_2, x_4, x_8, x_10;
132     double light, ambient, diffuse, sky_brightness;
133     /* if the 4th field is 0.0, this specifies a direction ... */
134     /* clear color (sky) */
135     GLfloat sky_color[4] = {0.60, 0.60, 0.90, 1.0};
136     GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
137
138     f = &current_aircraft.flight;
139     l = &cur_light_params;
140     t = &cur_time_params;
141     v = &current_view;
142
143     fgViewUpdate(f, v);
144
145     /* Tell GL we are about to modify the projection parameters */
146     xglMatrixMode(GL_PROJECTION);
147     xglLoadIdentity();
148     gluPerspective(55.0, 1.0/win_ratio, 1.0, 200000.0);
149
150     xglMatrixMode(GL_MODELVIEW);
151     xglLoadIdentity();
152     
153     /* set up our view volume */
154     gluLookAt(v->view_pos.x, v->view_pos.y, v->view_pos.z,
155                v->view_pos.x + v->view_forward[0], 
156                v->view_pos.y + v->view_forward[1], 
157                v->view_pos.z + v->view_forward[2],
158                v->view_up[0], v->view_up[1], v->view_up[2]);
159
160     /* set the sun position */
161     xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
162
163     /* calculate lighting parameters based on sun's relative angle to
164      * local up */
165     /* ya kind'a have to plot this to see the magic */
166
167     /* x = t->sun_angle^8 */
168     x_2 = l->sun_angle * l->sun_angle;
169     x_4 = x_2 * x_2;
170     x_8 = x_4 * x_4;
171     x_10 = x_8 * x_2;
172
173     light = pow(1.1, -x_10 / 30.0);
174     ambient = 0.3 * light;
175     diffuse = 0.9 * light;
176
177     sky_brightness = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
178
179     /* sky_brightness = 0.15; */ /* to force a dark sky (for testing) */
180
181     if ( ambient < 0.1 ) { ambient = 0.1; }
182     if ( diffuse < 0.0 ) { diffuse = 0.0; }
183
184     if ( sky_brightness < 0.0 ) { sky_brightness = 0.0; }
185
186     l->scene_ambient[0] = white[0] * ambient;
187     l->scene_ambient[1] = white[1] * ambient;
188     l->scene_ambient[2] = white[2] * ambient;
189
190     l->scene_diffuse[0] = white[0] * diffuse;
191     l->scene_diffuse[1] = white[1] * diffuse;
192     l->scene_diffuse[2] = white[2] * diffuse;
193
194     /* set lighting parameters */
195     xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
196     xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
197
198     /* set fog color */
199     l->scene_fog[0] = fgFogColor[0] * (ambient + diffuse);
200     l->scene_fog[1] = fgFogColor[1] * (ambient + diffuse);
201     l->scene_fog[2] = fgFogColor[2] * (ambient + diffuse);
202     l->scene_fog[3] = fgFogColor[3];
203     xglFogfv (GL_FOG_COLOR, l->scene_fog);
204
205     /* set sky color */
206     l->scene_clear[0] = sky_color[0] * sky_brightness;
207     l->scene_clear[1] = sky_color[1] * sky_brightness;
208     l->scene_clear[2] = sky_color[2] * sky_brightness;
209     l->scene_clear[3] = sky_color[3];
210
211     xglClearColor(l->scene_clear[0], l->scene_clear[1], 
212                   l->scene_clear[2], l->scene_clear[3]);
213 }
214
215
216 /**************************************************************************
217  * Update all Visuals (redraws anything graphics related)
218  **************************************************************************/
219
220 static void fgUpdateVisuals( void ) {
221     /* update view volume parameters */
222     fgUpdateViewParams();
223
224     xglClear( /* GL_COLOR_BUFFER_BIT | */ GL_DEPTH_BUFFER_BIT );
225
226     /* Tell GL we are switching to model view parameters */
227     xglMatrixMode(GL_MODELVIEW);
228     /* xglLoadIdentity(); */
229
230     /* draw sky */
231     fgSkyRender();
232
233     /* draw astronomical objects */
234     /* fgAstroRender(); */
235     
236     /* draw scenery */
237     fgSceneryRender();
238
239     /* display HUD */
240     /* if( show_hud )
241         fgCockpitUpdate(); */
242
243     #ifdef GLUT
244       xglutSwapBuffers();
245     #endif
246 }
247
248
249 /**************************************************************************
250  * Update internal time dependent calculations (i.e. flight model)
251  **************************************************************************/
252
253 void fgUpdateTimeDepCalcs(int multi_loop) {
254     struct fgFLIGHT *f;
255     struct fgTIME *t;
256     struct fgVIEW *v;
257     int i;
258
259     f = &current_aircraft.flight;
260     t = &cur_time_params;
261     v = &current_view;
262
263     /* update the flight model */
264     if ( multi_loop < 0 ) {
265         multi_loop = DEFAULT_MULTILOOP;
266     }
267
268     /* printf("updating flight model x %d\n", multi_loop); */
269     fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
270
271     /* refresh shared sun position and sun_vec */
272     fgUpdateSunPos(scenery.center);
273
274     /* update the view angle */
275     for ( i = 0; i < multi_loop; i++ ) {
276         if ( fabs(v->goal_view_offset - v->view_offset) < 0.05 ) {
277             v->view_offset = v->goal_view_offset;
278             break;
279         } else {
280             /* move v->view_offset towards v->goal_view_offset */
281             if ( v->goal_view_offset > v->view_offset ) {
282                 if ( v->goal_view_offset - v->view_offset < FG_PI ) {
283                     v->view_offset += 0.01;
284                 } else {
285                     v->view_offset -= 0.01;
286                 }
287             } else {
288                 if ( v->view_offset - v->goal_view_offset < FG_PI ) {
289                     v->view_offset -= 0.01;
290                 } else {
291                     v->view_offset += 0.01;
292                 }
293             }
294             if ( v->view_offset > FG_2PI ) {
295                 v->view_offset -= FG_2PI;
296             } else if ( v->view_offset < 0 ) {
297                 v->view_offset += FG_2PI;
298             }
299         }
300     }
301 }
302
303
304 void fgInitTimeDepCalcs() {
305     /* initialize timer */
306
307 #ifdef USE_ITIMER
308     fgTimerInit( 1.0 / DEFAULT_TIMER_HZ, fgUpdateTimeDepCalcs );
309 #endif USE_ITIMER
310
311 }
312
313
314 /**************************************************************************
315  * Scenery management routines
316  **************************************************************************/
317
318 /* static void fgSceneryInit_OLD() { */
319     /* make scenery */
320 /*     scenery = fgSceneryCompile_OLD();
321     runway = fgRunwayHack_OLD(0.69, 53.07);
322 } */
323
324
325 /* create the scenery */
326 /* GLint fgSceneryCompile_OLD() {
327     GLint scenery;
328
329     scenery = mesh2GL(mesh_ptr_OLD);
330
331     return(scenery);
332 }
333 */
334
335 /* hack in a runway */
336 /* GLint fgRunwayHack_OLD(double width, double length) {
337     static GLfloat concrete[4] = { 0.5, 0.5, 0.5, 1.0 };
338     static GLfloat line[4]     = { 0.9, 0.9, 0.9, 1.0 };
339     int i;
340     int num_lines = 16;
341     float line_len, line_width_2, cur_pos;
342
343     runway = xglGenLists(1);
344     xglNewList(runway, GL_COMPILE);
345     */
346     /* draw concrete */
347 /*    xglBegin(GL_POLYGON);
348     xglMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, concrete );
349     xglNormal3f(0.0, 0.0, 1.0);
350
351     xglVertex3d( 0.0,   -width/2.0, 0.0);
352     xglVertex3d( 0.0,    width/2.0, 0.0);
353     xglVertex3d(length,  width/2.0, 0.0);
354     xglVertex3d(length, -width/2.0, 0.0);
355     xglEnd();
356     */
357     /* draw center line */
358 /*    xglMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, line );
359     line_len = length / ( 2 * num_lines + 1);
360     printf("line_len = %.3f\n", line_len);
361     line_width_2 = 0.02;
362     cur_pos = line_len;
363     for ( i = 0; i < num_lines; i++ ) {
364         xglBegin(GL_POLYGON);
365         xglVertex3d( cur_pos, -line_width_2, 0.005);
366         xglVertex3d( cur_pos,  line_width_2, 0.005);
367         cur_pos += line_len;
368         xglVertex3d( cur_pos,  line_width_2, 0.005);
369         xglVertex3d( cur_pos, -line_width_2, 0.005);
370         cur_pos += line_len;
371         xglEnd();
372     }
373
374     xglEndList();
375
376     return(runway);
377 }
378 */
379
380 /* draw the scenery */
381 /*static void fgSceneryDraw_OLD() {
382     static float z = 32.35;
383
384     xglPushMatrix();
385
386     xglCallList(scenery);
387
388     printf("*** Drawing runway at %.2f\n", z);
389
390     xglTranslatef( -398391.28, 120070.41, 32.35);
391     xglRotatef(170.0, 0.0, 0.0, 1.0);
392     xglCallList(runway);
393
394     xglPopMatrix();
395 }
396 */
397
398 /* What should we do when we have nothing else to do?  How about get
399  * ready for the next move and update the display? */
400 static void fgMainLoop( void ) {
401     static int remainder = 0;
402     int elapsed, multi_loop;
403     double cur_elev;
404     double joy_x, joy_y;
405     int joy_b1, joy_b2;
406     struct fgAIRCRAFT *a;
407     struct fgFLIGHT *f;
408     struct fgTIME *t;
409
410     a = &current_aircraft;
411     f = &a->flight;
412     t = &cur_time_params;
413
414     /* update "time" */
415     fgTimeUpdate(f, t);
416
417     /* Read joystick */
418     /* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 );
419     printf( "Joystick X %f  Y %f  B1 %d  B2 %d\n",  
420             joy_x, joy_y, joy_b1, joy_b2 );
421     fgElevSet( -joy_y );
422     fgAileronSet( joy_x ); */
423
424     /* update the weather for our current position */
425     fgWeatherUpdate(FG_Longitude * RAD_TO_ARCSEC, 
426                     FG_Latitude * RAD_TO_ARCSEC, 
427                     FG_Altitude * FEET_TO_METER);
428
429     /* Calculate model iterations needed */
430     elapsed = fgGetTimeInterval();
431     printf("Time interval is = %d, previous remainder is = %d\n", elapsed, 
432            remainder);
433     printf("--> Frame rate is = %.2f\n", 1000.0 / (float)elapsed);
434     elapsed += remainder;
435
436     multi_loop = ((float)elapsed * 0.001) * DEFAULT_MODEL_HZ;
437     remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
438     printf("Model iterations needed = %d, new remainder = %d\n", multi_loop, 
439            remainder);
440
441     if ( ! use_signals ) {
442         /* flight model */
443         fgUpdateTimeDepCalcs(multi_loop);
444     }
445
446     /* I'm just sticking this here for now, it should probably move 
447      * eventually */
448     cur_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC, 
449                                FG_Latitude  * RAD_TO_ARCSEC);
450     printf("Ground elevation is %.2f meters here.\n", cur_elev);
451     /* FG_Runway_altitude = cur_elev * METER_TO_FEET; */
452
453     if ( FG_Altitude * FEET_TO_METER < cur_elev + 3.758099) {
454         /* set this here, otherwise if we set runway height above our
455            current height we get a really nasty bounce. */
456         FG_Runway_altitude = FG_Altitude - 3.758099;
457
458         /* now set aircraft altitude above ground */
459         FG_Altitude = cur_elev * METER_TO_FEET + 3.758099;
460         printf("<*> resetting altitude to %.0f meters\n", 
461                FG_Altitude * FEET_TO_METER);
462     }
463
464     fgAircraftOutputCurrent(a);
465
466     /* redraw display */
467     fgUpdateVisuals();
468 }
469
470
471 /**************************************************************************
472  * Handle new window size or exposure
473  **************************************************************************/
474
475 static void fgReshape( int width, int height ) {
476     /* Do this so we can call fgReshape(0,0) ourselves without having to know
477      * what the values of width & height are. */
478     if ( (height > 0) && (width > 0) ) {
479         win_ratio = (GLfloat) height / (GLfloat) width;
480     }
481
482     /* Inform gl of our view window size */
483     xglViewport(0, 0, (GLint)width, (GLint)height);
484
485     fgUpdateViewParams();
486     
487     /* xglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); */
488 }
489
490
491 /**************************************************************************
492  * Main ...
493  **************************************************************************/
494
495 int main( int argc, char *argv[] ) {
496     struct fgFLIGHT *f;
497
498     f = &current_aircraft.flight;
499
500     printf("Flight Gear: prototype version %s\n\n", VERSION);
501
502     /**********************************************************************
503      * Initialize the Window/Graphics environment.
504      **********************************************************************/
505
506     #ifdef GLUT
507       /* initialize GLUT */
508       xglutInit(&argc, argv);
509
510       /* Define Display Parameters */
511       xglutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
512
513       /* Define initial window size */
514       xglutInitWindowSize(640, 480);
515
516       /* Initialize windows */
517       xglutCreateWindow("Flight Gear");
518     #endif
519
520     /* This is the general house keeping init routine */
521     fgInitGeneral();
522
523     /* This is the top level init routine which calls all the other
524      * subsystem initialization routines.  If you are adding a
525      * subsystem to flight gear, its initialization call should
526      * located in this routine.*/
527     fgInitSubsystems();
528
529     /* setup view parameters, only makes GL calls */
530     fgInitVisuals();
531
532     if ( use_signals ) {
533         /* init timer routines, signals, etc.  Arrange for an alarm
534            signal to be generated, etc. */
535         fgInitTimeDepCalcs();
536     }
537
538    /**********************************************************************
539      * Initialize the Event Handlers.
540      **********************************************************************/
541
542     #ifdef GLUT
543       /* call fgReshape() on window resizes */
544       xglutReshapeFunc( fgReshape );
545
546       /* call key() on keyboard event */
547       xglutKeyboardFunc( GLUTkey );
548       glutSpecialFunc( GLUTspecialkey );
549
550       /* call fgMainLoop() whenever there is nothing else to do */
551       xglutIdleFunc( fgMainLoop );
552
553       /* draw the scene */
554       xglutDisplayFunc( fgUpdateVisuals );
555
556       /* pass control off to the GLUT event handler */
557       glutMainLoop();
558     #endif
559
560     return(0);
561 }
562
563
564 #ifdef NO_PRINTF
565   #include <stdarg.h>
566   int printf (const char *format, ...) {
567   }
568 #endif
569
570
571 /* $Log$
572 /* Revision 1.35  1997/12/18 23:32:32  curt
573 /* First stab at sky dome actually starting to look reasonable. :-)
574 /*
575  * Revision 1.34  1997/12/17 23:13:34  curt
576  * Began working on rendering a sky.
577  *
578  * Revision 1.33  1997/12/15 23:54:45  curt
579  * Add xgl wrappers for debugging.
580  * Generate terrain normals on the fly.
581  *
582  * Revision 1.32  1997/12/15 20:59:08  curt
583  * Misc. tweaks.
584  *
585  * Revision 1.31  1997/12/12 21:41:25  curt
586  * More light/material property tweaking ... still a ways off.
587  *
588  * Revision 1.30  1997/12/12 19:52:47  curt
589  * Working on lightling and material properties.
590  *
591  * Revision 1.29  1997/12/11 04:43:54  curt
592  * Fixed sun vector and lighting problems.  I thing the moon is now lit
593  * correctly.
594  *
595  * Revision 1.28  1997/12/10 22:37:45  curt
596  * Prepended "fg" on the name of all global structures that didn't have it yet.
597  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
598  *
599  * Revision 1.27  1997/12/09 05:11:54  curt
600  * Working on tweaking lighting.
601  *
602  * Revision 1.26  1997/12/09 04:25:29  curt
603  * Working on adding a global lighting params structure.
604  *
605  * Revision 1.25  1997/12/08 22:54:09  curt
606  * Enabled GL_CULL_FACE.
607  *
608  * Revision 1.24  1997/11/25 19:25:32  curt
609  * Changes to integrate Durk's moon/sun code updates + clean up.
610  *
611  * Revision 1.23  1997/11/15 18:16:34  curt
612  * minor tweaks.
613  *
614  * Revision 1.22  1997/10/30 12:38:41  curt
615  * Working on new scenery subsystem.
616  *
617  * Revision 1.21  1997/09/23 00:29:38  curt
618  * Tweaks to get things to compile with gcc-win32.
619  *
620  * Revision 1.20  1997/09/22 14:44:19  curt
621  * Continuing to try to align stars correctly.
622  *
623  * Revision 1.19  1997/09/18 16:20:08  curt
624  * At dusk/dawn add/remove stars in stages.
625  *
626  * Revision 1.18  1997/09/16 22:14:51  curt
627  * Tweaked time of day lighting equations.  Don't draw stars during the day.
628  *
629  * Revision 1.17  1997/09/16 15:50:29  curt
630  * Working on star alignment and time issues.
631  *
632  * Revision 1.16  1997/09/13 02:00:06  curt
633  * Mostly working on stars and generating sidereal time for accurate star
634  * placement.
635  *
636  * Revision 1.15  1997/09/05 14:17:27  curt
637  * More tweaking with stars.
638  *
639  * Revision 1.14  1997/09/05 01:35:53  curt
640  * Working on getting stars right.
641  *
642  * Revision 1.13  1997/09/04 02:17:34  curt
643  * Shufflin' stuff.
644  *
645  * Revision 1.12  1997/08/27 21:32:24  curt
646  * Restructured view calculation code.  Added stars.
647  *
648  * Revision 1.11  1997/08/27 03:30:16  curt
649  * Changed naming scheme of basic shared structures.
650  *
651  * Revision 1.10  1997/08/25 20:27:22  curt
652  * Merged in initial HUD and Joystick code.
653  *
654  * Revision 1.9  1997/08/22 21:34:39  curt
655  * Doing a bit of reorganizing and house cleaning.
656  *
657  * Revision 1.8  1997/08/19 23:55:03  curt
658  * Worked on better simulating real lighting.
659  *
660  * Revision 1.7  1997/08/16 12:22:38  curt
661  * Working on improving the lighting/shading.
662  *
663  * Revision 1.6  1997/08/13 20:24:56  curt
664  * Changes due to changing sunpos interface.
665  *
666  * Revision 1.5  1997/08/06 21:08:32  curt
667  * Sun position now *really* works (I think) ... I still have sun time warping
668  * code in place, probably should remove it soon.
669  *
670  * Revision 1.4  1997/08/06 15:41:26  curt
671  * Working on correct sun position.
672  *
673  * Revision 1.3  1997/08/06 00:24:22  curt
674  * Working on correct real time sun lighting.
675  *
676  * Revision 1.2  1997/08/04 20:25:15  curt
677  * Organizational tweaking.
678  *
679  * Revision 1.1  1997/08/02 18:45:00  curt
680  * Renamed GLmain.c GLUTmain.c
681  *
682  * Revision 1.43  1997/08/02 16:23:47  curt
683  * Misc. tweaks.
684  *
685  * Revision 1.42  1997/08/01 19:43:33  curt
686  * Making progress with coordinate system overhaul.
687  *
688  * Revision 1.41  1997/07/31 22:52:37  curt
689  * Working on redoing internal coordinate systems & scenery transformations.
690  *
691  * Revision 1.40  1997/07/30 16:12:42  curt
692  * Moved fg_random routines from Util/ to Math/
693  *
694  * Revision 1.39  1997/07/21 14:45:01  curt
695  * Minor tweaks.
696  *
697  * Revision 1.38  1997/07/19 23:04:47  curt
698  * Added an initial weather section.
699  *
700  * Revision 1.37  1997/07/19 22:34:02  curt
701  * Moved PI definitions to ../constants.h
702  * Moved random() stuff to ../Utils/ and renamed fg_random()
703  *
704  * Revision 1.36  1997/07/18 23:41:25  curt
705  * Tweaks for building with Cygnus Win32 compiler.
706  *
707  * Revision 1.35  1997/07/18 14:28:34  curt
708  * Hacked in some support for wind/turbulence.
709  *
710  * Revision 1.34  1997/07/16 20:04:48  curt
711  * Minor tweaks to aid Win32 port.
712  *
713  * Revision 1.33  1997/07/12 03:50:20  curt
714  * Added an #include <Windows32/Base.h> to help compiling for Win32
715  *
716  * Revision 1.32  1997/07/11 03:23:18  curt
717  * Solved some scenery display/orientation problems.  Still have a positioning
718  * (or transformation?) problem.
719  *
720  * Revision 1.31  1997/07/11 01:29:58  curt
721  * More tweaking of terrian floor.
722  *
723  * Revision 1.30  1997/07/10 04:26:37  curt
724  * We now can interpolated ground elevation for any position in the grid.  We
725  * can use this to enforce a "hard" ground.  We still need to enforce some
726  * bounds checking so that we don't try to lookup data points outside the
727  * grid data set.
728  *
729  * Revision 1.29  1997/07/09 21:31:12  curt
730  * Working on making the ground "hard."
731  *
732  * Revision 1.28  1997/07/08 18:20:12  curt
733  * Working on establishing a hard ground.
734  *
735  * Revision 1.27  1997/07/07 20:59:49  curt
736  * Working on scenery transformations to enable us to fly fluidly over the
737  * poles with no discontinuity/distortion in scenery.
738  *
739  * Revision 1.26  1997/07/05 20:43:34  curt
740  * renamed mat3 directory to Math so we could add other math related routines.
741  *
742  * Revision 1.25  1997/06/29 21:19:17  curt
743  * Working on scenery management system.
744  *
745  * Revision 1.24  1997/06/26 22:14:53  curt
746  * Beginning work on a scenery management system.
747  *
748  * Revision 1.23  1997/06/26 19:08:33  curt
749  * Restructuring make, adding automatic "make dep" support.
750  *
751  * Revision 1.22  1997/06/25 15:39:47  curt
752  * Minor changes to compile with rsxnt/win32.
753  *
754  * Revision 1.21  1997/06/22 21:44:41  curt
755  * Working on intergrating the VRML (subset) parser.
756  *
757  * Revision 1.20  1997/06/21 17:12:53  curt
758  * Capitalized subdirectory names.
759  *
760  * Revision 1.19  1997/06/18 04:10:31  curt
761  * A couple more runway tweaks ...
762  *
763  * Revision 1.18  1997/06/18 02:21:24  curt
764  * Hacked in a runway
765  *
766  * Revision 1.17  1997/06/17 16:51:58  curt
767  * Timer interval stuff now uses gettimeofday() instead of ftime()
768  *
769  * Revision 1.16  1997/06/17 04:19:16  curt
770  * More timer related tweaks with respect to view direction changes.
771  *
772  * Revision 1.15  1997/06/17 03:41:10  curt
773  * Nonsignal based interval timing is now working.
774  * This would be a good time to look at cleaning up the code structure a bit.
775  *
776  * Revision 1.14  1997/06/16 19:32:51  curt
777  * Starting to add general timer support.
778  *
779  * Revision 1.13  1997/06/02 03:40:06  curt
780  * A tiny bit more view tweaking.
781  *
782  * Revision 1.12  1997/06/02 03:01:38  curt
783  * Working on views (side, front, back, transitions, etc.)
784  *
785  * Revision 1.11  1997/05/31 19:16:25  curt
786  * Elevator trim added.
787  *
788  * Revision 1.10  1997/05/31 04:13:52  curt
789  * WE CAN NOW FLY!!!
790  *
791  * Continuing work on the LaRCsim flight model integration.
792  * Added some MSFS-like keyboard input handling.
793  *
794  * Revision 1.9  1997/05/30 19:27:01  curt
795  * The LaRCsim flight model is starting to look like it is working.
796  *
797  * Revision 1.8  1997/05/30 03:54:10  curt
798  * Made a bit more progress towards integrating the LaRCsim flight model.
799  *
800  * Revision 1.7  1997/05/29 22:39:49  curt
801  * Working on incorporating the LaRCsim flight model.
802  *
803  * Revision 1.6  1997/05/29 12:31:39  curt
804  * Minor tweaks, moving towards general flight model integration.
805  *
806  * Revision 1.5  1997/05/29 02:33:23  curt
807  * Updated to reflect changing interfaces in other "modules."
808  *
809  * Revision 1.4  1997/05/27 17:44:31  curt
810  * Renamed & rearranged variables and routines.   Added some initial simple
811  * timer/alarm routines so the flight model can be updated on a regular 
812  * interval.
813  *
814  * Revision 1.3  1997/05/23 15:40:25  curt
815  * Added GNU copyright headers.
816  * Fog now works!
817  *
818  * Revision 1.2  1997/05/23 00:35:12  curt
819  * Trying to get fog to work ...
820  *
821  * Revision 1.1  1997/05/21 15:57:51  curt
822  * Renamed due to added GLUT support.
823  *
824  * Revision 1.3  1997/05/19 18:22:42  curt
825  * Parameter tweaking ... starting to stub in fog support.
826  *
827  * Revision 1.2  1997/05/17 00:17:34  curt
828  * Trying to stub in support for standard OpenGL.
829  *
830  * Revision 1.1  1997/05/16 16:05:52  curt
831  * Initial revision.
832  *
833  */