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