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