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