]> git.mxchange.org Git - flightgear.git/blob - Main/GLUTmain.c
Changes due to changing sunpos interface.
[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_time.h"
48 #include "../Time/fg_timer.h"
49 #include "../Time/sunpos.h"
50 #include "../Weather/weather.h"
51
52
53 /* This is a record containing all the info for the aircraft currently
54    being operated */
55 struct aircraft_params current_aircraft;
56
57 /* view parameters */
58 static GLfloat win_ratio = 1.0;
59
60 /* sun direction */
61 static GLfloat sun_vec[4] = {1.0, 0.0, 0.0, 0.0 };
62
63 /* temporary hack */
64 /* extern struct mesh *mesh_ptr; */
65 /* Function prototypes */
66 /* GLint fgSceneryCompile_OLD(); */
67 /* static void fgSceneryDraw_OLD(); */
68
69 /* pointer to scenery structure */
70 /* static GLint scenery, runway; */
71
72 /* Another hack */
73 double fogDensity = 60000.0; /* in meters */
74 double view_offset = 0.0;
75 double goal_view_offset = 0.0;
76
77 /* Another hack */
78 #define DEFAULT_TIMER_HZ 20
79 #define DEFAULT_MULTILOOP 6
80 #define DEFAULT_MODEL_HZ (DEFAULT_TIMER_HZ * DEFAULT_MULTILOOP)
81
82 double Simtime;
83
84 /* Another hack */
85 int use_signals = 0;
86
87
88 /**************************************************************************
89  * fgInitVisuals() -- Initialize various GL/view parameters
90  **************************************************************************/
91
92 static void fgInitVisuals() {
93     /* if the 4th field is 0.0, this specifies a direction ... */
94     static GLfloat fogColor[4] = {0.65, 0.65, 0.85, 1.0};
95     
96     glEnable( GL_DEPTH_TEST );
97     /* glFrontFace(GL_CW); */
98     glEnable( GL_CULL_FACE );
99
100     /* If enabled, normal vectors specified with glNormal are scaled
101        to unit length after transformation.  See glNormal. */
102     glEnable( GL_NORMALIZE );
103
104     glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
105     glEnable( GL_LIGHTING );
106     glEnable( GL_LIGHT0 );
107
108     glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
109
110     glEnable( GL_FOG );
111     glFogi (GL_FOG_MODE, GL_LINEAR);
112     /* glFogf (GL_FOG_START, 1.0); */
113     glFogf (GL_FOG_END, fogDensity);
114     glFogfv (GL_FOG_COLOR, fogColor);
115     /* glFogf (GL_FOG_DENSITY, fogDensity); */
116     /* glHint (GL_FOG_HINT, GL_FASTEST); */
117
118     glClearColor(0.6, 0.6, 0.9, 1.0);
119 }
120
121
122 /**************************************************************************
123  * Update the view volume, position, and orientation
124  **************************************************************************/
125
126 static void fgUpdateViewParams() {
127     struct fgCartesianPoint view_pos /*, alt_up */;
128     struct flight_params *f;
129     MAT3mat R, TMP, UP, LOCAL, VIEW;
130     MAT3vec vec, view_up, forward, view_forward, local_up;
131
132     f = &current_aircraft.flight;
133
134     /* Tell GL we are about to modify the projection parameters */
135     glMatrixMode(GL_PROJECTION);
136     glLoadIdentity();
137     gluPerspective(45.0, 1.0/win_ratio, 1.0, 200000.0);
138
139     glMatrixMode(GL_MODELVIEW);
140     glLoadIdentity();
141     
142     /* calculate view position in current FG view coordinate system */
143     view_pos = fgPolarToCart(FG_Longitude, FG_Lat_geocentric, 
144                              FG_Radius_to_vehicle * FEET_TO_METER + 1.0);
145     view_pos.x -= scenery.center.x;
146     view_pos.y -= scenery.center.y;
147     view_pos.z -= scenery.center.z;
148
149     printf("View pos = %.4f, %.4f, %.4f\n", view_pos.x, view_pos.y, view_pos.z);
150
151     /* Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw) */
152     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
153     MAT3rotate(R, vec, FG_Phi);
154     /* printf("Roll matrix\n"); */
155     /* MAT3print(R, stdout); */
156
157     MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
158     /* MAT3mult_vec(vec, vec, R); */
159     MAT3rotate(TMP, vec, FG_Theta);
160     /* printf("Pitch matrix\n"); */
161     /* MAT3print(TMP, stdout); */
162     MAT3mult(R, R, TMP);
163
164     MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
165     /* MAT3mult_vec(vec, vec, R); */
166     /* MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); */
167     MAT3rotate(TMP, vec, -FG_Psi);
168     /* printf("Yaw matrix\n");
169     MAT3print(TMP, stdout); */
170     MAT3mult(LOCAL, R, TMP);
171     /* printf("LOCAL matrix\n"); */
172     /* MAT3print(LOCAL, stdout); */
173
174     /* Derive the local UP transformation matrix based on *geodetic*
175      * coordinates */
176     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
177     MAT3rotate(R, vec, FG_Longitude);     /* R = rotate about Z axis */
178     /* printf("Longitude matrix\n"); */
179     /* MAT3print(R, stdout); */
180
181     MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
182     MAT3mult_vec(vec, vec, R);
183     MAT3rotate(TMP, vec, -FG_Latitude);  /* TMP = rotate about X axis */
184     /* printf("Latitude matrix\n"); */
185     /* MAT3print(TMP, stdout); */
186
187     MAT3mult(UP, R, TMP);
188     /* printf("Local up matrix\n"); */
189     /* MAT3print(UP, stdout); */
190
191     MAT3_SET_VEC(local_up, 1.0, 0.0, 0.0);
192     MAT3mult_vec(local_up, local_up, UP);
193
194     printf("    Local Up = (%.4f, %.4f, %.4f)\n", local_up[0], local_up[1], 
195            local_up[2]);
196     
197     /* Alternative method to Derive local up vector based on
198      * *geodetic* coordinates */
199     /* alt_up = fgPolarToCart(FG_Longitude, FG_Latitude, 1.0); */
200     /* printf("    Alt Up = (%.4f, %.4f, %.4f)\n", 
201        alt_up.x, alt_up.y, alt_up.z); */
202
203     /* Derive the VIEW matrix */
204     MAT3mult(VIEW, LOCAL, UP);
205     /* printf("VIEW matrix\n"); */
206     /* MAT3print(VIEW, stdout); */
207
208     /* generate the current up, forward, and fwrd-view vectors */
209     MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
210     MAT3mult_vec(view_up, vec, VIEW);
211
212     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
213     MAT3mult_vec(forward, vec, VIEW);
214     printf("Forward vector is (%.2f,%.2f,%.2f)\n", forward[0], forward[1], 
215            forward[2]);
216
217     MAT3rotate(TMP, view_up, view_offset);
218     MAT3mult_vec(view_forward, forward, TMP);
219
220     gluLookAt(view_pos.x, view_pos.y, view_pos.z,
221               view_pos.x + view_forward[0], view_pos.y + view_forward[1], 
222               view_pos.z + view_forward[2],
223               view_up[0], view_up[1], view_up[2]);
224
225     glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
226 }
227
228
229 /**************************************************************************
230  * Update all Visuals (redraws anything graphics related)
231  **************************************************************************/
232
233 static void fgUpdateVisuals( void ) {
234     /* update view volume parameters */
235     fgUpdateViewParams();
236
237     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
238
239     /* Tell GL we are switching to model view parameters */
240     glMatrixMode(GL_MODELVIEW);
241     /* glLoadIdentity(); */
242
243     /* draw scenery */
244     fgSceneryRender();
245
246     #ifdef GLUT
247       glutSwapBuffers();
248     #endif
249 }
250
251
252 /**************************************************************************
253  * Update internal time dependent calculations (i.e. flight model)
254  **************************************************************************/
255
256 void fgUpdateTimeDepCalcs(int multi_loop) {
257     struct flight_params *f;
258     struct time_params *t;
259     int i;
260
261     f = &current_aircraft.flight;
262     t = &cur_time_params;
263
264     /* update the flight model */
265     if ( multi_loop < 0 ) {
266         multi_loop = DEFAULT_MULTILOOP;
267     }
268
269     /* printf("updating flight model x %d\n", multi_loop); */
270     fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
271
272     /* refresh shared sun position and sun_vec */
273     fgUpdateSunPos();
274
275     /* the sun position has to be translated just like everything else */
276     sun_vec[0] = t->fg_sunpos.x - scenery.center.x; 
277     sun_vec[1] = t->fg_sunpos.y - scenery.center.y;
278     sun_vec[2] = t->fg_sunpos.z - scenery.center.z;
279     /* make this a directional light source only */
280     sun_vec[3] = 0.0;
281
282     /* update the view angle */
283     for ( i = 0; i < multi_loop; i++ ) {
284         if ( fabs(goal_view_offset - view_offset) < 0.05 ) {
285             view_offset = goal_view_offset;
286             break;
287         } else {
288             /* move view_offset towards goal_view_offset */
289             if ( goal_view_offset > view_offset ) {
290                 if ( goal_view_offset - view_offset < FG_PI ) {
291                     view_offset += 0.01;
292                 } else {
293                     view_offset -= 0.01;
294                 }
295             } else {
296                 if ( view_offset - goal_view_offset < FG_PI ) {
297                     view_offset -= 0.01;
298                 } else {
299                     view_offset += 0.01;
300                 }
301             }
302             if ( view_offset > FG_2PI ) {
303                 view_offset -= FG_2PI;
304             } else if ( view_offset < 0 ) {
305                 view_offset += FG_2PI;
306             }
307         }
308     }
309 }
310
311
312 void fgInitTimeDepCalcs() {
313     /* initialize timer */
314
315 #ifdef USE_ITIMER
316     fgTimerInit( 1.0 / DEFAULT_TIMER_HZ, fgUpdateTimeDepCalcs );
317 #endif USE_ITIMER
318
319 }
320
321
322 /**************************************************************************
323  * Scenery management routines
324  **************************************************************************/
325
326 /* static void fgSceneryInit_OLD() { */
327     /* make scenery */
328 /*     scenery = fgSceneryCompile_OLD();
329     runway = fgRunwayHack_OLD(0.69, 53.07);
330 } */
331
332
333 /* create the scenery */
334 /* GLint fgSceneryCompile_OLD() {
335     GLint scenery;
336
337     scenery = mesh2GL(mesh_ptr_OLD);
338
339     return(scenery);
340 }
341 */
342
343 /* hack in a runway */
344 /* GLint fgRunwayHack_OLD(double width, double length) {
345     static GLfloat concrete[4] = { 0.5, 0.5, 0.5, 1.0 };
346     static GLfloat line[4]     = { 0.9, 0.9, 0.9, 1.0 };
347     int i;
348     int num_lines = 16;
349     float line_len, line_width_2, cur_pos;
350
351     runway = glGenLists(1);
352     glNewList(runway, GL_COMPILE);
353     */
354     /* draw concrete */
355 /*    glBegin(GL_POLYGON);
356     glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, concrete );
357     glNormal3f(0.0, 0.0, 1.0);
358
359     glVertex3d( 0.0,   -width/2.0, 0.0);
360     glVertex3d( 0.0,    width/2.0, 0.0);
361     glVertex3d(length,  width/2.0, 0.0);
362     glVertex3d(length, -width/2.0, 0.0);
363     glEnd();
364     */
365     /* draw center line */
366 /*    glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, line );
367     line_len = length / ( 2 * num_lines + 1);
368     printf("line_len = %.3f\n", line_len);
369     line_width_2 = 0.02;
370     cur_pos = line_len;
371     for ( i = 0; i < num_lines; i++ ) {
372         glBegin(GL_POLYGON);
373         glVertex3d( cur_pos, -line_width_2, 0.005);
374         glVertex3d( cur_pos,  line_width_2, 0.005);
375         cur_pos += line_len;
376         glVertex3d( cur_pos,  line_width_2, 0.005);
377         glVertex3d( cur_pos, -line_width_2, 0.005);
378         cur_pos += line_len;
379         glEnd();
380     }
381
382     glEndList();
383
384     return(runway);
385 }
386 */
387
388 /* draw the scenery */
389 /*static void fgSceneryDraw_OLD() {
390     static float z = 32.35;
391
392     glPushMatrix();
393
394     glCallList(scenery);
395
396     printf("*** Drawing runway at %.2f\n", z);
397
398     glTranslatef( -398391.28, 120070.41, 32.35);
399     glRotatef(170.0, 0.0, 0.0, 1.0);
400     glCallList(runway);
401
402     glPopMatrix();
403 }
404 */
405
406 /* What should we do when we have nothing else to do?  How about get
407  * ready for the next move and update the display? */
408 static void fgMainLoop( void ) {
409     static int remainder = 0;
410     int elapsed, multi_loop;
411     double rough_elev;
412     struct flight_params *f;
413
414     f = &current_aircraft.flight;
415
416     elapsed = fgGetTimeInterval();
417     printf("Time interval is = %d, previous remainder is = %d\n", elapsed, 
418            remainder);
419     printf("--> Frame rate is = %.2f\n", 1000.0 / (float)elapsed);
420     elapsed += remainder;
421
422     multi_loop = ((float)elapsed * 0.001) * DEFAULT_MODEL_HZ;
423     remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
424     printf("Model iterations needed = %d, new remainder = %d\n", multi_loop, 
425            remainder);
426
427     aircraft_debug(1);
428     fgUpdateVisuals();
429
430     if ( ! use_signals ) {
431         /* flight model */
432         fgUpdateTimeDepCalcs(multi_loop);
433     }
434
435     /* I'm just sticking this here for now, it should probably move 
436      * eventually */
437     rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC, 
438                                FG_Latitude  * RAD_TO_ARCSEC);
439     printf("Ground elevation is %.2f meters here.\n", rough_elev);
440     /* FG_Runway_altitude = rough_elev * METER_TO_FEET; */
441
442     if ( FG_Altitude * FEET_TO_METER < rough_elev + 3.758099) {
443         /* set this here, otherwise if we set runway height above our
444            current height we get a really nasty bounce. */
445         FG_Runway_altitude = FG_Altitude - 3.758099;
446
447         /* now set aircraft altitude above ground */
448         FG_Altitude = rough_elev * METER_TO_FEET + 3.758099;
449         printf("<*> resetting altitude to %.0f meters\n", 
450                FG_Altitude * FEET_TO_METER);
451     }
452
453     /* update the weather for our current position */
454     fgWeatherUpdate(FG_Longitude * RAD_TO_ARCSEC, 
455                     FG_Latitude * RAD_TO_ARCSEC, 
456                     FG_Altitude * FEET_TO_METER);
457 }
458
459
460 /**************************************************************************
461  * Handle new window size or exposure
462  **************************************************************************/
463
464 static void fgReshape( int width, int height ) {
465     /* Do this so we can call fgReshape(0,0) ourselves without having to know
466      * what the values of width & height are. */
467     if ( (height > 0) && (width > 0) ) {
468         win_ratio = (GLfloat) height / (GLfloat) width;
469     }
470
471     /* Inform gl of our view window size */
472     glViewport(0, 0, (GLint)width, (GLint)height);
473
474     fgUpdateViewParams();
475     
476     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
477 }
478
479
480 /**************************************************************************
481  * Main ...
482  **************************************************************************/
483
484 int main( int argc, char *argv[] ) {
485     struct flight_params *f;
486     double rough_elev;
487
488     f = &current_aircraft.flight;
489
490     printf("Flight Gear: prototype code to test OpenGL, LaRCsim, and VRML\n\n");
491
492
493     /**********************************************************************
494      * Initialize the Window/Graphics environment.
495      **********************************************************************/
496
497     #ifdef GLUT
498       /* initialize GLUT */
499       glutInit(&argc, argv);
500
501       /* Define Display Parameters */
502       glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
503
504       /* Define initial window size */
505       glutInitWindowSize(640, 480);
506
507       /* Initialize windows */
508       glutCreateWindow("Flight Gear");
509     #endif
510
511     /* seed the random number generater */
512     fg_srandom();
513
514     /* setup view parameters, only makes GL calls */
515     fgInitVisuals();
516
517
518     /****************************************************************
519      * The following section sets up the flight model EOM parameters and 
520      * should really be read in from one or more files.
521      ****************************************************************/
522
523     /* Globe Aiport, AZ */
524     FG_Runway_altitude = 3234.5;
525     FG_Runway_latitude = 120070.41;
526     FG_Runway_longitude = -398391.28;
527     FG_Runway_heading = 102.0 * DEG_TO_RAD;
528
529     /* Initial Position at GLOBE airport */
530     FG_Latitude  = (  120070.41 / 3600.0 ) * DEG_TO_RAD;
531     FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
532     FG_Altitude = FG_Runway_altitude + 3.758099;
533
534     /* Initial Position north of the city of Globe */
535     /* FG_Latitude  = (  120625.64 / 3600.0 ) * DEG_TO_RAD; */
536     /* FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD; */
537     /* FG_Altitude = 0.0 + 3.758099; */
538
539     printf("Initial position is: (%.4f, %.4f, %.2f)\n", FG_Latitude, 
540            FG_Longitude, FG_Altitude);
541
542       /* Initial Velocity */
543     FG_V_north = 0.0 /*  7.287719E+00 */;
544     FG_V_east  = 0.0 /*  1.521770E+03 */;
545     FG_V_down  = 0.0 /* -1.265722E-05 */;
546
547     /* Initial Orientation */
548     FG_Phi   = -2.658474E-06;
549     FG_Theta =  7.401790E-03;
550     FG_Psi   =  270.0 * DEG_TO_RAD;
551     /* FG_Psi   =  0.0 * DEG_TO_RAD; */
552
553     /* Initial Angular B rates */
554     FG_P_body = 7.206685E-05;
555     FG_Q_body = 0.000000E+00;
556     FG_R_body = 9.492658E-05;
557
558     FG_Earth_position_angle = 0.000000E+00;
559
560     /* Mass properties and geometry values */
561     FG_Mass = 8.547270E+01;
562     FG_I_xx = 1.048000E+03;
563     FG_I_yy = 3.000000E+03;
564     FG_I_zz = 3.530000E+03;
565     FG_I_xz = 0.000000E+00;
566
567     /* CG position w.r.t. ref. point */
568     FG_Dx_cg = 0.000000E+00;
569     FG_Dy_cg = 0.000000E+00;
570     FG_Dz_cg = 0.000000E+00;
571
572     /* Set initial position and slew parameters */
573     /* fgSlewInit(-398391.3, 120070.41, 244, 3.1415); */ /* GLOBE Airport */
574     /* fgSlewInit(-335340,162540, 15, 4.38); */
575     /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
576
577    /* Initialize the Scenery Management system */
578     fgSceneryInit();
579
580     /* Tell the Scenery Management system where we are so it can load
581      * the correct scenery data */
582     fgSceneryUpdate(FG_Latitude, FG_Longitude, FG_Altitude);
583
584     /* I'm just sticking this here for now, it should probably move 
585      * eventually */
586     rough_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0, 
587                                FG_Latitude  * RAD_TO_DEG * 3600.0);
588     printf("Ground elevation is %.2f meters here.\n", rough_elev);
589     if ( rough_elev > -9990.0 ) {
590         FG_Runway_altitude = rough_elev * METER_TO_FEET;
591     }
592
593     if ( FG_Altitude < FG_Runway_altitude ) {
594         FG_Altitude = FG_Runway_altitude + 3.758099;
595     }
596     /* end of thing that I just stuck in that I should probably move */
597
598     /* Initialize the flight model data structures base on above values */
599     fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
600
601     if ( use_signals ) {
602         /* init timer routines, signals, etc.  Arrange for an alarm
603            signal to be generated, etc. */
604         fgInitTimeDepCalcs();
605     }
606
607     /* Initialize the weather modeling subsystem */
608     fgWeatherInit();
609
610     /**********************************************************************
611      * Initialize the Event Handlers.
612      **********************************************************************/
613
614     #ifdef GLUT
615       /* call fgReshape() on window resizes */
616       glutReshapeFunc( fgReshape );
617
618       /* call key() on keyboard event */
619       glutKeyboardFunc( GLUTkey );
620       glutSpecialFunc( GLUTspecialkey );
621
622       /* call fgMainLoop() whenever there is nothing else to do */
623       glutIdleFunc( fgMainLoop );
624
625       /* draw the scene */
626       glutDisplayFunc( fgUpdateVisuals );
627
628       /* pass control off to the GLUT event handler */
629       glutMainLoop();
630     #endif
631
632     return(0);
633 }
634
635
636 #ifdef NO_PRINTF
637   #include <stdarg.h>
638   int printf (const char *format, ...) {
639   }
640 #endif
641
642
643 /* $Log$
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  */