]> git.mxchange.org Git - flightgear.git/blob - Main/views.cxx
Debugging output tweaks.
[flightgear.git] / Main / views.cxx
1 // views.cxx -- data structures and routines for managing and view
2 //               parameters.
3 //
4 // Written by Curtis Olson, started August 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 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include <Debug/fg_debug.h>
31 #include <Flight/flight.h>
32 #include <Include/fg_constants.h>
33 #include <Math/mat3.h>
34 #include <Math/polar3d.hxx>
35 #include <Math/vector.hxx>
36 #include <Scenery/scenery.hxx>
37 #include <Time/fg_time.hxx>
38
39 #include "options.hxx"
40 #include "views.hxx"
41
42
43 // This is a record containing current view parameters
44 fgVIEW current_view;
45
46
47 // Constructor
48 fgVIEW::fgVIEW( void ) {
49 }
50
51
52 // Initialize a view structure
53 void fgVIEW::Init( void ) {
54     fgPrintf( FG_VIEW, FG_INFO, "Initializing View parameters\n");
55
56     view_offset = 0.0;
57     goal_view_offset = 0.0;
58
59     winWidth = 640;  // FG_DEFAULT_WIN_WIDTH
60     winHeight = 480; // FG_DEFAULT_WIN_HEIGHT
61     win_ratio = (double) winWidth / (double) winHeight;
62     update_fov = TRUE;
63 }
64
65
66 // Update the field of view parameters
67 void fgVIEW::UpdateFOV( fgOPTIONS *o ) {
68     double fov, theta_x, theta_y;
69
70     fov = o->get_fov();
71         
72     // printf("win_ratio = %.2f\n", win_ratio);
73     // calculate sin() and cos() of fov / 2 in X direction;
74     theta_x = (fov * win_ratio * DEG_TO_RAD) / 2.0;
75     // printf("theta_x = %.2f\n", theta_x);
76     sin_fov_x = sin(theta_x);
77     cos_fov_x = cos(theta_x);
78     slope_x =  - cos_fov_x / sin_fov_x;
79     // printf("slope_x = %.2f\n", slope_x);
80
81     // calculate sin() and cos() of fov / 2 in Y direction;
82     theta_y = (fov * DEG_TO_RAD) / 2.0;
83     // printf("theta_y = %.2f\n", theta_y);
84     sin_fov_y = sin(theta_y);
85     cos_fov_y = cos(theta_y);
86     slope_y = cos_fov_y / sin_fov_y;
87     // printf("slope_y = %.2f\n", slope_y);
88 }
89
90
91 // Update the view parameters
92 void fgVIEW::Update( fgFLIGHT *f ) {
93     fgPoint3d p;
94     MAT3vec vec, forward, v0, minus_z;
95     MAT3mat R, TMP, UP, LOCAL, VIEW;
96     double ntmp;
97
98     if(update_fov == TRUE) {
99         // printf("Updating fov\n");
100         UpdateFOV(&current_options);
101         update_fov = FALSE;
102     }
103                 
104     scenery.center.x = scenery.next_center.x;
105     scenery.center.y = scenery.next_center.y;
106     scenery.center.z = scenery.next_center.z;
107
108     // printf("scenery center = %.2f %.2f %.2f\n", scenery.center.x,
109     //        scenery.center.y, scenery.center.z);
110
111     // calculate the cartesion coords of the current lat/lon/0 elev
112     p.lon = FG_Longitude;
113     p.lat = FG_Lat_geocentric;
114     p.radius = FG_Sea_level_radius * FEET_TO_METER;
115
116     cur_zero_elev = fgPolarToCart3d(p);
117
118     cur_zero_elev.x -= scenery.center.x;
119     cur_zero_elev.y -= scenery.center.y;
120     cur_zero_elev.z -= scenery.center.z;
121
122     // calculate view position in current FG view coordinate system
123     // p.lon & p.lat are already defined earlier, p.radius was set to
124     // the sea level radius, so now we add in our altitude.
125     if ( FG_Altitude * FEET_TO_METER > 
126          (scenery.cur_elev + 3.758099 * METER_TO_FEET) ) {
127         p.radius += FG_Altitude * FEET_TO_METER;
128     } else {
129         p.radius += scenery.cur_elev + 3.758099 * METER_TO_FEET;
130     }
131
132     abs_view_pos = fgPolarToCart3d(p);
133
134     view_pos.x = abs_view_pos.x - scenery.center.x;
135     view_pos.y = abs_view_pos.y - scenery.center.y;
136     view_pos.z = abs_view_pos.z - scenery.center.z;
137
138     fgPrintf( FG_VIEW, FG_DEBUG, "Absolute view pos = %.4f, %.4f, %.4f\n", 
139            abs_view_pos.x, abs_view_pos.y, abs_view_pos.z);
140     fgPrintf( FG_VIEW, FG_DEBUG, "Relative view pos = %.4f, %.4f, %.4f\n", 
141            view_pos.x, view_pos.y, view_pos.z);
142
143     // Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw)
144     // from FG_T_local_to_body[3][3]
145
146     // Question: Why is the LaRCsim matrix arranged so differently
147     // than the one we need???
148     LOCAL[0][0] = FG_T_local_to_body_33;
149     LOCAL[0][1] = -FG_T_local_to_body_32;
150     LOCAL[0][2] = -FG_T_local_to_body_31;
151     LOCAL[0][3] = 0.0;
152     LOCAL[1][0] = -FG_T_local_to_body_23;
153     LOCAL[1][1] = FG_T_local_to_body_22;
154     LOCAL[1][2] = FG_T_local_to_body_21;
155     LOCAL[1][3] = 0.0;
156     LOCAL[2][0] = -FG_T_local_to_body_13;
157     LOCAL[2][1] = FG_T_local_to_body_12;
158     LOCAL[2][2] = FG_T_local_to_body_11;
159     LOCAL[2][3] = 0.0;
160     LOCAL[3][0] = LOCAL[3][1] = LOCAL[3][2] = LOCAL[3][3] = 0.0;
161     LOCAL[3][3] = 1.0;
162     // printf("LaRCsim LOCAL matrix\n");
163     // MAT3print(LOCAL, stdout);
164
165 #ifdef OLD_LOCAL_TO_BODY_CODE
166         // old code to calculate LOCAL matrix calculated from Phi,
167         // Theta, and Psi (roll, pitch, yaw)
168
169         MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
170         MAT3rotate(R, vec, FG_Phi);
171         /* printf("Roll 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_Theta);
177         /* printf("Pitch matrix\n"); */
178         /* MAT3print(TMP, stdout); */
179         MAT3mult(R, R, TMP);
180
181         MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
182         /* MAT3mult_vec(vec, vec, R); */
183         /* MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); */
184         MAT3rotate(TMP, vec, -FG_Psi);
185         /* printf("Yaw matrix\n");
186            MAT3print(TMP, stdout); */
187         MAT3mult(LOCAL, R, TMP);
188         // printf("FG derived LOCAL matrix\n");
189         // MAT3print(LOCAL, stdout);
190 #endif // OLD_LOCAL_TO_BODY_CODE
191
192     // Derive the local UP transformation matrix based on *geodetic*
193     // coordinates
194     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
195     MAT3rotate(R, vec, FG_Longitude);     // R = rotate about Z axis
196     // printf("Longitude matrix\n");
197     // MAT3print(R, stdout);
198
199     MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
200     MAT3mult_vec(vec, vec, R);
201     MAT3rotate(TMP, vec, -FG_Latitude);  // TMP = rotate about X axis
202     // printf("Latitude matrix\n");
203     // MAT3print(TMP, stdout);
204
205     MAT3mult(UP, R, TMP);
206     // printf("Local up matrix\n");
207     // MAT3print(UP, stdout);
208
209     MAT3_SET_VEC(local_up, 1.0, 0.0, 0.0);
210     MAT3mult_vec(local_up, local_up, UP);
211
212     // printf( "Local Up = (%.4f, %.4f, %.4f)\n",
213     //         local_up[0], local_up[1], local_up[2]);
214     
215     // Alternative method to Derive local up vector based on
216     // *geodetic* coordinates
217     // alt_up = fgPolarToCart(FG_Longitude, FG_Latitude, 1.0);
218     // printf( "    Alt Up = (%.4f, %.4f, %.4f)\n", 
219     //         alt_up.x, alt_up.y, alt_up.z);
220
221     // Calculate the VIEW matrix
222     MAT3mult(VIEW, LOCAL, UP);
223     // printf("VIEW matrix\n");
224     // MAT3print(VIEW, stdout);
225
226     // generate the current up, forward, and fwrd-view vectors
227     MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
228     MAT3mult_vec(view_up, vec, VIEW);
229
230     MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
231     MAT3mult_vec(forward, vec, VIEW);
232     // printf( "Forward vector is (%.2f,%.2f,%.2f)\n", forward[0], forward[1], 
233     //         forward[2]);
234
235     MAT3rotate(TMP, view_up, view_offset);
236     MAT3mult_vec(view_forward, forward, TMP);
237
238     // make a vector to the current view position
239     MAT3_SET_VEC(v0, view_pos.x, view_pos.y, view_pos.z);
240
241     // Given a vector pointing straight down (-Z), map into onto the
242     // local plane representing "horizontal".  This should give us the
243     // local direction for moving "south".
244     MAT3_SET_VEC(minus_z, 0.0, 0.0, -1.0);
245     map_vec_onto_cur_surface_plane(local_up, v0, minus_z, surface_south);
246     MAT3_NORMALIZE_VEC(surface_south, ntmp);
247     // printf( "Surface direction directly south %.2f %.2f %.2f\n",
248     //         surface_south[0], surface_south[1], surface_south[2]);
249
250     // now calculate the surface east vector
251     MAT3rotate(TMP, view_up, FG_PI_2);
252     MAT3mult_vec(surface_east, surface_south, TMP);
253     // printf( "Surface direction directly east %.2f %.2f %.2f\n",
254     //         surface_east[0], surface_east[1], surface_east[2]);
255     // printf( "Should be close to zero = %.2f\n", 
256     //         MAT3_DOT_PRODUCT(surface_south, surface_east));
257 }
258
259
260 // Update the "World to Eye" transformation matrix
261 // This is most useful for view frustum culling
262 void fgVIEW::UpdateWorldToEye( fgFLIGHT *f ) {
263     MAT3mat R_Phi, R_Theta, R_Psi, R_Lat, R_Lon, T_view;
264     MAT3mat TMP;
265     MAT3hvec vec;
266
267     // if we have a view offset use slow way for now
268     if(fabs(view_offset)>FG_EPSILON){ 
269         // Roll Matrix
270         MAT3_SET_HVEC(vec, 0.0, 0.0, -1.0, 1.0);
271         MAT3rotate(R_Phi, vec, FG_Phi);
272         // printf("Roll matrix (Phi)\n");
273         // MAT3print(R_Phi, stdout);
274
275         // Pitch Matrix
276         MAT3_SET_HVEC(vec, 1.0, 0.0, 0.0, 1.0);
277         MAT3rotate(R_Theta, vec, FG_Theta);
278         // printf("\nPitch matrix (Theta)\n");
279         // MAT3print(R_Theta, stdout);
280
281         // Yaw Matrix
282         MAT3_SET_HVEC(vec, 0.0, -1.0, 0.0, 1.0);
283         MAT3rotate(R_Psi, vec, FG_Psi + FG_PI - view_offset );
284         // printf("\nYaw matrix (Psi)\n");
285         // MAT3print(R_Psi, stdout);
286
287         // aircraft roll/pitch/yaw
288         MAT3mult(TMP, R_Phi, R_Theta);
289         MAT3mult(AIRCRAFT, TMP, R_Psi);
290
291     } else { // JUST USE LOCAL_TO_BODY  NHV 5/25/98
292         // hey this is even different then LOCAL[][] above ??
293          
294         AIRCRAFT[0][0] = -FG_T_local_to_body_22;
295         AIRCRAFT[0][1] = -FG_T_local_to_body_23;
296         AIRCRAFT[0][2] = FG_T_local_to_body_21;
297         AIRCRAFT[0][3] = 0.0;
298         AIRCRAFT[1][0] = FG_T_local_to_body_32;
299         AIRCRAFT[1][1] = FG_T_local_to_body_33;
300         AIRCRAFT[1][2] = -FG_T_local_to_body_31;
301         AIRCRAFT[1][3] = 0.0;
302         AIRCRAFT[2][0] = FG_T_local_to_body_12;
303         AIRCRAFT[2][1] = FG_T_local_to_body_13;
304         AIRCRAFT[2][2] = -FG_T_local_to_body_11;
305         AIRCRAFT[2][3] = 0.0;
306         AIRCRAFT[3][0] = AIRCRAFT[3][1] = AIRCRAFT[3][2] = AIRCRAFT[3][3] = 0.0;
307         AIRCRAFT[3][3] = 1.0;
308
309         // ??? SOMETHING LIKE THIS SHOULD WORK    NHV
310         // Rotate about LOCAL_UP  (AIRCRAFT[2][])
311         // MAT3_SET_HVEC(vec, AIRCRAFT[2][0], AIRCRAFT[2][1],
312         //                        AIRCRAFT[2][2], AIRCRAFT[2][3]);
313         // MAT3rotate(TMP, vec, FG_PI - view_offset );
314         // MAT3mult(AIRCRAFT, AIRCRAFT, TMP);
315     }
316     // printf("\naircraft roll pitch yaw\n");
317     // MAT3print(AIRCRAFT, stdout);
318
319     // View position in scenery centered coordinates
320     MAT3_SET_HVEC(vec, view_pos.x, view_pos.y, view_pos.z, 1.0);
321     MAT3translate(T_view, vec);
322     // printf("\nTranslation matrix\n");
323     // MAT3print(T_view, stdout);
324
325     // Latitude
326     MAT3_SET_HVEC(vec, 1.0, 0.0, 0.0, 1.0);
327     // R_Lat = rotate about X axis
328     MAT3rotate(R_Lat, vec, FG_Latitude);
329     // printf("\nLatitude matrix\n");
330     // MAT3print(R_Lat, stdout);
331
332     // Longitude
333     MAT3_SET_HVEC(vec, 0.0, 0.0, 1.0, 1.0);
334     // R_Lon = rotate about Z axis
335     MAT3rotate(R_Lon, vec, FG_Longitude - FG_PI_2 );
336     // printf("\nLongitude matrix\n");
337     // MAT3print(R_Lon, stdout);
338
339 #ifdef THIS_IS_OLD_CODE
340     // View position in scenery centered coordinates
341     MAT3_SET_HVEC(vec, view_pos.x, view_pos.y, view_pos.z, 1.0);
342     MAT3translate(T_view, vec);
343     // printf("\nTranslation matrix\n");
344     // MAT3print(T_view, stdout);
345
346     // aircraft roll/pitch/yaw
347     MAT3mult(TMP, R_Phi, R_Theta);
348     MAT3mult(AIRCRAFT, TMP, R_Psi);
349     // printf("\naircraft roll pitch yaw\n");
350     // MAT3print(AIRCRAFT, stdout);
351 #endif THIS_IS_OLD_CODE
352
353     // lon/lat
354     MAT3mult(WORLD, R_Lat, R_Lon);
355     // printf("\nworld\n");
356     // MAT3print(WORLD, stdout);
357
358     MAT3mult(EYE_TO_WORLD, AIRCRAFT, WORLD);
359     MAT3mult(EYE_TO_WORLD, EYE_TO_WORLD, T_view);
360     // printf("\nEye to world\n");
361     // MAT3print(EYE_TO_WORLD, stdout);
362
363     MAT3invert(WORLD_TO_EYE, EYE_TO_WORLD);
364     // printf("\nWorld to eye\n");
365     // MAT3print(WORLD_TO_EYE, stdout);
366
367     // printf( "\nview_pos = %.2f %.2f %.2f\n", 
368     //         view_pos.x, view_pos.y, view_pos.z );
369
370     // MAT3_SET_HVEC(eye, 0.0, 0.0, 0.0, 1.0);
371     // MAT3mult_vec(vec, eye, EYE_TO_WORLD);
372     // printf("\neye -> world = %.2f %.2f %.2f\n", vec[0], vec[1], vec[2]);
373
374     // MAT3_SET_HVEC(vec1, view_pos.x, view_pos.y, view_pos.z, 1.0);
375     // MAT3mult_vec(vec, vec1, WORLD_TO_EYE);
376     // printf( "\nabs_view_pos -> eye = %.2f %.2f %.2f\n", 
377     //         vec[0], vec[1], vec[2]);
378 }
379
380
381 // Destructor
382 fgVIEW::~fgVIEW( void ) {
383 }
384
385
386 // Basically, this is a modified version of the Mesa gluLookAt()
387 // function that's been modified slightly so we can capture the result
388 // before sending it off to OpenGL land.
389 void fg_gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
390                    GLdouble centerx, GLdouble centery, GLdouble centerz,
391                    GLdouble upx, GLdouble upy, GLdouble upz )
392 {
393     GLdouble *m;
394     GLdouble x[3], y[3], z[3];
395     GLdouble mag;
396
397     m = current_view.MODEL_VIEW;
398
399     /* Make rotation matrix */
400
401     /* Z vector */
402     z[0] = eyex - centerx;
403     z[1] = eyey - centery;
404     z[2] = eyez - centerz;
405     mag = sqrt( z[0]*z[0] + z[1]*z[1] + z[2]*z[2] );
406     if (mag) {  /* mpichler, 19950515 */
407         z[0] /= mag;
408         z[1] /= mag;
409         z[2] /= mag;
410     }
411
412     /* Y vector */
413     y[0] = upx;
414     y[1] = upy;
415     y[2] = upz;
416
417     /* X vector = Y cross Z */
418     x[0] =  y[1]*z[2] - y[2]*z[1];
419     x[1] = -y[0]*z[2] + y[2]*z[0];
420     x[2] =  y[0]*z[1] - y[1]*z[0];
421     
422     /* Recompute Y = Z cross X */
423     y[0] =  z[1]*x[2] - z[2]*x[1];
424     y[1] = -z[0]*x[2] + z[2]*x[0];
425     y[2] =  z[0]*x[1] - z[1]*x[0];
426
427     /* mpichler, 19950515 */
428     /* cross product gives area of parallelogram, which is < 1.0 for
429      * non-perpendicular unit-length vectors; so normalize x, y here
430      */
431
432     mag = sqrt( x[0]*x[0] + x[1]*x[1] + x[2]*x[2] );
433     if (mag) {
434         x[0] /= mag;
435         x[1] /= mag;
436       x[2] /= mag;
437     }
438
439     mag = sqrt( y[0]*y[0] + y[1]*y[1] + y[2]*y[2] );
440     if (mag) {
441         y[0] /= mag;
442         y[1] /= mag;
443         y[2] /= mag;
444     }
445
446 #define M(row,col)  m[col*4+row]
447     M(0,0) = x[0];  M(0,1) = x[1];  M(0,2) = x[2];  M(0,3) = 0.0;
448     M(1,0) = y[0];  M(1,1) = y[1];  M(1,2) = y[2];  M(1,3) = 0.0;
449     M(2,0) = z[0];  M(2,1) = z[1];  M(2,2) = z[2];  M(2,3) = 0.0;
450     // the following is part of the original gluLookAt(), but we are
451     // commenting it out because we know we are going to be doing a
452     // translation below which will set these values anyways
453     // M(3,0) = 0.0;   M(3,1) = 0.0;   M(3,2) = 0.0;   M(3,3) = 1.0;
454 #undef M
455
456     // Translate Eye to Origin
457     // replaces: glTranslated( -eyex, -eyey, -eyez );
458
459     // this has been slightly modified from the original glTranslate()
460     // code because we know that coming into this m[12] = m[13] =
461     // m[14] = 0.0, and m[15] = 1.0;
462     m[12] = m[0] * -eyex + m[4] * -eyey + m[8]  * -eyez /* + m[12] */;
463     m[13] = m[1] * -eyex + m[5] * -eyey + m[9]  * -eyez /* + m[13] */;
464     m[14] = m[2] * -eyex + m[6] * -eyey + m[10] * -eyez /* + m[14] */;
465     m[15] = 1.0 /* m[3] * -eyex + m[7] * -eyey + m[11] * -eyez + m[15] */;
466
467     // xglMultMatrixd( m );
468     xglLoadMatrixd( m );
469 }
470
471
472 // $Log$
473 // Revision 1.17  1998/07/24 21:39:12  curt
474 // Debugging output tweaks.
475 // Cast glGetString to (char *) to avoid compiler errors.
476 // Optimizations to fgGluLookAt() by Norman Vine.
477 //
478 // Revision 1.16  1998/07/13 21:01:41  curt
479 // Wrote access functions for current fgOPTIONS.
480 //
481 // Revision 1.15  1998/07/12 03:14:43  curt
482 // Added ground collision detection.
483 // Did some serious horsing around to be able to "hug" the ground properly
484 //   and still be able to take off.
485 // Set the near clip plane to 1.0 meters when less than 10 meters above the
486 //   ground.
487 // Did some serious horsing around getting the initial airplane position to be
488 //   correct based on rendered terrain elevation.
489 // Added a little cheat/hack that will prevent the view position from ever
490 //   dropping below the terrain, even when the flight model doesn't quite
491 //   put you as high as you'd like.
492 //
493 // Revision 1.14  1998/07/08 14:45:08  curt
494 // polar3d.h renamed to polar3d.hxx
495 // vector.h renamed to vector.hxx
496 // updated audio support so it waits to create audio classes (and tie up
497 //   /dev/dsp) until the mpg123 player is finished.
498 //
499 // Revision 1.13  1998/07/04 00:52:27  curt
500 // Add my own version of gluLookAt() (which is nearly identical to the
501 // Mesa/glu version.)  But, by calculating the Model View matrix our selves
502 // we can save this matrix without having to read it back in from the video
503 // card.  This hopefully allows us to save a few cpu cycles when rendering
504 // out the fragments because we can just use glLoadMatrixd() with the
505 // precalculated matrix for each tile rather than doing a push(), translate(),
506 // pop() for every fragment.
507 //
508 // Panel status defaults to off for now until it gets a bit more developed.
509 //
510 // Extract OpenGL driver info on initialization.
511 //
512 // Revision 1.12  1998/06/03 00:47:15  curt
513 // Updated to compile in audio support if OSS available.
514 // Updated for new version of Steve's audio library.
515 // STL includes don't use .h
516 // Small view optimizations.
517 //
518 // Revision 1.11  1998/05/27 02:24:05  curt
519 // View optimizations by Norman Vine.
520 //
521 // Revision 1.10  1998/05/17 16:59:03  curt
522 // First pass at view frustum culling now operational.
523 //
524 // Revision 1.9  1998/05/16 13:08:37  curt
525 // C++ - ified views.[ch]xx
526 // Shuffled some additional view parameters into the fgVIEW class.
527 // Changed tile-radius to tile-diameter because it is a much better
528 //   name.
529 // Added a WORLD_TO_EYE transformation to views.cxx.  This allows us
530 //  to transform world space to eye space for view frustum culling.
531 //
532 // Revision 1.8  1998/05/02 01:51:01  curt
533 // Updated polartocart conversion routine.
534 //
535 // Revision 1.7  1998/04/30 12:34:20  curt
536 // Added command line rendering options:
537 //   enable/disable fog/haze
538 //   specify smooth/flat shading
539 //   disable sky blending and just use a solid color
540 //   enable wireframe drawing mode
541 //
542 // Revision 1.6  1998/04/28 01:20:23  curt
543 // Type-ified fgTIME and fgVIEW.
544 // Added a command line option to disable textures.
545 //
546 // Revision 1.5  1998/04/26 05:10:04  curt
547 // "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
548 //
549 // Revision 1.4  1998/04/25 22:04:53  curt
550 // Use already calculated LaRCsim values to create the roll/pitch/yaw
551 // transformation matrix (we call it LOCAL)
552 //
553 // Revision 1.3  1998/04/25 20:24:02  curt
554 // Cleaned up initialization sequence to eliminate interdependencies
555 // between sun position, lighting, and view position.  This creates a
556 // valid single pass initialization path.
557 //
558 // Revision 1.2  1998/04/24 00:49:22  curt
559 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
560 // Trying out some different option parsing code.
561 // Some code reorganization.
562 //
563 // Revision 1.1  1998/04/22 13:25:45  curt
564 // C++ - ifing the code.
565 // Starting a bit of reorganization of lighting code.
566 //
567 // Revision 1.16  1998/04/18 04:11:29  curt
568 // Moved fg_debug to it's own library, added zlib support.
569 //
570 // Revision 1.15  1998/02/20 00:16:24  curt
571 // Thursday's tweaks.
572 //
573 // Revision 1.14  1998/02/09 15:07:50  curt
574 // Minor tweaks.
575 //
576 // Revision 1.13  1998/02/07 15:29:45  curt
577 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
578 // <chotchkiss@namg.us.anritsu.com>
579 //
580 // Revision 1.12  1998/01/29 00:50:28  curt
581 // Added a view record field for absolute x, y, z position.
582 //
583 // Revision 1.11  1998/01/27 00:47:58  curt
584 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
585 // system and commandline/config file processing code.
586 //
587 // Revision 1.10  1998/01/19 19:27:09  curt
588 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
589 // This should simplify things tremendously.
590 //
591 // Revision 1.9  1998/01/13 00:23:09  curt
592 // Initial changes to support loading and management of scenery tiles.  Note,
593 // there's still a fair amount of work left to be done.
594 //
595 // Revision 1.8  1997/12/30 22:22:33  curt
596 // Further integration of event manager.
597 //
598 // Revision 1.7  1997/12/30 20:47:45  curt
599 // Integrated new event manager with subsystem initializations.
600 //
601 // Revision 1.6  1997/12/22 04:14:32  curt
602 // Aligned sky with sun so dusk/dawn effects can be correct relative to the sun.
603 //
604 // Revision 1.5  1997/12/18 04:07:02  curt
605 // Worked on properly translating and positioning the sky dome.
606 //
607 // Revision 1.4  1997/12/17 23:13:36  curt
608 // Began working on rendering a sky.
609 //
610 // Revision 1.3  1997/12/15 23:54:50  curt
611 // Add xgl wrappers for debugging.
612 // Generate terrain normals on the fly.
613 //
614 // Revision 1.2  1997/12/10 22:37:48  curt
615 // Prepended "fg" on the name of all global structures that didn't have it yet.
616 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
617 //
618 // Revision 1.1  1997/08/27 21:31:17  curt
619 // Initial revision.
620 //