]> git.mxchange.org Git - flightgear.git/blob - Main/GLUTmain.c
Organizational tweaking.
[flightgear.git] / Main / GLUTmain.c
1 /**************************************************************************
2  * GLmain.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 #include <stdio.h>
28
29 #ifdef WIN32
30 #  include <windows.h>                     
31 #endif
32
33 #ifdef GLUT
34     #include <GL/glut.h>
35     #include "GLUTkey.h"
36 #endif
37
38 #include "../constants.h"
39
40 #include "../Aircraft/aircraft.h"
41 #include "../Scenery/mesh.h"
42 #include "../Scenery/scenery.h"
43 #include "../Math/fg_random.h"
44 #include "../Math/mat3.h"
45 #include "../Math/polar.h"
46 #include "../Time/fg_timer.h"
47 #include "../Weather/weather.h"
48
49
50 /* This is a record containing all the info for the aircraft currently
51    being operated */
52 struct aircraft_params current_aircraft;
53
54 /* view parameters */
55 static GLfloat win_ratio = 1.0;
56
57 /* sun direction */
58 static GLfloat sun_vec[4] = {0.2948, 0.7816, -0.5498, 0.0 };
59
60 /* temporary hack */
61 /* extern struct mesh *mesh_ptr; */
62 /* Function prototypes */
63 /* GLint fgSceneryCompile_OLD(); */
64 /* static void fgSceneryDraw_OLD(); */
65
66 /* pointer to scenery structure */
67 /* static GLint scenery, runway; */
68
69 /* Another hack */
70 double fogDensity = 60000.0; /* in meters */
71 double view_offset = 0.0;
72 double goal_view_offset = 0.0;
73
74 /* Another hack */
75 #define DEFAULT_TIMER_HZ 20
76 #define DEFAULT_MULTILOOP 6
77 #define DEFAULT_MODEL_HZ (DEFAULT_TIMER_HZ * DEFAULT_MULTILOOP)
78
79 double Simtime;
80
81 /* Another hack */
82 int use_signals = 0;
83
84
85 /**************************************************************************
86  * fgInitVisuals() -- Initialize various GL/view parameters
87  **************************************************************************/
88
89 static void fgInitVisuals() {
90     /* if the 4th field is 0.0, this specifies a direction ... */
91     static GLfloat fogColor[4] = {0.65, 0.65, 0.85, 1.0};
92     
93     glEnable( GL_DEPTH_TEST );
94     /* glFrontFace(GL_CW); */
95     glEnable( GL_CULL_FACE );
96
97     /* If enabled, normal vectors specified with glNormal are scaled
98        to unit length after transformation.  See glNormal. */
99     glEnable( GL_NORMALIZE );
100
101     glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
102     glEnable( GL_LIGHTING );
103     glEnable( GL_LIGHT0 );
104
105     glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
106
107     glEnable( GL_FOG );
108     glFogi (GL_FOG_MODE, GL_LINEAR);
109     /* glFogf (GL_FOG_START, 1.0); */
110     glFogf (GL_FOG_END, fogDensity);
111     glFogfv (GL_FOG_COLOR, fogColor);
112     /* glFogf (GL_FOG_DENSITY, fogDensity); */
113     /* glHint (GL_FOG_HINT, GL_FASTEST); */
114
115     glClearColor(0.6, 0.6, 0.9, 1.0);
116 }
117
118
119 /**************************************************************************
120  * Update the view volume, position, and orientation
121  **************************************************************************/
122
123 static void fgUpdateViewParams() {
124     struct fgCartesianPoint view_pos /*, alt_up */;
125     struct flight_params *f;
126     MAT3mat R, TMP, UP, LOCAL, VIEW;
127     MAT3vec vec, view_up, forward, view_forward, local_up;
128
129     f = &current_aircraft.flight;
130
131     /* Tell GL we are about to modify the projection parameters */
132     glMatrixMode(GL_PROJECTION);
133     glLoadIdentity();
134     gluPerspective(45.0, 1.0/win_ratio, 1.0, 200000.0);
135
136     glMatrixMode(GL_MODELVIEW);
137     glLoadIdentity();
138     
139     /* calculate view position in current FG view coordinate system */
140     view_pos = fgPolarToCart(FG_Longitude, FG_Lat_geocentric, 
141                              FG_Radius_to_vehicle * FEET_TO_METER + 1.0);
142     printf("View pos = %.4f, %.4f, %.4f\n", view_pos.x, view_pos.y, view_pos.z);
143
144     /* Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw) */
145     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
146     MAT3rotate(R, vec, FG_Phi);
147     /* printf("Roll matrix\n"); */
148     /* MAT3print(R, stdout); */
149
150     MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
151     /* MAT3mult_vec(vec, vec, R); */
152     MAT3rotate(TMP, vec, FG_Theta);
153     /* printf("Pitch matrix\n"); */
154     /* MAT3print(TMP, stdout); */
155     MAT3mult(R, R, TMP);
156
157     MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
158     /* MAT3mult_vec(vec, vec, R); */
159     /* MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); */
160     MAT3rotate(TMP, vec, -FG_Psi);
161     /* printf("Yaw matrix\n");
162     MAT3print(TMP, stdout); */
163     MAT3mult(LOCAL, R, TMP);
164     /* printf("LOCAL matrix\n"); */
165     /* MAT3print(LOCAL, stdout); */
166
167     /* Derive the local UP transformation matrix based on *geodetic*
168      * coordinates */
169     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
170     MAT3rotate(R, vec, FG_Longitude);     /* R = rotate about Z axis */
171     /* printf("Longitude matrix\n"); */
172     /* MAT3print(R, stdout); */
173
174     MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
175     MAT3mult_vec(vec, vec, R);
176     MAT3rotate(TMP, vec, -FG_Latitude);  /* TMP = rotate about X axis */
177     /* printf("Latitude matrix\n"); */
178     /* MAT3print(TMP, stdout); */
179
180     MAT3mult(UP, R, TMP);
181     /* printf("Local up matrix\n"); */
182     /* MAT3print(UP, stdout); */
183
184     MAT3_SET_VEC(local_up, 1.0, 0.0, 0.0);
185     MAT3mult_vec(local_up, local_up, UP);
186
187     printf("    Local Up = (%.4f, %.4f, %.4f)\n", local_up[0], local_up[1], 
188            local_up[2]);
189     
190     /* Alternative method to Derive local up vector based on
191      * *geodetic* coordinates */
192     /* alt_up = fgPolarToCart(FG_Longitude, FG_Latitude, 1.0); */
193     /* printf("    Alt Up = (%.4f, %.4f, %.4f)\n", 
194        alt_up.x, alt_up.y, alt_up.z); */
195
196     /* Derive the VIEW matrix */
197     MAT3mult(VIEW, LOCAL, UP);
198     /* printf("VIEW matrix\n"); */
199     /* MAT3print(VIEW, stdout); */
200
201     /* generate the current up, forward, and fwrd-view vectors */
202     MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
203     MAT3mult_vec(view_up, vec, VIEW);
204
205     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
206     MAT3mult_vec(forward, vec, VIEW);
207     printf("Forward vector is (%.2f,%.2f,%.2f)\n", forward[0], forward[1], 
208            forward[2]);
209
210     MAT3rotate(TMP, view_up, view_offset);
211     MAT3mult_vec(view_forward, forward, TMP);
212
213     gluLookAt(view_pos.x, view_pos.y, view_pos.z,
214               view_pos.x + view_forward[0], view_pos.y + view_forward[1], 
215               view_pos.z + view_forward[2],
216               view_up[0], view_up[1], view_up[2]);
217
218     glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
219 }
220
221
222 /**************************************************************************
223  * Update all Visuals (redraws anything graphics related)
224  **************************************************************************/
225
226 static void fgUpdateVisuals( void ) {
227     /* update view volume parameters */
228     fgUpdateViewParams();
229
230     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
231
232     /* Tell GL we are switching to model view parameters */
233     glMatrixMode(GL_MODELVIEW);
234     /* glLoadIdentity(); */
235
236     /* draw scenery */
237     fgSceneryRender();
238
239     #ifdef GLUT
240       glutSwapBuffers();
241     #endif
242 }
243
244
245 /**************************************************************************
246  * Update internal time dependent calculations (i.e. flight model)
247  **************************************************************************/
248
249 void fgUpdateTimeDepCalcs(int multi_loop) {
250     struct flight_params *f;
251     int i;
252
253     f = &current_aircraft.flight;
254
255     /* update the flight model */
256     if ( multi_loop < 0 ) {
257         multi_loop = DEFAULT_MULTILOOP;
258     }
259
260     /* printf("updating flight model x %d\n", multi_loop); */
261     fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
262
263     for ( i = 0; i < multi_loop; i++ ) {
264         if ( fabs(goal_view_offset - view_offset) < 0.05 ) {
265             view_offset = goal_view_offset;
266             break;
267         } else {
268             /* move view_offset towards goal_view_offset */
269             if ( goal_view_offset > view_offset ) {
270                 if ( goal_view_offset - view_offset < FG_PI ) {
271                     view_offset += 0.01;
272                 } else {
273                     view_offset -= 0.01;
274                 }
275             } else {
276                 if ( view_offset - goal_view_offset < FG_PI ) {
277                     view_offset -= 0.01;
278                 } else {
279                     view_offset += 0.01;
280                 }
281             }
282             if ( view_offset > FG_2PI ) {
283                 view_offset -= FG_2PI;
284             } else if ( view_offset < 0 ) {
285                 view_offset += FG_2PI;
286             }
287         }
288     }
289 }
290
291
292 void fgInitTimeDepCalcs() {
293     /* initialize timer */
294
295 #ifdef USE_ITIMER
296     fgTimerInit( 1.0 / DEFAULT_TIMER_HZ, fgUpdateTimeDepCalcs );
297 #endif USE_ITIMER
298
299 }
300
301
302 /**************************************************************************
303  * Scenery management routines
304  **************************************************************************/
305
306 /* static void fgSceneryInit_OLD() { */
307     /* make scenery */
308 /*     scenery = fgSceneryCompile_OLD();
309     runway = fgRunwayHack_OLD(0.69, 53.07);
310 } */
311
312
313 /* create the scenery */
314 /* GLint fgSceneryCompile_OLD() {
315     GLint scenery;
316
317     scenery = mesh2GL(mesh_ptr_OLD);
318
319     return(scenery);
320 }
321 */
322
323 /* hack in a runway */
324 /* GLint fgRunwayHack_OLD(double width, double length) {
325     static GLfloat concrete[4] = { 0.5, 0.5, 0.5, 1.0 };
326     static GLfloat line[4]     = { 0.9, 0.9, 0.9, 1.0 };
327     int i;
328     int num_lines = 16;
329     float line_len, line_width_2, cur_pos;
330
331     runway = glGenLists(1);
332     glNewList(runway, GL_COMPILE);
333     */
334     /* draw concrete */
335 /*    glBegin(GL_POLYGON);
336     glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, concrete );
337     glNormal3f(0.0, 0.0, 1.0);
338
339     glVertex3d( 0.0,   -width/2.0, 0.0);
340     glVertex3d( 0.0,    width/2.0, 0.0);
341     glVertex3d(length,  width/2.0, 0.0);
342     glVertex3d(length, -width/2.0, 0.0);
343     glEnd();
344     */
345     /* draw center line */
346 /*    glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, line );
347     line_len = length / ( 2 * num_lines + 1);
348     printf("line_len = %.3f\n", line_len);
349     line_width_2 = 0.02;
350     cur_pos = line_len;
351     for ( i = 0; i < num_lines; i++ ) {
352         glBegin(GL_POLYGON);
353         glVertex3d( cur_pos, -line_width_2, 0.005);
354         glVertex3d( cur_pos,  line_width_2, 0.005);
355         cur_pos += line_len;
356         glVertex3d( cur_pos,  line_width_2, 0.005);
357         glVertex3d( cur_pos, -line_width_2, 0.005);
358         cur_pos += line_len;
359         glEnd();
360     }
361
362     glEndList();
363
364     return(runway);
365 }
366 */
367
368 /* draw the scenery */
369 /*static void fgSceneryDraw_OLD() {
370     static float z = 32.35;
371
372     glPushMatrix();
373
374     glCallList(scenery);
375
376     printf("*** Drawing runway at %.2f\n", z);
377
378     glTranslatef( -398391.28, 120070.41, 32.35);
379     glRotatef(170.0, 0.0, 0.0, 1.0);
380     glCallList(runway);
381
382     glPopMatrix();
383 }
384 */
385
386 /* What should we do when we have nothing else to do?  How about get
387  * ready for the next move and update the display? */
388 static void fgMainLoop( void ) {
389     static int remainder = 0;
390     int elapsed, multi_loop;
391     double rough_elev;
392     struct flight_params *f;
393
394     f = &current_aircraft.flight;
395
396     elapsed = fgGetTimeInterval();
397     printf("Time interval is = %d, previous remainder is = %d\n", elapsed, 
398            remainder);
399     printf("--> Frame rate is = %.2f\n", 1000.0 / (float)elapsed);
400     elapsed += remainder;
401
402     multi_loop = ((float)elapsed * 0.001) * DEFAULT_MODEL_HZ;
403     remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
404     printf("Model iterations needed = %d, new remainder = %d\n", multi_loop, 
405            remainder);
406
407     aircraft_debug(1);
408     fgUpdateVisuals();
409
410     if ( ! use_signals ) {
411         /* flight model */
412         fgUpdateTimeDepCalcs(multi_loop);
413     }
414
415     /* I'm just sticking this here for now, it should probably move 
416      * eventually */
417     rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC, 
418                                FG_Latitude  * RAD_TO_ARCSEC);
419     printf("Ground elevation is %.2f meters here.\n", rough_elev);
420     /* FG_Runway_altitude = rough_elev * METER_TO_FEET; */
421
422     if ( FG_Altitude * FEET_TO_METER < rough_elev + 3.758099) {
423         /* set this here, otherwise if we set runway height above our
424            current height we get a really nasty bounce. */
425         FG_Runway_altitude = FG_Altitude - 3.758099;
426
427         /* now set aircraft altitude above ground */
428         FG_Altitude = rough_elev * METER_TO_FEET + 3.758099;
429         printf("<*> resetting altitude to %.0f meters\n", 
430                FG_Altitude * FEET_TO_METER);
431     }
432
433     /* update the weather for our current position */
434     fgWeatherUpdate(FG_Longitude * RAD_TO_ARCSEC, 
435                     FG_Latitude * RAD_TO_ARCSEC, 
436                     FG_Altitude * FEET_TO_METER);
437 }
438
439
440 /**************************************************************************
441  * Handle new window size or exposure
442  **************************************************************************/
443
444 static void fgReshape( int width, int height ) {
445     /* Do this so we can call fgReshape(0,0) ourselves without having to know
446      * what the values of width & height are. */
447     if ( (height > 0) && (width > 0) ) {
448         win_ratio = (GLfloat) height / (GLfloat) width;
449     }
450
451     /* Inform gl of our view window size */
452     glViewport(0, 0, (GLint)width, (GLint)height);
453
454     fgUpdateViewParams();
455     
456     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
457 }
458
459
460 /**************************************************************************
461  * Main ...
462  **************************************************************************/
463
464 int main( int argc, char *argv[] ) {
465     struct flight_params *f;
466     double rough_elev;
467
468     f = &current_aircraft.flight;
469
470     printf("Flight Gear: prototype code to test OpenGL, LaRCsim, and VRML\n\n");
471
472
473     /**********************************************************************
474      * Initialize the Window/Graphics environment.
475      **********************************************************************/
476
477     #ifdef GLUT
478       /* initialize GLUT */
479       glutInit(&argc, argv);
480
481       /* Define Display Parameters */
482       glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
483
484       /* Define initial window size */
485       glutInitWindowSize(640, 480);
486
487       /* Initialize windows */
488       glutCreateWindow("Flight Gear");
489     #endif
490
491     /* seed the random number generater */
492     fg_srandom();
493
494     /* setup view parameters, only makes GL calls */
495     fgInitVisuals();
496
497
498     /****************************************************************
499      * The following section sets up the flight model EOM parameters and 
500      * should really be read in from one or more files.
501      ****************************************************************/
502
503     /* Globe Aiport, AZ */
504     FG_Runway_altitude = 3234.5;
505     FG_Runway_latitude = 120070.41;
506     FG_Runway_longitude = -398391.28;
507     FG_Runway_heading = 102.0 * DEG_TO_RAD;
508
509     /* Initial Position */
510     FG_Latitude  = (  120070.41 / 3600.0 ) * DEG_TO_RAD;
511     FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
512     FG_Altitude = FG_Runway_altitude + 3.758099;
513
514     /* FG_Latitude  = 0.0; */
515     /* FG_Longitude = 0.0; */
516     /* FG_Altitude = 15000.0; */
517
518     printf("Initial position is: (%.4f, %.4f, %.2f)\n", FG_Latitude, 
519            FG_Longitude, FG_Altitude);
520
521       /* Initial Velocity */
522     FG_V_north = 0.0 /*  7.287719E+00 */;
523     FG_V_east  = 0.0 /*  1.521770E+03 */;
524     FG_V_down  = 0.0 /* -1.265722E-05 */;
525
526     /* Initial Orientation */
527     FG_Phi   = -2.658474E-06;
528     FG_Theta =  7.401790E-03;
529     /* FG_Psi   =  270.0 * DEG_TO_RAD; */
530     FG_Psi   =  0.0 * DEG_TO_RAD;
531
532     /* Initial Angular B rates */
533     FG_P_body = 7.206685E-05;
534     FG_Q_body = 0.000000E+00;
535     FG_R_body = 9.492658E-05;
536
537     FG_Earth_position_angle = 0.000000E+00;
538
539     /* Mass properties and geometry values */
540     FG_Mass = 8.547270E+01;
541     FG_I_xx = 1.048000E+03;
542     FG_I_yy = 3.000000E+03;
543     FG_I_zz = 3.530000E+03;
544     FG_I_xz = 0.000000E+00;
545
546     /* CG position w.r.t. ref. point */
547     FG_Dx_cg = 0.000000E+00;
548     FG_Dy_cg = 0.000000E+00;
549     FG_Dz_cg = 0.000000E+00;
550
551     /* Set initial position and slew parameters */
552     /* fgSlewInit(-398391.3, 120070.41, 244, 3.1415); */ /* GLOBE Airport */
553     /* fgSlewInit(-335340,162540, 15, 4.38); */
554     /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
555
556    /* Initialize the Scenery Management system */
557     fgSceneryInit();
558
559     /* Tell the Scenery Management system where we are so it can load
560      * the correct scenery data */
561     fgSceneryUpdate(FG_Latitude, FG_Longitude, FG_Altitude);
562
563     /* I'm just sticking this here for now, it should probably move 
564      * eventually */
565     rough_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0, 
566                                FG_Latitude  * RAD_TO_DEG * 3600.0);
567     printf("Ground elevation is %.2f meters here.\n", rough_elev);
568     if ( rough_elev > -9990.0 ) {
569         FG_Runway_altitude = rough_elev * METER_TO_FEET;
570     }
571
572     if ( FG_Altitude < FG_Runway_altitude ) {
573         FG_Altitude = FG_Runway_altitude + 3.758099;
574     }
575     /* end of thing that I just stuck in that I should probably move */
576
577     /* Initialize the flight model data structures base on above values */
578     fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
579
580     if ( use_signals ) {
581         /* init timer routines, signals, etc.  Arrange for an alarm
582            signal to be generated, etc. */
583         fgInitTimeDepCalcs();
584     }
585
586     /* Initialize the weather modeling subsystem */
587     fgWeatherInit();
588
589     /**********************************************************************
590      * Initialize the Event Handlers.
591      **********************************************************************/
592
593     #ifdef GLUT
594       /* call fgReshape() on window resizes */
595       glutReshapeFunc( fgReshape );
596
597       /* call key() on keyboard event */
598       glutKeyboardFunc( GLUTkey );
599       glutSpecialFunc( GLUTspecialkey );
600
601       /* call fgMainLoop() whenever there is nothing else to do */
602       glutIdleFunc( fgMainLoop );
603
604       /* draw the scene */
605       glutDisplayFunc( fgUpdateVisuals );
606
607       /* pass control off to the GLUT event handler */
608       glutMainLoop();
609     #endif
610
611     return(0);
612 }
613
614
615 #ifdef NO_PRINTF
616   #include <stdarg.h>
617   int printf (const char *format, ...) {
618   }
619 #endif
620
621
622 /* $Log$
623 /* Revision 1.2  1997/08/04 20:25:15  curt
624 /* Organizational tweaking.
625 /*
626  * Revision 1.1  1997/08/02 18:45:00  curt
627  * Renamed GLmain.c GLUTmain.c
628  *
629  * Revision 1.43  1997/08/02 16:23:47  curt
630  * Misc. tweaks.
631  *
632  * Revision 1.42  1997/08/01 19:43:33  curt
633  * Making progress with coordinate system overhaul.
634  *
635  * Revision 1.41  1997/07/31 22:52:37  curt
636  * Working on redoing internal coordinate systems & scenery transformations.
637  *
638  * Revision 1.40  1997/07/30 16:12:42  curt
639  * Moved fg_random routines from Util/ to Math/
640  *
641  * Revision 1.39  1997/07/21 14:45:01  curt
642  * Minor tweaks.
643  *
644  * Revision 1.38  1997/07/19 23:04:47  curt
645  * Added an initial weather section.
646  *
647  * Revision 1.37  1997/07/19 22:34:02  curt
648  * Moved PI definitions to ../constants.h
649  * Moved random() stuff to ../Utils/ and renamed fg_random()
650  *
651  * Revision 1.36  1997/07/18 23:41:25  curt
652  * Tweaks for building with Cygnus Win32 compiler.
653  *
654  * Revision 1.35  1997/07/18 14:28:34  curt
655  * Hacked in some support for wind/turbulence.
656  *
657  * Revision 1.34  1997/07/16 20:04:48  curt
658  * Minor tweaks to aid Win32 port.
659  *
660  * Revision 1.33  1997/07/12 03:50:20  curt
661  * Added an #include <Windows32/Base.h> to help compiling for Win32
662  *
663  * Revision 1.32  1997/07/11 03:23:18  curt
664  * Solved some scenery display/orientation problems.  Still have a positioning
665  * (or transformation?) problem.
666  *
667  * Revision 1.31  1997/07/11 01:29:58  curt
668  * More tweaking of terrian floor.
669  *
670  * Revision 1.30  1997/07/10 04:26:37  curt
671  * We now can interpolated ground elevation for any position in the grid.  We
672  * can use this to enforce a "hard" ground.  We still need to enforce some
673  * bounds checking so that we don't try to lookup data points outside the
674  * grid data set.
675  *
676  * Revision 1.29  1997/07/09 21:31:12  curt
677  * Working on making the ground "hard."
678  *
679  * Revision 1.28  1997/07/08 18:20:12  curt
680  * Working on establishing a hard ground.
681  *
682  * Revision 1.27  1997/07/07 20:59:49  curt
683  * Working on scenery transformations to enable us to fly fluidly over the
684  * poles with no discontinuity/distortion in scenery.
685  *
686  * Revision 1.26  1997/07/05 20:43:34  curt
687  * renamed mat3 directory to Math so we could add other math related routines.
688  *
689  * Revision 1.25  1997/06/29 21:19:17  curt
690  * Working on scenery management system.
691  *
692  * Revision 1.24  1997/06/26 22:14:53  curt
693  * Beginning work on a scenery management system.
694  *
695  * Revision 1.23  1997/06/26 19:08:33  curt
696  * Restructuring make, adding automatic "make dep" support.
697  *
698  * Revision 1.22  1997/06/25 15:39:47  curt
699  * Minor changes to compile with rsxnt/win32.
700  *
701  * Revision 1.21  1997/06/22 21:44:41  curt
702  * Working on intergrating the VRML (subset) parser.
703  *
704  * Revision 1.20  1997/06/21 17:12:53  curt
705  * Capitalized subdirectory names.
706  *
707  * Revision 1.19  1997/06/18 04:10:31  curt
708  * A couple more runway tweaks ...
709  *
710  * Revision 1.18  1997/06/18 02:21:24  curt
711  * Hacked in a runway
712  *
713  * Revision 1.17  1997/06/17 16:51:58  curt
714  * Timer interval stuff now uses gettimeofday() instead of ftime()
715  *
716  * Revision 1.16  1997/06/17 04:19:16  curt
717  * More timer related tweaks with respect to view direction changes.
718  *
719  * Revision 1.15  1997/06/17 03:41:10  curt
720  * Nonsignal based interval timing is now working.
721  * This would be a good time to look at cleaning up the code structure a bit.
722  *
723  * Revision 1.14  1997/06/16 19:32:51  curt
724  * Starting to add general timer support.
725  *
726  * Revision 1.13  1997/06/02 03:40:06  curt
727  * A tiny bit more view tweaking.
728  *
729  * Revision 1.12  1997/06/02 03:01:38  curt
730  * Working on views (side, front, back, transitions, etc.)
731  *
732  * Revision 1.11  1997/05/31 19:16:25  curt
733  * Elevator trim added.
734  *
735  * Revision 1.10  1997/05/31 04:13:52  curt
736  * WE CAN NOW FLY!!!
737  *
738  * Continuing work on the LaRCsim flight model integration.
739  * Added some MSFS-like keyboard input handling.
740  *
741  * Revision 1.9  1997/05/30 19:27:01  curt
742  * The LaRCsim flight model is starting to look like it is working.
743  *
744  * Revision 1.8  1997/05/30 03:54:10  curt
745  * Made a bit more progress towards integrating the LaRCsim flight model.
746  *
747  * Revision 1.7  1997/05/29 22:39:49  curt
748  * Working on incorporating the LaRCsim flight model.
749  *
750  * Revision 1.6  1997/05/29 12:31:39  curt
751  * Minor tweaks, moving towards general flight model integration.
752  *
753  * Revision 1.5  1997/05/29 02:33:23  curt
754  * Updated to reflect changing interfaces in other "modules."
755  *
756  * Revision 1.4  1997/05/27 17:44:31  curt
757  * Renamed & rearranged variables and routines.   Added some initial simple
758  * timer/alarm routines so the flight model can be updated on a regular 
759  * interval.
760  *
761  * Revision 1.3  1997/05/23 15:40:25  curt
762  * Added GNU copyright headers.
763  * Fog now works!
764  *
765  * Revision 1.2  1997/05/23 00:35:12  curt
766  * Trying to get fog to work ...
767  *
768  * Revision 1.1  1997/05/21 15:57:51  curt
769  * Renamed due to added GLUT support.
770  *
771  * Revision 1.3  1997/05/19 18:22:42  curt
772  * Parameter tweaking ... starting to stub in fog support.
773  *
774  * Revision 1.2  1997/05/17 00:17:34  curt
775  * Trying to stub in support for standard OpenGL.
776  *
777  * Revision 1.1  1997/05/16 16:05:52  curt
778  * Initial revision.
779  *
780  */