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>
49 #include "material.hxx"
51 #include "scenery.hxx"
52 #include "tilecache.hxx"
55 #define FG_LOCAL_X_Y 81 // max(o->tile_diameter) ** 2
58 // closest (potentially viewable) tiles, centered on current tile.
59 // This is an array of pointers to cache indexes.
60 int tiles[FG_LOCAL_X_Y];
63 // Initialize the Tile Manager subsystem
64 int fgTileMgrInit( void ) {
65 fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
67 // load default material library
68 material_mgr.load_lib();
75 void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
78 c = &global_tile_cache;
80 fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n",
81 p->lon, p->lat, p->x, p->y);
83 // if not in cache, load tile into the next available slot
84 if ( (*index = c->Exists(p)) < 0 ) {
85 *index = c->NextAvail();
86 c->EntryFillIn(*index, p);
89 fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
93 // given the current lon/lat, fill in the array of local chunks. If
94 // the chunk isn't already in the cache, then read it from disk.
95 int fgTileMgrUpdate( void ) {
99 static fgBUCKET p_last = {-1000, 0, 0, 0};
103 c = &global_tile_cache;
104 f = current_aircraft.flight;
106 tile_diameter = current_options.get_tile_diameter();
108 fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p1);
109 dw = tile_diameter / 2;
110 dh = tile_diameter / 2;
112 if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
113 (p1.x == p_last.x) && (p1.y == p_last.y) ) {
114 // same bucket as last time
115 fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
116 } else if ( p_last.lon == -1000 ) {
117 // First time through, initialize the system and load all
120 fgPrintf( FG_TERRAIN, FG_INFO, " First time through ... ");
121 fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
122 p1.lon, p1.lat, p1.x, p1.y);
123 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
124 tile_diameter * tile_diameter);
126 // wipe/initialize tile cache
129 // build the local area list and update cache
130 for ( j = 0; j < tile_diameter; j++ ) {
131 for ( i = 0; i < tile_diameter; i++ ) {
132 fgBucketOffset(&p1, &p2, i - dw, j - dh);
133 fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) + i]);
137 // We've moved to a new bucket, we need to scroll our
138 // structures, and load in the new tiles
140 // CURRENTLY THIS ASSUMES WE CAN ONLY MOVE TO ADJACENT TILES.
141 // AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
142 // THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION.
144 fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n",
145 p1.lon, p1.lat, p1.x, p1.y);
147 if ( (p1.lon > p_last.lon) ||
148 ( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
149 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
151 for ( j = 0; j < tile_diameter; j++ ) {
153 for ( i = 0; i < tile_diameter - 1; i++ ) {
154 tiles[(j*tile_diameter) + i] =
155 tiles[(j*tile_diameter) + i + 1];
157 // load in new column
158 fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
159 fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) +
162 } else if ( (p1.lon < p_last.lon) ||
163 ( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
164 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
166 for ( j = 0; j < tile_diameter; j++ ) {
168 for ( i = tile_diameter - 1; i > 0; i-- ) {
169 tiles[(j*tile_diameter) + i] =
170 tiles[(j*tile_diameter) + i - 1];
172 // load in new column
173 fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
174 fgTileMgrLoadTile(&p2, &tiles[(j*tile_diameter) + 0]);
178 if ( (p1.lat > p_last.lat) ||
179 ( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
180 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
182 for ( i = 0; i < tile_diameter; i++ ) {
184 for ( j = 0; j < tile_diameter - 1; j++ ) {
185 tiles[(j * tile_diameter) + i] =
186 tiles[((j+1) * tile_diameter) + i];
188 // load in new column
189 fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
190 fgTileMgrLoadTile(&p2, &tiles[((tile_diameter-1) *
191 tile_diameter) + i]);
193 } else if ( (p1.lat < p_last.lat) ||
194 ( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
195 fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
197 for ( i = 0; i < tile_diameter; i++ ) {
199 for ( j = tile_diameter - 1; j > 0; j-- ) {
200 tiles[(j * tile_diameter) + i] =
201 tiles[((j-1) * tile_diameter) + i];
203 // load in new column
204 fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
205 fgTileMgrLoadTile(&p2, &tiles[0 + i]);
217 // Calculate shortest distance from point to line
218 static double point_line_dist( fgPoint3d *tc, fgPoint3d *vp, MAT3vec d) {
222 p[0] = tc->x; p[1] = tc->y; p[2] = tc->z;
223 p0[0] = vp->x; p0[1] = vp->y; p0[2] = vp->z;
225 dist = fgPointLine(p, p0, d);
227 // printf("dist = %.2f\n", dist);
233 // Calculate if point/radius is inside view frustum
234 static int viewable( fgPoint3d *cp, double radius ) {
237 int viewable = 1; // start by assuming it's viewable
238 double x0, x1, y1, slope;
242 MAT3_SET_HVEC(world, cp->x, cp->y, cp->z, 1.0);
243 MAT3mult_vec(eye, world, v->WORLD_TO_EYE);
244 // printf( "\nworld -> eye = %.2f %.2f %.2f radius = %.2f\n",
245 // eye[0], eye[1], eye[2], radius);
247 // Check near clip plane
248 if ( eye[2] - radius > 0.0 ) {
252 // check right clip plane (from eye perspective)
253 // y = m * (x - x0) = equation of a line intercepting X axis at x0
254 x1 = v->cos_fov_x * radius;
255 y1 = v->sin_fov_x * radius;
257 x0 = x1 - y1 / slope;
259 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
260 // printf("eye[0] = %.2f eye[2] = %.2f\n", eye[0], eye[2]);
261 // printf("(r) x0 = %.2f slope_x = %.2f radius = %.2f\n",
262 // x0, slope, radius);
264 if ( eye[2] > slope * (eye[0] - x0) ) {
268 // check left clip plane (from eye perspective)
271 x0 = x1 - y1 / slope;
273 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
274 // printf("eye[0] = %.2f eye[2] = %.2f\n", eye[0], eye[2]);
275 // printf("(r) x0 = %.2f slope_x = %.2f radius = %.2f\n",
276 // x0, slope, radius);
278 if ( eye[2] > slope * (eye[0] - x0) ) {
282 // check bottom clip plane (from eye perspective)
283 x1 = -(v->cos_fov_y) * radius;
284 y1 = v->sin_fov_y * radius;
286 x0 = x1 - y1 / slope;
288 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
289 // printf("eye[1] = %.2f eye[2] = %.2f\n", eye[1], eye[2]);
290 // printf("(r) x0 = %.2f slope_y = %.2f radius = %.2f\n",
291 // x0, slope, radius);
293 if ( eye[2] > slope * (eye[1] - x0) ) {
297 // check top clip plane (from eye perspective)
300 x0 = x1 - y1 / slope;
302 // printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
303 // printf("eye[1] = %.2f eye[2] = %.2f\n", eye[1], eye[2]);
304 // printf("(r) x0 = %.2f slope_y = %.2f radius = %.2f\n",
305 // x0, slope, radius);
307 if ( eye[2] > slope * (eye[1] - x0) ) {
315 // Render the local tiles
316 void fgTileMgrRender( void ) {
319 fgTILE *t, *last_tile_ptr;
322 fgPoint3d frag_offset, pp;
323 fgPoint3d earth_center, result;
324 fgFRAGMENT *frag_ptr;
327 double dist, min_dist, lat_geod, alt, sea_level_r;
329 list < fgFRAGMENT > :: iterator current;
330 list < fgFRAGMENT > :: iterator last;
332 int tile_diameter, textures;
337 c = &global_tile_cache;
338 f = current_aircraft.flight;
341 tile_diameter = current_options.get_tile_diameter();
342 textures = current_options.get_textures();
344 // Find current translation offset
345 fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
346 index = c->Exists(&p);
347 t = c->GetTile(index);
349 scenery.next_center.x = t->center.x;
350 scenery.next_center.y = t->center.y;
351 scenery.next_center.z = t->center.z;
353 earth_center.x = 0.0;
354 earth_center.y = 0.0;
355 earth_center.z = 0.0;
357 fgPrintf( FG_TERRAIN, FG_DEBUG,
358 "Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n",
359 FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
360 p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) );
362 // initialize the transient per-material fragment lists
363 material_mgr.init_transient_material_lists();
367 // traverse the potentially viewable tile list
368 for ( i = 0; i < (tile_diameter * tile_diameter); i++ ) {
370 // fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index);
371 t = c->GetTile(index);
373 // calculate tile offset
374 x = t->offset.x = t->center.x - scenery.center.x;
375 y = t->offset.y = t->center.y - scenery.center.y;
376 z = t->offset.z = t->center.z - scenery.center.z;
379 for ( j = 0; j < 16; j++ ) {
380 m[j] = v->MODEL_VIEW[j];
383 // Calculate the model_view transformation matrix for this tile
384 // This is equivalent to doing a glTranslatef(x, y, z);
385 m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
386 m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
387 m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
388 m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
390 // temp ... calc current terrain elevation
391 // calculate distance from vertical tangent line at
392 // current position to center of tile.
394 /* printf("distance = %.2f, bounding radius = %.2f\n",
395 point_line_dist(&(t->offset), &(v->view_pos), v->local_up),
396 t->bounding_radius); */
398 dist = point_line_dist(&(t->center), &(v->abs_view_pos), v->local_up);
399 if ( dist < t->bounding_radius ) {
401 // traverse fragment list for tile
402 current = t->fragment_list.begin();
403 last = t->fragment_list.end();
405 while ( current != last ) {
406 frag_ptr = &(*current);
408 /* printf("distance = %.2f, bounding radius = %.2f\n",
409 point_line_dist( &(frag_ptr->center),
410 &(v->abs_view_pos), v->local_up),
411 frag_ptr->bounding_radius); */
413 dist = point_line_dist( &(frag_ptr->center),
414 &(v->abs_view_pos), v->local_up);
415 if ( dist <= frag_ptr->bounding_radius ) {
416 if ( frag_ptr->intersect( &(v->abs_view_pos),
417 &earth_center, 0, &result ) ) {
418 // compute geocentric coordinates of tile center
419 pp = fgCartToPolar3d(result);
420 // convert to geodetic coordinates
421 fgGeocToGeod(pp.lat, pp.radius, &lat_geod,
423 // printf("alt = %.2f\n", alt);
424 scenery.cur_elev = alt;
425 // exit this loop since we found an intersection
432 // Course (tile based) culling
433 if ( viewable(&(t->offset), t->bounding_radius) ) {
434 // at least a portion of this tile could be viewable
437 // xglTranslatef(t->offset.x, t->offset.y, t->offset.z);
439 // traverse fragment list for tile
440 current = t->fragment_list.begin();
441 last = t->fragment_list.end();
443 while ( current != last ) {
444 frag_ptr = &(*current);
447 if ( frag_ptr->display_list >= 0 ) {
448 // Fine (fragment based) culling
449 frag_offset.x = frag_ptr->center.x - scenery.center.x;
450 frag_offset.y = frag_ptr->center.y - scenery.center.y;
451 frag_offset.z = frag_ptr->center.z - scenery.center.z;
453 if ( viewable(&frag_offset, frag_ptr->bounding_radius*2) ) {
454 // add to transient per-material property fragment list
455 // frag_ptr->tile_offset.x = t->offset.x;
456 // frag_ptr->tile_offset.y = t->offset.y;
457 // frag_ptr->tile_offset.z = t->offset.z;
459 mtl_ptr = (fgMATERIAL *)(frag_ptr->material_ptr);
460 // printf(" lookup = %s\n", mtl_ptr->texture_name);
461 if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
462 mtl_ptr->list[mtl_ptr->list_size] = frag_ptr;
463 (mtl_ptr->list_size)++;
465 fgPrintf( FG_TERRAIN, FG_ALERT,
466 "Overran material sorting array\n" );
469 // xglCallList(frag_ptr->display_list);
472 // printf("Culled a fragment %.2f %.2f %.2f %.2f\n",
473 // frag_ptr->center.x, frag_ptr->center.y,
474 // frag_ptr->center.z, frag_ptr->bounding_radius);
482 culled += t->fragment_list.size();
486 if ( (drawn + culled) > 0 ) {
487 v->vfc_ratio = (double)culled / (double)(drawn + culled);
491 // printf("drawn = %d culled = %d saved = %.2f\n", drawn, culled,
495 // traverse the transient per-material fragment lists and render
496 // out all fragments for each material property.
497 map < string, fgMATERIAL, less<string> > :: iterator mapcurrent =
498 material_mgr.material_map.begin();
499 map < string, fgMATERIAL, less<string> > :: iterator maplast =
500 material_mgr.material_map.end();
504 while ( mapcurrent != maplast ) {
505 // (char *)key = (*mapcurrent).first;
506 // (fgMATERIAL)value = (*mapcurrent).second;
507 mtl_ptr = &(*mapcurrent).second;
509 last_tile_ptr = NULL;
511 size = mtl_ptr->list_size;
514 #ifdef GL_VERSION_1_1
515 xglBindTexture(GL_TEXTURE_2D, mtl_ptr->texture_id);
516 #elif GL_EXT_texture_object
517 xglBindTextureEXT(GL_TEXTURE_2D, mtl_ptr->texture_id);
522 xglMaterialfv (GL_FRONT, GL_AMBIENT, mtl_ptr->ambient);
523 xglMaterialfv (GL_FRONT, GL_DIFFUSE, mtl_ptr->diffuse);
526 // printf("traversing = %s, size = %d\n",
527 // mtl_ptr->texture_name, size);
528 for ( i = 0; i < size; i++ ) {
529 frag_ptr = mtl_ptr->list[i];
531 if ( frag_ptr->tile_ptr == last_tile_ptr ) {
532 // same tile as last time, no transform necessary
534 // new tile, new translate
535 // xglLoadMatrixf( frag_ptr->matrix );
536 t = (fgTILE *)(frag_ptr->tile_ptr);
537 xglLoadMatrixd(t->model_view );
540 // Woohoo!!! We finally get to draw something!
541 // printf(" display_list = %d\n", frag_ptr->display_list);
542 xglCallList(frag_ptr->display_list);
544 last_tile_ptr = (fgTILE *)(frag_ptr->tile_ptr);
556 // Revision 1.25 1998/07/13 21:02:01 curt
557 // Wrote access functions for current fgOPTIONS.
559 // Revision 1.24 1998/07/12 03:18:29 curt
560 // Added ground collision detection. This involved:
561 // - saving the entire vertex list for each tile with the tile records.
562 // - saving the face list for each fragment with the fragment records.
563 // - code to intersect the current vertical line with the proper face in
564 // an efficient manner as possible.
565 // Fixed a bug where the tiles weren't being shifted to "near" (0,0,0)
567 // Revision 1.23 1998/07/08 14:47:23 curt
568 // Fix GL_MODULATE vs. GL_DECAL problem introduced by splash screen.
569 // polare3d.h renamed to polar3d.hxx
570 // fg{Cartesian,Polar}Point3d consolodated.
571 // Added some initial support for calculating local current ground elevation.
573 // Revision 1.22 1998/07/04 00:54:31 curt
574 // Added automatic mipmap generation.
576 // When rendering fragments, use saved model view matrix from associated tile
577 // rather than recalculating it with push() translate() pop().
579 // Revision 1.21 1998/06/27 16:54:59 curt
580 // Check for GL_VERSION_1_1 or GL_EXT_texture_object to decide whether to use
581 // "EXT" versions of texture management routines.
583 // Revision 1.20 1998/06/17 21:36:42 curt
584 // Load and manage multiple textures defined in the Materials library.
585 // Boost max material fagments for each material property to 800.
586 // Multiple texture support when rendering.
588 // Revision 1.19 1998/06/08 17:57:54 curt
589 // Working first pass at material proporty sorting.
591 // Revision 1.18 1998/06/06 01:09:32 curt
592 // I goofed on the log message in the last commit ... now fixed.
594 // Revision 1.17 1998/06/06 01:07:18 curt
595 // Increased per material fragment list size from 100 to 400.
596 // Now correctly draw viewable fragments in per material order.
598 // Revision 1.16 1998/06/05 22:39:55 curt
599 // Working on sorting by, and rendering by material properties.
601 // Revision 1.15 1998/06/03 00:47:51 curt
602 // No .h for STL includes.
603 // Minor view culling optimizations.
605 // Revision 1.14 1998/06/01 17:56:20 curt
606 // Incremental additions to material.cxx (not fully functional)
607 // Tweaked vfc_ratio math to avoid divide by zero.
609 // Revision 1.13 1998/05/24 02:49:10 curt
610 // Implimented fragment level view frustum culling.
612 // Revision 1.12 1998/05/23 14:09:23 curt
613 // Added tile.cxx and tile.hxx.
614 // Working on rewriting the tile management system so a tile is just a list
615 // fragments, and the fragment record contains the display list for that fragment.
617 // Revision 1.11 1998/05/20 20:53:55 curt
618 // Moved global ref point and radius (bounding sphere info, and offset) to
619 // data file rather than calculating it on the fly.
620 // Fixed polygon winding problem in scenery generation stage rather than
621 // compensating for it on the fly.
622 // Made a fgTILECACHE class.
624 // Revision 1.10 1998/05/17 16:59:34 curt
625 // Frist pass at view frustum culling now operational.
627 // Revision 1.9 1998/05/16 13:09:58 curt
628 // Beginning to add support for view frustum culling.
629 // Added some temporary code to calculate bouding radius, until the
630 // scenery generation tools and scenery can be updated.
632 // Revision 1.8 1998/05/07 23:15:21 curt
633 // Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
634 // Added support for --tile-radius=n option.
636 // Revision 1.7 1998/05/06 03:16:42 curt
637 // Added an option to control square tile radius.
639 // Revision 1.6 1998/05/02 01:52:18 curt
640 // Playing around with texture coordinates.
642 // Revision 1.5 1998/04/30 12:35:32 curt
643 // Added a command line rendering option specify smooth/flat shading.
645 // Revision 1.4 1998/04/27 03:30:14 curt
646 // Minor transformation adjustments to try to keep scenery tiles closer to
647 // (0, 0, 0) GLfloats run out of precision at the distances we need to model
648 // the earth, but we can do a bunch of pre-transformations using double math
649 // and then cast to GLfloat once everything is close in where we have less
650 // precision problems.
652 // Revision 1.3 1998/04/25 22:06:32 curt
653 // Edited cvs log messages in source files ... bad bad bad!
655 // Revision 1.2 1998/04/24 00:51:09 curt
656 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
657 // Tweaked the scenery file extentions to be "file.obj" (uncompressed)
658 // or "file.obz" (compressed.)
660 // Revision 1.1 1998/04/22 13:22:48 curt
661 // C++ - ifing the code a bit.
663 // Revision 1.25 1998/04/18 04:14:07 curt
664 // Moved fg_debug.c to it's own library.
666 // Revision 1.24 1998/04/14 02:23:18 curt
667 // Code reorganizations. Added a Lib/ directory for more general libraries.
669 // Revision 1.23 1998/04/08 23:30:08 curt
670 // Adopted Gnu automake/autoconf system.
672 // Revision 1.22 1998/04/03 22:11:38 curt
673 // Converting to Gnu autoconf system.
675 // Revision 1.21 1998/03/23 21:23:05 curt
676 // Debugging output tweaks.
678 // Revision 1.20 1998/03/14 00:30:51 curt
679 // Beginning initial terrain texturing experiments.
681 // Revision 1.19 1998/02/20 00:16:25 curt
682 // Thursday's tweaks.
684 // Revision 1.18 1998/02/19 13:05:54 curt
685 // Incorporated some HUD tweaks from Michelle America.
686 // Tweaked the sky's sunset/rise colors.
687 // Other misc. tweaks.
689 // Revision 1.17 1998/02/16 13:39:46 curt
690 // Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
691 // tiles to occasionally be missing.
693 // Revision 1.16 1998/02/12 21:59:53 curt
694 // Incorporated code changes contributed by Charlie Hotchkiss
695 // <chotchkiss@namg.us.anritsu.com>
697 // Revision 1.14 1998/02/09 21:30:19 curt
698 // Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
700 // Revision 1.13 1998/02/07 15:29:46 curt
701 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
702 // <chotchkiss@namg.us.anritsu.com>
704 // Revision 1.12 1998/02/01 03:39:55 curt
707 // Revision 1.11 1998/01/31 00:43:27 curt
708 // Added MetroWorks patches from Carmen Volpe.
710 // Revision 1.10 1998/01/29 00:51:40 curt
711 // First pass at tile cache, dynamic tile loading and tile unloading now works.
713 // Revision 1.9 1998/01/27 03:26:44 curt
714 // Playing with new fgPrintf command.
716 // Revision 1.8 1998/01/27 00:48:04 curt
717 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
718 // system and commandline/config file processing code.
720 // Revision 1.7 1998/01/26 15:55:25 curt
721 // Progressing on building dynamic scenery system.
723 // Revision 1.6 1998/01/24 00:03:30 curt
726 // Revision 1.5 1998/01/19 19:27:18 curt
727 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
728 // This should simplify things tremendously.
730 // Revision 1.4 1998/01/19 18:40:38 curt
731 // Tons of little changes to clean up the code and to remove fatal errors
732 // when building with the c++ compiler.
734 // Revision 1.3 1998/01/13 00:23:11 curt
735 // Initial changes to support loading and management of scenery tiles. Note,
736 // there's still a fair amount of work left to be done.
738 // Revision 1.2 1998/01/08 02:22:27 curt
739 // Continue working on basic features.
741 // Revision 1.1 1998/01/07 23:50:51 curt
742 // "area" renamed to "tile"
744 // Revision 1.2 1998/01/07 03:29:29 curt
745 // Given an arbitrary lat/lon, we can now:
746 // generate a unique index for the chunk containing the lat/lon
747 // generate a path name to the chunk file
748 // build a list of the indexes of all the nearby areas.
750 // Revision 1.1 1998/01/07 02:05:48 curt