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