]> git.mxchange.org Git - flightgear.git/blob - Scenery/tilemgr.cxx
Increased per material fragment list size from 100 to 400.
[flightgear.git] / Scenery / tilemgr.cxx
1 // tilemgr.cxx -- routines to handle dynamic management of scenery tiles
2 //
3 // Written by Curtis Olson, started January 1998.
4 //
5 // Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28
29 #ifdef HAVE_WINDOWS_H
30 #  include <windows.h>
31 #endif
32
33 #include <GL/glut.h>
34 #include <XGL/xgl.h>
35
36 #include <Aircraft/aircraft.h>
37
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/mat3.h>
45
46 #include "material.hxx"
47 #include "obj.hxx"
48 #include "scenery.hxx"
49 #include "tilecache.hxx"
50
51
52 #define FG_LOCAL_X_Y         81  // max(o->tile_diameter) ** 2
53
54
55 // closest (potentially viewable) tiles, centered on current tile.
56 // This is an array of pointers to cache indexes.
57 int tiles[FG_LOCAL_X_Y];
58
59
60 // Initialize the Tile Manager subsystem
61 int fgTileMgrInit( void ) {
62     fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
63
64     // load default material library
65     material_mgr.load_lib();
66
67     return 1;
68 }
69
70
71 // load a tile
72 void fgTileMgrLoadTile( struct fgBUCKET *p, int *index) {
73     fgTILECACHE *c;
74
75     c = &global_tile_cache;
76
77     fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n", 
78            p->lon, p->lat, p->x, p->y);
79     
80     // if not in cache, load tile into the next available slot
81     if ( (*index = c->Exists(p)) < 0 ) {
82         *index = c->NextAvail();
83         c->EntryFillIn(*index, p);
84     }
85
86     fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
87 }
88
89
90 // given the current lon/lat, fill in the array of local chunks.  If
91 // the chunk isn't already in the cache, then read it from disk.
92 int fgTileMgrUpdate( void ) {
93     fgTILECACHE *c;
94     fgFLIGHT *f;
95     fgOPTIONS *o;
96     struct fgBUCKET p1, p2;
97     static struct fgBUCKET p_last = {-1000, 0, 0, 0};
98     int i, j, dw, dh;
99
100     c = &global_tile_cache;
101     f = current_aircraft.flight;
102     o = &current_options;
103
104     fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p1);
105     dw = o->tile_diameter / 2;
106     dh = o->tile_diameter / 2;
107
108     if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
109          (p1.x == p_last.x) && (p1.y == p_last.y) ) {
110         // same bucket as last time
111         fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
112     } else if ( p_last.lon == -1000 ) {
113         // First time through, initialize the system and load all
114         // relavant tiles
115
116         fgPrintf( FG_TERRAIN, FG_INFO, "  First time through ... ");
117         fgPrintf( FG_TERRAIN, FG_INFO, "  Updating Tile list for %d,%d %d,%d\n",
118                   p1.lon, p1.lat, p1.x, p1.y);
119         fgPrintf( FG_TERRAIN, FG_INFO, "  Loading %d tiles\n", 
120                   o->tile_diameter * o->tile_diameter);
121
122         // wipe/initialize tile cache
123         c->Init();
124
125         // build the local area list and update cache
126         for ( j = 0; j < o->tile_diameter; j++ ) {
127             for ( i = 0; i < o->tile_diameter; i++ ) {
128                 fgBucketOffset(&p1, &p2, i - dw, j - dh);
129                 fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + i]);
130             }
131         }
132     } else {
133         // We've moved to a new bucket, we need to scroll our
134         // structures, and load in the new tiles
135
136         // CURRENTLY THIS ASSUMES WE CAN ONLY MOVE TO ADJACENT TILES.
137         // AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
138         // THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION.
139
140         fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n",
141                   p1.lon, p1.lat, p1.x, p1.y);
142
143         if ( (p1.lon > p_last.lon) ||
144              ( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
145             fgPrintf( FG_TERRAIN, FG_INFO, "  Loading %d tiles\n", 
146                       o->tile_diameter);
147             for ( j = 0; j < o->tile_diameter; j++ ) {
148                 // scrolling East
149                 for ( i = 0; i < o->tile_diameter - 1; i++ ) {
150                     tiles[(j*o->tile_diameter) + i] = 
151                         tiles[(j*o->tile_diameter) + i + 1];
152                 }
153                 // load in new column
154                 fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
155                 fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + 
156                                              o->tile_diameter - 1]);
157             }
158         } else if ( (p1.lon < p_last.lon) ||
159                     ( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
160             fgPrintf( FG_TERRAIN, FG_INFO, "  Loading %d tiles\n", 
161                       o->tile_diameter);
162             for ( j = 0; j < o->tile_diameter; j++ ) {
163                 // scrolling West
164                 for ( i = o->tile_diameter - 1; i > 0; i-- ) {
165                     tiles[(j*o->tile_diameter) + i] = 
166                         tiles[(j*o->tile_diameter) + i - 1];
167                 }
168                 // load in new column
169                 fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
170                 fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + 0]);
171             }
172         }
173
174         if ( (p1.lat > p_last.lat) ||
175              ( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
176             fgPrintf( FG_TERRAIN, FG_INFO, "  Loading %d tiles\n", 
177                       o->tile_diameter);
178             for ( i = 0; i < o->tile_diameter; i++ ) {
179                 // scrolling North
180                 for ( j = 0; j < o->tile_diameter - 1; j++ ) {
181                     tiles[(j * o->tile_diameter) + i] =
182                         tiles[((j+1) * o->tile_diameter) + i];
183                 }
184                 // load in new column
185                 fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
186                 fgTileMgrLoadTile(&p2, &tiles[((o->tile_diameter-1) * 
187                                                o->tile_diameter) + i]);
188             }
189         } else if ( (p1.lat < p_last.lat) ||
190                     ( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
191             fgPrintf( FG_TERRAIN, FG_INFO, "  Loading %d tiles\n", 
192                       o->tile_diameter);
193             for ( i = 0; i < o->tile_diameter; i++ ) {
194                 // scrolling South
195                 for ( j = o->tile_diameter - 1; j > 0; j-- ) {
196                     tiles[(j * o->tile_diameter) + i] = 
197                         tiles[((j-1) * o->tile_diameter) + i];
198                 }
199                 // load in new column
200                 fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
201                 fgTileMgrLoadTile(&p2, &tiles[0 + i]);
202             }
203         }
204     }
205     p_last.lon = p1.lon;
206     p_last.lat = p1.lat;
207     p_last.x = p1.x;
208     p_last.y = p1.y;
209     return 1;
210 }
211
212
213 // Calculate if point/radius is inside view frustum
214 static int viewable( fgCartesianPoint3d *cp, double radius ) {
215     fgVIEW *v;
216     MAT3hvec world, eye;
217     int viewable = 1; // start by assuming it's viewable
218     double x0, x1, y1, slope;
219
220     v = &current_view;
221
222     MAT3_SET_HVEC(world, cp->x, cp->y, cp->z, 1.0);
223     MAT3mult_vec(eye, world, v->WORLD_TO_EYE);
224     // printf( "\nworld -> eye = %.2f %.2f %.2f  radius = %.2f\n", 
225     //         eye[0], eye[1], eye[2], radius);
226
227     // Check near clip plane
228     if ( eye[2] - radius > 0.0 ) {
229         return(0);
230     }
231
232     // check right clip plane (from eye perspective)
233     // y = m * (x - x0) = equation of a line intercepting X axis at x0
234     x1 = v->cos_fov_x * radius;
235     y1 = v->sin_fov_x * radius;
236     slope = v->slope_x;
237     x0 = x1 - y1 / slope;
238
239     // printf("(r) x1 = %.2f  y1 = %.2f\n", x1, y1);
240     // printf("eye[0] = %.2f  eye[2] = %.2f\n", eye[0], eye[2]);
241     // printf("(r) x0 = %.2f  slope_x = %.2f  radius = %.2f\n", 
242     //        x0, slope, radius);
243
244     if ( eye[2] > slope * (eye[0] - x0) ) {
245         return(0);
246     }
247
248     // check left clip plane (from eye perspective)
249     x1 = -x1;
250     slope = -slope;
251     x0 = x1 - y1 / slope;
252
253     // printf("(r) x1 = %.2f  y1 = %.2f\n", x1, y1);
254     // printf("eye[0] = %.2f  eye[2] = %.2f\n", eye[0], eye[2]);
255     // printf("(r) x0 = %.2f  slope_x = %.2f  radius = %.2f\n", 
256     //        x0, slope, radius);
257
258     if ( eye[2] > slope * (eye[0] - x0) ) {
259         return(0);
260     }
261
262     // check bottom clip plane (from eye perspective)
263     x1 = -(v->cos_fov_y) * radius;
264     y1 = v->sin_fov_y * radius;
265     slope = v->slope_y;
266     x0 = x1 - y1 / slope;
267
268     // printf("(r) x1 = %.2f  y1 = %.2f\n", x1, y1);
269     // printf("eye[1] = %.2f  eye[2] = %.2f\n", eye[1], eye[2]);
270     // printf("(r) x0 = %.2f  slope_y = %.2f  radius = %.2f\n", 
271     //       x0, slope, radius);
272
273     if ( eye[2] > slope * (eye[1] - x0) ) {
274         return(0);
275     }
276
277     // check top clip plane (from eye perspective)
278     x1 = -x1;
279     slope = -slope;
280     x0 = x1 - y1 / slope;
281
282     // printf("(r) x1 = %.2f  y1 = %.2f\n", x1, y1);
283     // printf("eye[1] = %.2f  eye[2] = %.2f\n", eye[1], eye[2]);
284     // printf("(r) x0 = %.2f  slope_y = %.2f  radius = %.2f\n", 
285     //        x0, slope, radius);
286
287     if ( eye[2] > slope * (eye[1] - x0) ) {
288         return(0);
289     }
290
291     return(viewable);
292 }
293
294
295 // Render the local tiles
296 void fgTileMgrRender( void ) {
297     fgTILECACHE *c;
298     fgFLIGHT *f;
299     fgOPTIONS *o;
300     fgTILE *t;
301     fgVIEW *v;
302     struct fgBUCKET p;
303     fgCartesianPoint3d frag_offset, last_offset;
304     fgFRAGMENT *frag_ptr;
305     fgMATERIAL *mtl_ptr;
306     list < fgFRAGMENT > :: iterator current;
307     list < fgFRAGMENT > :: iterator last;
308     int i, size;
309     int index;
310     int culled = 0;
311     int drawn = 0;
312
313     c = &global_tile_cache;
314     f = current_aircraft.flight;
315     o = &current_options;
316     v = &current_view;
317
318     // Find current translation offset
319     fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
320     index = c->Exists(&p);
321     t = c->GetTile(index);
322
323     fgPrintf( FG_TERRAIN, FG_DEBUG, 
324               "Pos = (%.2f, %.2f) Current bucket = %d %d %d %d  Index = %ld\n", 
325               FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
326               p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) );
327
328     // initialize the transient per-material fragment lists
329     material_mgr.init_transient_material_lists();
330
331     // Pass 1
332     // traverse the potentially viewable tile list
333     for ( i = 0; i < (o->tile_diameter * o->tile_diameter); i++ ) {
334         index = tiles[i];
335         // fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index);
336         t = c->GetTile(index);
337
338         // calculate tile offset
339         t->offset.x = t->center.x - scenery.center.x;
340         t->offset.y = t->center.y - scenery.center.y;
341         t->offset.z = t->center.z - scenery.center.z;
342
343         // Course (tile based) culling
344         if ( viewable(&(t->offset), t->bounding_radius) ) {
345             // at least a portion of this tile is viewable
346             
347             // xglPushMatrix();
348             // xglTranslatef(t->offset.x, t->offset.y, t->offset.z);
349
350             // traverse fragment list for tile
351             current = t->fragment_list.begin();
352             last = t->fragment_list.end();
353
354             while ( current != last ) {
355                 frag_ptr = &(*current);
356                 current++;
357                 
358                 if ( frag_ptr->display_list >= 0 ) {
359                     // Fine (fragment based) culling
360                     frag_offset.x = frag_ptr->center.x - scenery.center.x;
361                     frag_offset.y = frag_ptr->center.y - scenery.center.y;
362                     frag_offset.z = frag_ptr->center.z - scenery.center.z;
363
364                     if ( viewable(&frag_offset, frag_ptr->bounding_radius*2) ) {
365                         // add to transient per-material property fragment list
366                         frag_ptr->tile_offset.x = t->offset.x;
367                         frag_ptr->tile_offset.y = t->offset.y;
368                         frag_ptr->tile_offset.z = t->offset.z;
369
370                         mtl_ptr = (fgMATERIAL *)(frag_ptr->material_ptr);
371                         // printf(" lookup = %s\n", mtl_ptr->texture_name);
372                         if ( mtl_ptr->list_size < FG_MAX_MATERIAL_FRAGS ) {
373                             mtl_ptr->list[mtl_ptr->list_size] = frag_ptr;
374                             (mtl_ptr->list_size)++;
375                         } else {
376                             fgPrintf( FG_TERRAIN, FG_ALERT,
377                                       "Overran material sorting array\n" );
378                         }
379
380                         // xglCallList(frag_ptr->display_list);
381                         drawn++;
382                     } else {
383                         // printf("Culled a fragment %.2f %.2f %.2f %.2f\n",
384                         //        frag_ptr->center.x, frag_ptr->center.y,
385                         //        frag_ptr->center.z, frag_ptr->bounding_radius);
386                         culled++;
387                     }
388                 }
389             }
390
391             // xglPopMatrix();
392         } else {
393             culled += t->fragment_list.size();
394         }
395     }
396
397     if ( (drawn + culled) > 0 ) {
398         v->vfc_ratio = (double)culled / (double)(drawn + culled);
399     } else {
400         v->vfc_ratio = 0.0;
401     }
402     // printf("drawn = %d  culled = %d  saved = %.2f\n", drawn, culled, 
403     //        v->vfc_ratio);
404
405     // Pass 2
406     // traverse the transient per-material fragment lists and render
407     // out all fragments for each material property.
408     map < string, fgMATERIAL, less<string> > :: iterator mapcurrent = 
409         material_mgr.material_map.begin();
410     map < string, fgMATERIAL, less<string> > :: iterator maplast = 
411         material_mgr.material_map.end();
412
413     while ( mapcurrent != maplast ) {
414         // (char *)key = (*mapcurrent).first;
415         // (fgMATERIAL)value = (*mapcurrent).second;
416         mtl_ptr = &(*mapcurrent).second;
417
418         last_offset.x = last_offset.y = last_offset.z = -99999999.0;
419         xglPushMatrix();
420
421         size = mtl_ptr->list_size;
422         if ( size > 0 ) {
423             if ( ! o->textures ) {
424                 xglMaterialfv (GL_FRONT, GL_AMBIENT, mtl_ptr->ambient);
425                 xglMaterialfv (GL_FRONT, GL_DIFFUSE, mtl_ptr->diffuse);
426             }
427
428             // printf("traversing = %s, size = %d\n", 
429             //       mtl_ptr->texture_name, size);
430             for ( i = 0; i < size; i++ ) {
431                 frag_ptr = mtl_ptr->list[i];
432                 
433                 if ( (frag_ptr->tile_offset.x == last_offset.x) && 
434                      (frag_ptr->tile_offset.y == last_offset.y) &&
435                      (frag_ptr->tile_offset.z == last_offset.z) ) {
436                     // same tile as last time, no transform necessary
437                 } else {
438                     // new tile, new translate
439                     xglPopMatrix();
440                     xglPushMatrix();
441                     xglTranslatef( frag_ptr->tile_offset.x, 
442                                    frag_ptr->tile_offset.y, 
443                                    frag_ptr->tile_offset.z ); 
444                 }
445             
446                 // Woohoo!!!  We finally get to draw something!
447                 // printf("  display_list = %d\n", frag_ptr->display_list);
448                 xglCallList(frag_ptr->display_list);
449
450                 last_offset = frag_ptr->tile_offset;
451             }
452         }
453
454         xglPopMatrix();
455
456         *mapcurrent++;
457     }
458 }
459
460
461 // $Log$
462 // Revision 1.17  1998/06/06 01:07:18  curt
463 // Increased per material fragment list size from 100 to 400.
464 //
465 // Revision 1.16  1998/06/05 22:39:55  curt
466 // Working on sorting by, and rendering by material properties.
467 //
468 // Revision 1.15  1998/06/03 00:47:51  curt
469 // No .h for STL includes.
470 // Minor view culling optimizations.
471 //
472 // Revision 1.14  1998/06/01 17:56:20  curt
473 // Incremental additions to material.cxx (not fully functional)
474 // Tweaked vfc_ratio math to avoid divide by zero.
475 //
476 // Revision 1.13  1998/05/24 02:49:10  curt
477 // Implimented fragment level view frustum culling.
478 //
479 // Revision 1.12  1998/05/23 14:09:23  curt
480 // Added tile.cxx and tile.hxx.
481 // Working on rewriting the tile management system so a tile is just a list
482 // fragments, and the fragment record contains the display list for that fragment.
483 //
484 // Revision 1.11  1998/05/20 20:53:55  curt
485 // Moved global ref point and radius (bounding sphere info, and offset) to
486 // data file rather than calculating it on the fly.
487 // Fixed polygon winding problem in scenery generation stage rather than
488 // compensating for it on the fly.
489 // Made a fgTILECACHE class.
490 //
491 // Revision 1.10  1998/05/17 16:59:34  curt
492 // Frist pass at view frustum culling now operational.
493 //
494 // Revision 1.9  1998/05/16 13:09:58  curt
495 // Beginning to add support for view frustum culling.
496 // Added some temporary code to calculate bouding radius, until the
497 //   scenery generation tools and scenery can be updated.
498 //
499 // Revision 1.8  1998/05/07 23:15:21  curt
500 // Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
501 // Added support for --tile-radius=n option.
502 //
503 // Revision 1.7  1998/05/06 03:16:42  curt
504 // Added an option to control square tile radius.
505 //
506 // Revision 1.6  1998/05/02 01:52:18  curt
507 // Playing around with texture coordinates.
508 //
509 // Revision 1.5  1998/04/30 12:35:32  curt
510 // Added a command line rendering option specify smooth/flat shading.
511 //
512 // Revision 1.4  1998/04/27 03:30:14  curt
513 // Minor transformation adjustments to try to keep scenery tiles closer to
514 // (0, 0, 0)  GLfloats run out of precision at the distances we need to model
515 // the earth, but we can do a bunch of pre-transformations using double math
516 // and then cast to GLfloat once everything is close in where we have less
517 // precision problems.
518 //
519 // Revision 1.3  1998/04/25 22:06:32  curt
520 // Edited cvs log messages in source files ... bad bad bad!
521 //
522 // Revision 1.2  1998/04/24 00:51:09  curt
523 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
524 // Tweaked the scenery file extentions to be "file.obj" (uncompressed)
525 // or "file.obz" (compressed.)
526 //
527 // Revision 1.1  1998/04/22 13:22:48  curt
528 // C++ - ifing the code a bit.
529 //
530 // Revision 1.25  1998/04/18 04:14:07  curt
531 // Moved fg_debug.c to it's own library.
532 //
533 // Revision 1.24  1998/04/14 02:23:18  curt
534 // Code reorganizations.  Added a Lib/ directory for more general libraries.
535 //
536 // Revision 1.23  1998/04/08 23:30:08  curt
537 // Adopted Gnu automake/autoconf system.
538 //
539 // Revision 1.22  1998/04/03 22:11:38  curt
540 // Converting to Gnu autoconf system.
541 //
542 // Revision 1.21  1998/03/23 21:23:05  curt
543 // Debugging output tweaks.
544 //
545 // Revision 1.20  1998/03/14 00:30:51  curt
546 // Beginning initial terrain texturing experiments.
547 //
548 // Revision 1.19  1998/02/20 00:16:25  curt
549 // Thursday's tweaks.
550 //
551 // Revision 1.18  1998/02/19 13:05:54  curt
552 // Incorporated some HUD tweaks from Michelle America.
553 // Tweaked the sky's sunset/rise colors.
554 // Other misc. tweaks.
555 //
556 // Revision 1.17  1998/02/16 13:39:46  curt
557 // Miscellaneous weekend tweaks.  Fixed? a cache problem that caused whole
558 // tiles to occasionally be missing.
559 //
560 // Revision 1.16  1998/02/12 21:59:53  curt
561 // Incorporated code changes contributed by Charlie Hotchkiss
562 // <chotchkiss@namg.us.anritsu.com>
563 //
564 // Revision 1.14  1998/02/09 21:30:19  curt
565 // Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
566 //
567 // Revision 1.13  1998/02/07 15:29:46  curt
568 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
569 // <chotchkiss@namg.us.anritsu.com>
570 //
571 // Revision 1.12  1998/02/01 03:39:55  curt
572 // Minor tweaks.
573 //
574 // Revision 1.11  1998/01/31 00:43:27  curt
575 // Added MetroWorks patches from Carmen Volpe.
576 //
577 // Revision 1.10  1998/01/29 00:51:40  curt
578 // First pass at tile cache, dynamic tile loading and tile unloading now works.
579 //
580 // Revision 1.9  1998/01/27 03:26:44  curt
581 // Playing with new fgPrintf command.
582 //
583 // Revision 1.8  1998/01/27 00:48:04  curt
584 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
585 // system and commandline/config file processing code.
586 //
587 // Revision 1.7  1998/01/26 15:55:25  curt
588 // Progressing on building dynamic scenery system.
589 //
590 // Revision 1.6  1998/01/24 00:03:30  curt
591 // Initial revision.
592 //
593 // Revision 1.5  1998/01/19 19:27:18  curt
594 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
595 // This should simplify things tremendously.
596 //
597 // Revision 1.4  1998/01/19 18:40:38  curt
598 // Tons of little changes to clean up the code and to remove fatal errors
599 // when building with the c++ compiler.
600 //
601 // Revision 1.3  1998/01/13 00:23:11  curt
602 // Initial changes to support loading and management of scenery tiles.  Note,
603 // there's still a fair amount of work left to be done.
604 //
605 // Revision 1.2  1998/01/08 02:22:27  curt
606 // Continue working on basic features.
607 //
608 // Revision 1.1  1998/01/07 23:50:51  curt
609 // "area" renamed to "tile"
610 //
611 // Revision 1.2  1998/01/07 03:29:29  curt
612 // Given an arbitrary lat/lon, we can now:
613 //   generate a unique index for the chunk containing the lat/lon
614 //   generate a path name to the chunk file
615 //   build a list of the indexes of all the nearby areas.
616 //
617 // Revision 1.1  1998/01/07 02:05:48  curt
618 // Initial revision.