1 // tilemgr.cxx -- routines to handle dynamic management of scenery tiles
3 // Written by Curtis Olson, started January 1998.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 // (Log is kept at end of this file)
36 #include <Aircraft/aircraft.h>
38 #include <Bucket/bucketutils.h>
39 #include <Debug/fg_debug.h>
40 #include <Include/fg_constants.h>
41 #include <Include/fg_types.h>
42 #include <Main/options.hxx>
43 #include <Main/views.hxx>
44 #include <Math/fg_geodesy.h>
45 #include <Math/mat3.h>
46 #include <Math/polar3d.hxx>
47 #include <Math/vector.hxx>
48 #include <Weather/weather.h>
50 #include "material.hxx"
52 #include "scenery.hxx"
53 #include "tilecache.hxx"
56 #define FG_LOCAL_X_Y 81 // max(o->tile_diameter) ** 2
59 // closest (potentially viewable) tiles, centered on current tile.
60 // This is an array of pointers to cache indexes.
61 int tiles[FG_LOCAL_X_Y];
64 // Initialize the Tile Manager subsystem
65 int fgTileMgrInit( void ) {
66 fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
68 // load default material library
69 material_mgr.load_lib();
76 void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
79 c = &global_tile_cache;
81 fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n",
82 p->lon, p->lat, p->x, p->y);
84 // if not in cache, load tile into the next available slot
85 if ( (*index = c->Exists(p)) < 0 ) {
86 *index = c->NextAvail();
87 c->EntryFillIn(*index, p);
90 fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
94 // given the current lon/lat, fill in the array of local chunks. If
95 // the chunk isn't already in the cache, then read it from disk.
96 int fgTileMgrUpdate( void ) {
100 static fgBUCKET p_last = {-1000, 0, 0, 0};
104 c = &global_tile_cache;
105 f = current_aircraft.flight;
107 tile_diameter = current_options.get_tile_diameter();
109 fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p1);
110 dw = tile_diameter / 2;
111 dh = tile_diameter / 2;
113 if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
114 (p1.x == p_last.x) && (p1.y == p_last.y) ) {
115 // same bucket as last time
116 fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
117 } else if ( p_last.lon == -1000 ) {
118 // First time through, initialize the system and load all
121 fgPrintf( FG_TERRAIN, FG_INFO, " First time through ... ");
122 fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
123 p1.lon, p1.lat, p1.x, p1.y);
124 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
125 tile_diameter * tile_diameter);
127 // wipe/initialize tile cache
130 // build the local area list and update cache
131 for ( j = 0; j < tile_diameter; j++ ) {
132 for ( i = 0; i < tile_diameter; i++ ) {
133 fgBucketOffset(&p1, &p2, i - dw, j - dh);
134 fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) + i]);
138 // We've moved to a new bucket, we need to scroll our
139 // structures, and load in the new tiles
141 // CURRENTLY THIS ASSUMES WE CAN ONLY MOVE TO ADJACENT TILES.
142 // AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
143 // THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION.
145 fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n",
146 p1.lon, p1.lat, p1.x, p1.y);
148 if ( (p1.lon > p_last.lon) ||
149 ( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
150 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
152 for ( j = 0; j < tile_diameter; j++ ) {
154 for ( i = 0; i < tile_diameter - 1; i++ ) {
155 tiles[(j*tile_diameter) + i] =
156 tiles[(j*tile_diameter) + i + 1];
158 // load in new column
159 fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
160 fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) +
163 } else if ( (p1.lon < p_last.lon) ||
164 ( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
165 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
167 for ( j = 0; j < tile_diameter; j++ ) {
169 for ( i = tile_diameter - 1; i > 0; i-- ) {
170 tiles[(j*tile_diameter) + i] =
171 tiles[(j*tile_diameter) + i - 1];
173 // load in new column
174 fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
175 fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) + 0]);
179 if ( (p1.lat > p_last.lat) ||
180 ( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
181 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
183 for ( i = 0; i < tile_diameter; i++ ) {
185 for ( j = 0; j < tile_diameter - 1; j++ ) {
186 tiles[(j * tile_diameter) + i] =
187 tiles[((j+1) * tile_diameter) + i];
189 // load in new column
190 fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
191 fgTileMgrLoadTile(&p2, &tiles[((tile_diameter-1) *
192 tile_diameter) + i]);
194 } else if ( (p1.lat < p_last.lat) ||
195 ( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
196 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
198 for ( i = 0; i < tile_diameter; i++ ) {
200 for ( j = tile_diameter - 1; j > 0; j-- ) {
201 tiles[(j * tile_diameter) + i] =
202 tiles[((j-1) * tile_diameter) + i];
204 // load in new column
205 fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
206 fgTileMgrLoadTile(&p2, &tiles[0 + i]);
218 // Calculate shortest distance from point to line
219 static double point_line_dist( fgPoint3d *tc, fgPoint3d *vp, MAT3vec d) {
223 p[0] = tc->x; p[1] = tc->y; p[2] = tc->z;
224 p0[0] = vp->x; p0[1] = vp->y; p0[2] = vp->z;
226 dist = fgPointLine(p, p0, d);
228 // printf("dist = %.2f\n", dist);
234 // Calculate if point/radius is inside view frustum
235 static int viewable( fgPoint3d *cp, double radius ) {
238 int viewable = 1; // start by assuming it's viewable
239 double x0, x1, y1, slope;
243 MAT3_SET_HVEC(world, cp->x, cp->y, cp->z, 1.0);
244 MAT3mult_vec(eye, world, v->WORLD_TO_EYE);
245 // printf( "\nworld -> eye = %.2f %.2f %.2f radius = %.2f\n",
246 // eye[0], eye[1], eye[2], radius);
248 // Check near clip plane
249 if ( eye[2] - radius > 0.0 ) {
253 // Check far clip plane
254 if ( eye[2] + radius < -current_weather.visibility ) {
258 // check right clip plane (from eye perspective)
259 // y = m * (x - x0) = equation of a line intercepting X axis at x0
260 x1 = v->cos_fov_x * radius;
261 y1 = v->sin_fov_x * radius;
263 x0 = x1 - y1 / slope;
265 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
266 // printf("eye[0] = %.2f eye[2] = %.2f\n", eye[0], eye[2]);
267 // printf("(r) x0 = %.2f slope_x = %.2f radius = %.2f\n",
268 // x0, slope, radius);
270 if ( eye[2] > slope * (eye[0] - x0) ) {
274 // check left clip plane (from eye perspective)
277 x0 = x1 - y1 / slope;
279 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
280 // printf("eye[0] = %.2f eye[2] = %.2f\n", eye[0], eye[2]);
281 // printf("(r) x0 = %.2f slope_x = %.2f radius = %.2f\n",
282 // x0, slope, radius);
284 if ( eye[2] > slope * (eye[0] - x0) ) {
288 // check bottom clip plane (from eye perspective)
289 x1 = -(v->cos_fov_y) * radius;
290 y1 = v->sin_fov_y * radius;
292 x0 = x1 - y1 / slope;
294 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
295 // printf("eye[1] = %.2f eye[2] = %.2f\n", eye[1], eye[2]);
296 // printf("(r) x0 = %.2f slope_y = %.2f radius = %.2f\n",
297 // x0, slope, radius);
299 if ( eye[2] > slope * (eye[1] - x0) ) {
303 // check top clip plane (from eye perspective)
306 x0 = x1 - y1 / slope;
308 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
309 // printf("eye[1] = %.2f eye[2] = %.2f\n", eye[1], eye[2]);
310 // printf("(r) x0 = %.2f slope_y = %.2f radius = %.2f\n",
311 // x0, slope, radius);
313 if ( eye[2] > slope * (eye[1] - x0) ) {
321 // Render the local tiles
322 void fgTileMgrRender( void ) {
325 fgTILE *t, *last_tile_ptr;
328 fgPoint3d frag_offset, pp;
329 fgPoint3d earth_center, result;
330 fgFRAGMENT *frag_ptr;
333 double dist, min_dist, lat_geod, alt, sea_level_r;
335 list < fgFRAGMENT > :: iterator current;
336 list < fgFRAGMENT > :: iterator last;
338 int tile_diameter, textures;
343 c = &global_tile_cache;
344 f = current_aircraft.flight;
347 tile_diameter = current_options.get_tile_diameter();
348 textures = current_options.get_textures();
350 // Find current translation offset
351 fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
352 index = c->Exists(&p);
353 t = c->GetTile(index);
355 scenery.next_center.x = t->center.x;
356 scenery.next_center.y = t->center.y;
357 scenery.next_center.z = t->center.z;
359 earth_center.x = 0.0;
360 earth_center.y = 0.0;
361 earth_center.z = 0.0;
363 fgPrintf( FG_TERRAIN, FG_DEBUG,
364 "Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n",
365 FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
366 p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) );
368 // initialize the transient per-material fragment lists
369 material_mgr.init_transient_material_lists();
373 // traverse the potentially viewable tile list
374 for ( i = 0; i < (tile_diameter * tile_diameter); i++ ) {
376 // fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index);
377 t = c->GetTile(index);
379 // calculate tile offset
380 x = (t->offset.x = t->center.x - scenery.center.x);
381 y = (t->offset.y = t->center.y - scenery.center.y);
382 z = (t->offset.z = t->center.z - scenery.center.z);
385 for ( j = 0; j < 16; j++ ) {
386 m[j] = v->MODEL_VIEW[j];
389 // Calculate the model_view transformation matrix for this tile
390 // This is equivalent to doing a glTranslatef(x, y, z);
391 m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
392 m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
393 m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
394 m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
396 // temp ... calc current terrain elevation
397 // calculate distance from vertical tangent line at
398 // current position to center of tile.
400 /* printf("distance = %.2f, bounding radius = %.2f\n",
401 point_line_dist(&(t->offset), &(v->view_pos), v->local_up),
402 t->bounding_radius); */
404 dist = point_line_dist(&(t->center), &(v->abs_view_pos), v->local_up);
405 if ( dist < t->bounding_radius ) {
407 // traverse fragment list for tile
408 current = t->fragment_list.begin();
409 last = t->fragment_list.end();
411 while ( current != last ) {
412 frag_ptr = &(*current);
414 /* printf("distance = %.2f, bounding radius = %.2f\n",
415 point_line_dist( &(frag_ptr->center),
416 &(v->abs_view_pos), v->local_up),
417 frag_ptr->bounding_radius); */
419 dist = point_line_dist( &(frag_ptr->center),
420 &(v->abs_view_pos), v->local_up);
421 if ( dist <= frag_ptr->bounding_radius ) {
422 if ( frag_ptr->intersect( &(v->abs_view_pos),
423 &earth_center, 0, &result ) ) {
424 // compute geocentric coordinates of tile center
425 pp = fgCartToPolar3d(result);
426 // convert to geodetic coordinates
427 fgGeocToGeod(pp.lat, pp.radius, &lat_geod,
429 // printf("alt = %.2f\n", alt);
430 scenery.cur_elev = alt;
431 // exit this loop since we found an intersection
438 // Course (tile based) culling
439 if ( viewable(&(t->offset), t->bounding_radius) ) {
440 // at least a portion of this tile could be viewable
443 // xglTranslatef(t->offset.x, t->offset.y, t->offset.z);
445 // traverse fragment list for tile
446 current = t->fragment_list.begin();
447 last = t->fragment_list.end();
449 while ( current != last ) {
450 frag_ptr = &(*current);
453 if ( frag_ptr->display_list >= 0 ) {
454 // Fine (fragment based) culling
455 frag_offset.x = frag_ptr->center.x - scenery.center.x;
456 frag_offset.y = frag_ptr->center.y - scenery.center.y;
457 frag_offset.z = frag_ptr->center.z - scenery.center.z;
459 if ( viewable(&frag_offset, frag_ptr->bounding_radius*2) ) {
460 // add to transient per-material property fragment list
461 // frag_ptr->tile_offset.x = t->offset.x;
462 // frag_ptr->tile_offset.y = t->offset.y;
463 // frag_ptr->tile_offset.z = t->offset.z;
465 mtl_ptr = (fgMATERIAL *)(frag_ptr->material_ptr);
466 // printf(" lookup = %s\n", mtl_ptr->texture_name);
467 if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
468 mtl_ptr->list[mtl_ptr->list_size] = frag_ptr;
469 (mtl_ptr->list_size)++;
471 fgPrintf( FG_TERRAIN, FG_ALERT,
472 "Overran material sorting array\n" );
475 // xglCallList(frag_ptr->display_list);
478 // printf("Culled a fragment %.2f %.2f %.2f %.2f\n",
479 // frag_ptr->center.x, frag_ptr->center.y,
480 // frag_ptr->center.z, frag_ptr->bounding_radius);
488 culled += t->fragment_list.size();
492 if ( (drawn + culled) > 0 ) {
493 v->vfc_ratio = (double)culled / (double)(drawn + culled);
497 // printf("drawn = %d culled = %d saved = %.2f\n", drawn, culled,
501 // traverse the transient per-material fragment lists and render
502 // out all fragments for each material property.
503 map < string, fgMATERIAL, less<string> > :: iterator mapcurrent =
504 material_mgr.material_map.begin();
505 map < string, fgMATERIAL, less<string> > :: iterator maplast =
506 material_mgr.material_map.end();
510 while ( mapcurrent != maplast ) {
511 // (char *)key = (*mapcurrent).first;
512 // (fgMATERIAL)value = (*mapcurrent).second;
513 mtl_ptr = &(*mapcurrent).second;
515 last_tile_ptr = NULL;
517 size = mtl_ptr->list_size;
520 #ifdef GL_VERSION_1_1
521 xglBindTexture(GL_TEXTURE_2D, mtl_ptr->texture_id);
522 #elif GL_EXT_texture_object
523 xglBindTextureEXT(GL_TEXTURE_2D, mtl_ptr->texture_id);
528 xglMaterialfv (GL_FRONT, GL_AMBIENT, mtl_ptr->ambient);
529 xglMaterialfv (GL_FRONT, GL_DIFFUSE, mtl_ptr->diffuse);
532 // printf("traversing = %s, size = %d\n",
533 // mtl_ptr->texture_name, size);
534 for ( i = 0; i < size; i++ ) {
535 frag_ptr = mtl_ptr->list[i];
537 if ( frag_ptr->tile_ptr == last_tile_ptr ) {
538 // same tile as last time, no transform necessary
540 // new tile, new translate
541 // xglLoadMatrixf( frag_ptr->matrix );
542 t = (fgTILE *)(frag_ptr->tile_ptr);
543 xglLoadMatrixd(t->model_view );
546 // Woohoo!!! We finally get to draw something!
547 // printf(" display_list = %d\n", frag_ptr->display_list);
548 xglCallList(frag_ptr->display_list);
550 last_tile_ptr = (fgTILE *)(frag_ptr->tile_ptr);
562 // Revision 1.26 1998/07/20 12:51:26 curt
563 // Added far clip plane to fragment clipping calculations and tie this to
564 // weather->visibility. This way you can increase framerates by increasing
565 // for and lowering visibility.
567 // Revision 1.25 1998/07/13 21:02:01 curt
568 // Wrote access functions for current fgOPTIONS.
570 // Revision 1.24 1998/07/12 03:18:29 curt
571 // Added ground collision detection. This involved:
572 // - saving the entire vertex list for each tile with the tile records.
573 // - saving the face list for each fragment with the fragment records.
574 // - code to intersect the current vertical line with the proper face in
575 // an efficient manner as possible.
576 // Fixed a bug where the tiles weren't being shifted to "near" (0,0,0)
578 // Revision 1.23 1998/07/08 14:47:23 curt
579 // Fix GL_MODULATE vs. GL_DECAL problem introduced by splash screen.
580 // polare3d.h renamed to polar3d.hxx
581 // fg{Cartesian,Polar}Point3d consolodated.
582 // Added some initial support for calculating local current ground elevation.
584 // Revision 1.22 1998/07/04 00:54:31 curt
585 // Added automatic mipmap generation.
587 // When rendering fragments, use saved model view matrix from associated tile
588 // rather than recalculating it with push() translate() pop().
590 // Revision 1.21 1998/06/27 16:54:59 curt
591 // Check for GL_VERSION_1_1 or GL_EXT_texture_object to decide whether to use
592 // "EXT" versions of texture management routines.
594 // Revision 1.20 1998/06/17 21:36:42 curt
595 // Load and manage multiple textures defined in the Materials library.
596 // Boost max material fagments for each material property to 800.
597 // Multiple texture support when rendering.
599 // Revision 1.19 1998/06/08 17:57:54 curt
600 // Working first pass at material proporty sorting.
602 // Revision 1.18 1998/06/06 01:09:32 curt
603 // I goofed on the log message in the last commit ... now fixed.
605 // Revision 1.17 1998/06/06 01:07:18 curt
606 // Increased per material fragment list size from 100 to 400.
607 // Now correctly draw viewable fragments in per material order.
609 // Revision 1.16 1998/06/05 22:39:55 curt
610 // Working on sorting by, and rendering by material properties.
612 // Revision 1.15 1998/06/03 00:47:51 curt
613 // No .h for STL includes.
614 // Minor view culling optimizations.
616 // Revision 1.14 1998/06/01 17:56:20 curt
617 // Incremental additions to material.cxx (not fully functional)
618 // Tweaked vfc_ratio math to avoid divide by zero.
620 // Revision 1.13 1998/05/24 02:49:10 curt
621 // Implimented fragment level view frustum culling.
623 // Revision 1.12 1998/05/23 14:09:23 curt
624 // Added tile.cxx and tile.hxx.
625 // Working on rewriting the tile management system so a tile is just a list
626 // fragments, and the fragment record contains the display list for that fragment.
628 // Revision 1.11 1998/05/20 20:53:55 curt
629 // Moved global ref point and radius (bounding sphere info, and offset) to
630 // data file rather than calculating it on the fly.
631 // Fixed polygon winding problem in scenery generation stage rather than
632 // compensating for it on the fly.
633 // Made a fgTILECACHE class.
635 // Revision 1.10 1998/05/17 16:59:34 curt
636 // Frist pass at view frustum culling now operational.
638 // Revision 1.9 1998/05/16 13:09:58 curt
639 // Beginning to add support for view frustum culling.
640 // Added some temporary code to calculate bouding radius, until the
641 // scenery generation tools and scenery can be updated.
643 // Revision 1.8 1998/05/07 23:15:21 curt
644 // Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
645 // Added support for --tile-radius=n option.
647 // Revision 1.7 1998/05/06 03:16:42 curt
648 // Added an option to control square tile radius.
650 // Revision 1.6 1998/05/02 01:52:18 curt
651 // Playing around with texture coordinates.
653 // Revision 1.5 1998/04/30 12:35:32 curt
654 // Added a command line rendering option specify smooth/flat shading.
656 // Revision 1.4 1998/04/27 03:30:14 curt
657 // Minor transformation adjustments to try to keep scenery tiles closer to
658 // (0, 0, 0) GLfloats run out of precision at the distances we need to model
659 // the earth, but we can do a bunch of pre-transformations using double math
660 // and then cast to GLfloat once everything is close in where we have less
661 // precision problems.
663 // Revision 1.3 1998/04/25 22:06:32 curt
664 // Edited cvs log messages in source files ... bad bad bad!
666 // Revision 1.2 1998/04/24 00:51:09 curt
667 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
668 // Tweaked the scenery file extentions to be "file.obj" (uncompressed)
669 // or "file.obz" (compressed.)
671 // Revision 1.1 1998/04/22 13:22:48 curt
672 // C++ - ifing the code a bit.
674 // Revision 1.25 1998/04/18 04:14:07 curt
675 // Moved fg_debug.c to it's own library.
677 // Revision 1.24 1998/04/14 02:23:18 curt
678 // Code reorganizations. Added a Lib/ directory for more general libraries.
680 // Revision 1.23 1998/04/08 23:30:08 curt
681 // Adopted Gnu automake/autoconf system.
683 // Revision 1.22 1998/04/03 22:11:38 curt
684 // Converting to Gnu autoconf system.
686 // Revision 1.21 1998/03/23 21:23:05 curt
687 // Debugging output tweaks.
689 // Revision 1.20 1998/03/14 00:30:51 curt
690 // Beginning initial terrain texturing experiments.
692 // Revision 1.19 1998/02/20 00:16:25 curt
693 // Thursday's tweaks.
695 // Revision 1.18 1998/02/19 13:05:54 curt
696 // Incorporated some HUD tweaks from Michelle America.
697 // Tweaked the sky's sunset/rise colors.
698 // Other misc. tweaks.
700 // Revision 1.17 1998/02/16 13:39:46 curt
701 // Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
702 // tiles to occasionally be missing.
704 // Revision 1.16 1998/02/12 21:59:53 curt
705 // Incorporated code changes contributed by Charlie Hotchkiss
706 // <chotchkiss@namg.us.anritsu.com>
708 // Revision 1.14 1998/02/09 21:30:19 curt
709 // Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
711 // Revision 1.13 1998/02/07 15:29:46 curt
712 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
713 // <chotchkiss@namg.us.anritsu.com>
715 // Revision 1.12 1998/02/01 03:39:55 curt
718 // Revision 1.11 1998/01/31 00:43:27 curt
719 // Added MetroWorks patches from Carmen Volpe.
721 // Revision 1.10 1998/01/29 00:51:40 curt
722 // First pass at tile cache, dynamic tile loading and tile unloading now works.
724 // Revision 1.9 1998/01/27 03:26:44 curt
725 // Playing with new fgPrintf command.
727 // Revision 1.8 1998/01/27 00:48:04 curt
728 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
729 // system and commandline/config file processing code.
731 // Revision 1.7 1998/01/26 15:55:25 curt
732 // Progressing on building dynamic scenery system.
734 // Revision 1.6 1998/01/24 00:03:30 curt
737 // Revision 1.5 1998/01/19 19:27:18 curt
738 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
739 // This should simplify things tremendously.
741 // Revision 1.4 1998/01/19 18:40:38 curt
742 // Tons of little changes to clean up the code and to remove fatal errors
743 // when building with the c++ compiler.
745 // Revision 1.3 1998/01/13 00:23:11 curt
746 // Initial changes to support loading and management of scenery tiles. Note,
747 // there's still a fair amount of work left to be done.
749 // Revision 1.2 1998/01/08 02:22:27 curt
750 // Continue working on basic features.
752 // Revision 1.1 1998/01/07 23:50:51 curt
753 // "area" renamed to "tile"
755 // Revision 1.2 1998/01/07 03:29:29 curt
756 // Given an arbitrary lat/lon, we can now:
757 // generate a unique index for the chunk containing the lat/lon
758 // generate a path name to the chunk file
759 // build a list of the indexes of all the nearby areas.
761 // Revision 1.1 1998/01/07 02:05:48 curt