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