data file rather than calculating it on the fly.
Fixed polygon winding problem in scenery generation stage rather than
compensating for it on the fly.
Made a fgTILECACHE class.
/* Load a .obj file and generate the GL call list */
GLint fgObjLoad(char *path, fgCartesianPoint3d *ref, double *radius) {
fgOPTIONS *o;
- fgCartesianPoint3d cp;
fgPolarPoint3d pp;
- char fgpath[256], line[256], winding_str[256];
- double approx_normal[3], normal[3], scale, dist;
+ char fgpath[256], line[256], material[256];
+ double approx_normal[3], normal[3], scale;
// double x, y, z, xmax, xmin, ymax, ymin, zmax, zmin;
// GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 };
GLint tile;
fgFile f;
int first, ncount, vncount, n1, n2, n3, n4;
- int winding;
int last1, last2, odd;
o = ¤t_options;
tile = xglGenLists(1);
xglNewList(tile, GL_COMPILE);
- /*
- xglTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- xglTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- xglTexGenfv(GL_S, GL_OBJECT_PLANE, sgenparams);
- xglTexGenfv(GL_T, GL_OBJECT_PLANE, sgenparams);
- // xglTexGenfv(GL_S, GL_SPHERE_MAP, 0);
- // xglTexGenfv(GL_T, GL_SPHERE_MAP, 0);
- xglEnable(GL_TEXTURE_GEN_S);
- xglEnable(GL_TEXTURE_GEN_T);
- */
-
first = 1;
ncount = 1;
vncount = 1;
/* comment -- ignore */
} else if ( line[0] == '\n' ) {
/* empty line -- ignore */
- } else if ( strncmp(line, "ref ", 4) == 0 ) {
+ } else if ( strncmp(line, "gb ", 3) == 0 ) {
/* reference point (center offset) */
- sscanf(line, "ref %lf %lf %lf\n", &ref->x, &ref->y, &ref->z);
+ sscanf(line, "gb %lf %lf %lf %lf\n", &ref->x, &ref->y, &ref->z,
+ radius);
} else if ( strncmp(line, "v ", 2) == 0 ) {
/* node (vertex) */
if ( ncount < MAXNODES ) {
&nodes[ncount][2]);
// temporary code to calculate bounding radius
- dist = calc_dist(nodes[ncount]);
+ // dist = calc_dist(nodes[ncount]);
// printf("node = %.2f %.2f %.2f dist = %.2f\n",
// nodes[ncount][0], nodes[ncount][1], nodes[ncount][2],
// dist);
- if ( (dist > *radius) && (dist < 100000.0) ) {
- *radius = dist;
- }
+ // if ( (dist > *radius) && (dist < 100000.0) ) {
+ // *radius = dist;
+ // }
ncount++;
} else {
fgPrintf( FG_TERRAIN, FG_EXIT,
"Read too many vertex normals ... dying :-(\n");
}
- } else if ( strncmp(line, "winding ", 8) == 0 ) {
- sscanf(line+8, "%s", winding_str);
- fgPrintf( FG_TERRAIN, FG_DEBUG, " WINDING = %s\n", winding_str);
-
- /* can't call xglFrontFace() between xglBegin() & xglEnd() */
- xglEnd();
- first = 1;
-
- if ( strcmp(winding_str, "cw") == 0 ) {
- xglFrontFace( GL_CW );
- winding = 0;
- } else {
- glFrontFace ( GL_CCW );
- winding = 1;
- }
+ } else if ( strncmp(line, "usemtl ", 7) == 0 ) {
+ /* material property specification */
+ sscanf(line, "usemtl %s\n", material);
} else if ( line[0] == 't' ) {
/* start a new triangle strip */
xglBegin(GL_TRIANGLE_STRIP);
- if ( winding ) {
- odd = 1;
- scale = 1.0;
- } else {
- odd = 0;
- scale = 1.0;
- }
+ odd = 1;
+ scale = 1.0;
if ( o->shading ) {
// Shading model is "GL_SMOOTH" so use precalculated
xglEnd();
*/
- // xglDisable(GL_TEXTURE_GEN_S);
- // xglDisable(GL_TEXTURE_GEN_T);
-
- xglFrontFace ( GL_CCW );
-
xglEndList();
fgclose(f);
/* $Log$
-/* Revision 1.4 1998/05/16 13:09:57 curt
-/* Beginning to add support for view frustum culling.
-/* Added some temporary code to calculate bouding radius, until the
-/* scenery generation tools and scenery can be updated.
+/* Revision 1.5 1998/05/20 20:53:53 curt
+/* Moved global ref point and radius (bounding sphere info, and offset) to
+/* data file rather than calculating it on the fly.
+/* Fixed polygon winding problem in scenery generation stage rather than
+/* compensating for it on the fly.
+/* Made a fgTILECACHE class.
/*
+ * Revision 1.4 1998/05/16 13:09:57 curt
+ * Beginning to add support for view frustum culling.
+ * Added some temporary code to calculate bouding radius, until the
+ * scenery generation tools and scenery can be updated.
+ *
* Revision 1.3 1998/05/03 00:48:01 curt
* Updated texture coordinate fmod() parameter.
*
-/**************************************************************************
- * tilecache.cxx -- routines to handle scenery tile caching
- *
- * Written by Curtis Olson, started January 1998.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
+// tilecache.cxx -- routines to handle scenery tile caching
+//
+// Written by Curtis Olson, started January 1998.
+//
+// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+// (Log is kept at end of this file)
#ifdef HAVE_CONFIG_H
#include "tilecache.hxx"
-/* tile cache */
-struct fgTILE tile_cache[FG_TILE_CACHE_SIZE];
+// the tile cache
+fgTILECACHE global_tile_cache;
-/* Initialize the tile cache subsystem */
-void fgTileCacheInit( void ) {
+// Constructor
+fgTILECACHE::fgTILECACHE( void ) {
+}
+
+
+// Initialize the tile cache subsystem
+void fgTILECACHE::Init( void ) {
int i;
fgPrintf(FG_TERRAIN, FG_INFO, "Initializing the tile cache.\n");
}
-/* Search for the specified "bucket" in the cache */
-int fgTileCacheExists( struct fgBUCKET *p ) {
+// Search for the specified "bucket" in the cache
+int fgTILECACHE::Exists( struct fgBUCKET *p ) {
int i;
for ( i = 0; i < FG_TILE_CACHE_SIZE; i++ ) {
}
-/* Fill in a tile cache entry with real data for the specified bucket */
-void fgTileCacheEntryFillIn( int index, struct fgBUCKET *p ) {
+// Fill in a tile cache entry with real data for the specified bucket
+void fgTILECACHE::EntryFillIn( int index, struct fgBUCKET *p ) {
fgOPTIONS *o;
char base_path[256];
char file_name[256];
o = ¤t_options;
- /* Mark this cache entry as used */
+ // Mark this cache entry as used
tile_cache[index].used = 1;
- /* Update the bucket */
+ // Update the bucket
tile_cache[index].tile_bucket.lon = p->lon;
tile_cache[index].tile_bucket.lat = p->lat;
tile_cache[index].tile_bucket.x = p->x;
tile_cache[index].tile_bucket.y = p->y;
- /* Load the appropriate area and get the display list pointer */
+ // Load the appropriate area and get the display list pointer
fgBucketGenBasePath(p, base_path);
sprintf(file_name, "%s/Scenery/%s/%ld", o->fg_root,
base_path, fgBucketGenIndex(p));
}
-/* Free a tile cache entry */
-void fgTileCacheEntryFree( int index ) {
- /* Mark this cache entry as un-used */
+// Free a tile cache entry
+void fgTILECACHE::EntryFree( int index ) {
+ // Mark this cache entry as un-used
tile_cache[index].used = 0;
- /* Update the bucket */
+ // Update the bucket
fgPrintf( FG_TERRAIN, FG_DEBUG,
"FREEING TILE = (%d %d %d %d)\n",
tile_cache[index].tile_bucket.lon,
tile_cache[index].tile_bucket.x,
tile_cache[index].tile_bucket.y );
- /* Load the appropriate area and get the display list pointer */
+ // Load the appropriate area and get the display list pointer
if ( tile_cache[index].display_list >= 0 ) {
xglDeleteLists( tile_cache[index].display_list, 1 );
}
}
-/* Return info for a tile cache entry */
-void fgTileCacheEntryInfo( int index, GLint *display_list,
+// Return info for a tile cache entry
+void fgTILECACHE::EntryInfo( int index, GLint *display_list,
fgCartesianPoint3d *local_ref,
double *radius ) {
*display_list = tile_cache[index].display_list;
- /* fgPrintf(FG_TERRAIN, FG_DEBUG, "Display list = %d\n", *display_list); */
+ // fgPrintf(FG_TERRAIN, FG_DEBUG, "Display list = %d\n", *display_list);
local_ref->x = tile_cache[index].local_ref.x;
local_ref->y = tile_cache[index].local_ref.y;
}
-/* Return index of next available slot in tile cache */
-int fgTileCacheNextAvail( void ) {
+// Return index of next available slot in tile cache
+int fgTILECACHE::NextAvail( void ) {
fgVIEW *v;
int i;
float dx, dy, dz, max, med, min, tmp;
if ( tile_cache[i].used == 0 ) {
return(i);
} else {
- /* calculate approximate distance from view point */
+ // calculate approximate distance from view point
fgPrintf( FG_TERRAIN, FG_DEBUG,
"DIST Abs view pos = %.4f, %.4f, %.4f\n",
v->abs_view_pos.x, v->abs_view_pos.y, v->abs_view_pos.z );
}
}
- /* If we made it this far, then there were no open cache entries.
- * We will instead free the furthest cache entry and return it's
- * index. */
+ // If we made it this far, then there were no open cache entries.
+ // We will instead free the furthest cache entry and return it's
+ // index.
- fgTileCacheEntryFree( max_index );
+ EntryFree( max_index );
return( max_index );
}
-/* $Log$
-/* Revision 1.8 1998/05/16 13:09:57 curt
-/* Beginning to add support for view frustum culling.
-/* Added some temporary code to calculate bouding radius, until the
-/* scenery generation tools and scenery can be updated.
-/*
- * Revision 1.7 1998/05/13 18:26:41 curt
- * Root path info moved to fgOPTIONS.
- *
- * Revision 1.6 1998/05/02 01:52:17 curt
- * Playing around with texture coordinates.
- *
- * Revision 1.5 1998/04/30 12:35:31 curt
- * Added a command line rendering option specify smooth/flat shading.
- *
- * Revision 1.4 1998/04/28 01:21:43 curt
- * Tweaked texture parameter calculations to keep the number smaller. This
- * avoids the "swimming" problem.
- * Type-ified fgTIME and fgVIEW.
- *
- * Revision 1.3 1998/04/25 22:06:32 curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2 1998/04/24 00:51:08 curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Tweaked the scenery file extentions to be "file.obj" (uncompressed)
- * or "file.obz" (compressed.)
- *
- * Revision 1.1 1998/04/22 13:22:46 curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.11 1998/04/18 04:14:07 curt
- * Moved fg_debug.c to it's own library.
- *
- * Revision 1.10 1998/04/14 02:23:17 curt
- * Code reorganizations. Added a Lib/ directory for more general libraries.
- *
- * Revision 1.9 1998/04/08 23:30:07 curt
- * Adopted Gnu automake/autoconf system.
- *
- * Revision 1.8 1998/04/03 22:11:38 curt
- * Converting to Gnu autoconf system.
- *
- * Revision 1.7 1998/02/01 03:39:55 curt
- * Minor tweaks.
- *
- * Revision 1.6 1998/01/31 00:43:26 curt
- * Added MetroWorks patches from Carmen Volpe.
- *
- * Revision 1.5 1998/01/29 00:51:39 curt
- * First pass at tile cache, dynamic tile loading and tile unloading now works.
- *
- * Revision 1.4 1998/01/27 03:26:43 curt
- * Playing with new fgPrintf command.
- *
- * Revision 1.3 1998/01/27 00:48:03 curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.2 1998/01/26 15:55:24 curt
- * Progressing on building dynamic scenery system.
- *
- * Revision 1.1 1998/01/24 00:03:29 curt
- * Initial revision.
- *
- */
+// Destructor
+fgTILECACHE::~fgTILECACHE( void ) {
+}
+
+
+// $Log$
+// Revision 1.9 1998/05/20 20:53:54 curt
+// Moved global ref point and radius (bounding sphere info, and offset) to
+// data file rather than calculating it on the fly.
+// Fixed polygon winding problem in scenery generation stage rather than
+// compensating for it on the fly.
+// Made a fgTILECACHE class.
+//
+// Revision 1.8 1998/05/16 13:09:57 curt
+// Beginning to add support for view frustum culling.
+// Added some temporary code to calculate bouding radius, until the
+// scenery generation tools and scenery can be updated.
+//
+// Revision 1.7 1998/05/13 18:26:41 curt
+// Root path info moved to fgOPTIONS.
+//
+// Revision 1.6 1998/05/02 01:52:17 curt
+// Playing around with texture coordinates.
+//
+// Revision 1.5 1998/04/30 12:35:31 curt
+// Added a command line rendering option specify smooth/flat shading.
+//
+// Revision 1.4 1998/04/28 01:21:43 curt
+// Tweaked texture parameter calculations to keep the number smaller. This
+// avoids the "swimming" problem.
+// Type-ified fgTIME and fgVIEW.
+//
+// Revision 1.3 1998/04/25 22:06:32 curt
+// Edited cvs log messages in source files ... bad bad bad!
+//
+// Revision 1.2 1998/04/24 00:51:08 curt
+// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
+// Tweaked the scenery file extentions to be "file.obj" (uncompressed)
+// or "file.obz" (compressed.)
+//
+// Revision 1.1 1998/04/22 13:22:46 curt
+// C++ - ifing the code a bit.
+//
+// Revision 1.11 1998/04/18 04:14:07 curt
+// Moved fg_debug.c to it's own library.
+//
+// Revision 1.10 1998/04/14 02:23:17 curt
+// Code reorganizations. Added a Lib/ directory for more general libraries.
+//
+// Revision 1.9 1998/04/08 23:30:07 curt
+// Adopted Gnu automake/autoconf system.
+//
+// Revision 1.8 1998/04/03 22:11:38 curt
+// Converting to Gnu autoconf system.
+//
+// Revision 1.7 1998/02/01 03:39:55 curt
+// Minor tweaks.
+//
+// Revision 1.6 1998/01/31 00:43:26 curt
+// Added MetroWorks patches from Carmen Volpe.
+//
+// Revision 1.5 1998/01/29 00:51:39 curt
+// First pass at tile cache, dynamic tile loading and tile unloading now works.
+//
+// Revision 1.4 1998/01/27 03:26:43 curt
+// Playing with new fgPrintf command.
+//
+// Revision 1.3 1998/01/27 00:48:03 curt
+// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
+// system and commandline/config file processing code.
+//
+// Revision 1.2 1998/01/26 15:55:24 curt
+// Progressing on building dynamic scenery system.
+//
+// Revision 1.1 1998/01/24 00:03:29 curt
+// Initial revision.
+
-/**************************************************************************
- * tilecache.hxx -- routines to handle scenery tile caching
- *
- * Written by Curtis Olson, started January 1998.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
+// tilecache.hxx -- routines to handle scenery tile caching
+//
+// Written by Curtis Olson, started January 1998.
+//
+// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+// (Log is kept at end of this file)
#ifndef _TILECACHE_HXX
#include <Bucket/bucketutils.h>
#include <Include/fg_types.h>
-/* For best results ... i.e. to avoid tile load problems and blank areas
- *
- * FG_TILE_CACHE_SIZE >= (o->tile_diameter + 1) ** 2 */
+// For best results ... i.e. to avoid tile load problems and blank areas
+//
+// FG_TILE_CACHE_SIZE >= (o->tile_diameter + 1) ** 2
#define FG_TILE_CACHE_SIZE 121
-/* Tile cache record */
-struct fgTILE {
+// Tile cache record
+typedef struct {
struct fgBUCKET tile_bucket;
GLint display_list;
fgCartesianPoint3d local_ref;
double bounding_radius;
int used;
int priority;
+} fgTILE;
+
+
+// A class to store and manage a pile of tiles
+class fgTILECACHE {
+ // cache storage space
+ fgTILE tile_cache[FG_TILE_CACHE_SIZE];
+
+public:
+
+ // Constructor
+ fgTILECACHE( void );
+
+ // Initialize the tile cache subsystem
+ void Init( void );
+
+ // Search for the specified "bucket" in the cache
+ int Exists( struct fgBUCKET *p );
+
+ // Return index of next available slot in tile cache
+ int NextAvail( void );
+
+ // Free a tile cache entry
+ void fgTILECACHE::EntryFree( int index );
+
+ // Fill in a tile cache entry with real data for the specified bucket
+ void EntryFillIn( int index, struct fgBUCKET *p );
+
+ // Return info for a tile cache entry
+ void EntryInfo( int index, GLint *display_list,
+ fgCartesianPoint3d *local_ref, double *radius );
+
+ // Destructor
+ ~fgTILECACHE( void );
};
-/* tile cache */
-extern struct fgTILE tile_cache[FG_TILE_CACHE_SIZE];
-
-
-/* Initialize the tile cache subsystem */
-void fgTileCacheInit( void );
-
-/* Search for the specified "bucket" in the cache */
-int fgTileCacheExists( struct fgBUCKET *p );
-
-/* Return index of next available slot in tile cache */
-int fgTileCacheNextAvail( void );
-
-/* Fill in a tile cache entry with real data for the specified bucket */
-void fgTileCacheEntryFillIn( int index, struct fgBUCKET *p );
-
-/* Return info for a tile cache entry */
-void fgTileCacheEntryInfo( int index, GLint *display_list,
- fgCartesianPoint3d *local_ref,
- double *radius );
-
-
-#endif /* _TILECACHE_HXX */
-
-
-/* $Log$
-/* Revision 1.7 1998/05/16 13:09:57 curt
-/* Beginning to add support for view frustum culling.
-/* Added some temporary code to calculate bouding radius, until the
-/* scenery generation tools and scenery can be updated.
-/*
- * Revision 1.6 1998/05/07 23:15:20 curt
- * Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
- * Added support for --tile-radius=n option.
- *
- * Revision 1.5 1998/05/02 01:52:17 curt
- * Playing around with texture coordinates.
- *
- * Revision 1.4 1998/04/30 12:35:31 curt
- * Added a command line rendering option specify smooth/flat shading.
- *
- * Revision 1.3 1998/04/25 22:06:32 curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2 1998/04/24 00:51:08 curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Tweaked the scenery file extentions to be "file.obj" (uncompressed)
- * or "file.obz" (compressed.)
- *
- * Revision 1.1 1998/04/22 13:22:47 curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.10 1998/04/21 17:02:45 curt
- * Prepairing for C++ integration.
- *
- * Revision 1.9 1998/04/14 02:23:17 curt
- * Code reorganizations. Added a Lib/ directory for more general libraries.
- *
- * Revision 1.8 1998/04/08 23:30:08 curt
- * Adopted Gnu automake/autoconf system.
- *
- * Revision 1.7 1998/04/03 22:11:38 curt
- * Converting to Gnu autoconf system.
- *
- * Revision 1.6 1998/02/18 15:07:10 curt
- * Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
- * drivers will work.)
- *
- * Revision 1.5 1998/02/16 13:39:45 curt
- * Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
- * tiles to occasionally be missing.
- *
- * Revision 1.4 1998/01/31 00:43:27 curt
- * Added MetroWorks patches from Carmen Volpe.
- *
- * Revision 1.3 1998/01/29 00:51:40 curt
- * First pass at tile cache, dynamic tile loading and tile unloading now works.
- *
- * Revision 1.2 1998/01/27 00:48:04 curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.1 1998/01/24 00:03:29 curt
- * Initial revision.
- *
- */
+
+// the tile cache
+extern fgTILECACHE global_tile_cache;
+
+
+#endif // _TILECACHE_HXX
+
+
+// $Log$
+// Revision 1.8 1998/05/20 20:53:54 curt
+// Moved global ref point and radius (bounding sphere info, and offset) to
+// data file rather than calculating it on the fly.
+// Fixed polygon winding problem in scenery generation stage rather than
+// compensating for it on the fly.
+// Made a fgTILECACHE class.
+//
+// Revision 1.7 1998/05/16 13:09:57 curt
+// Beginning to add support for view frustum culling.
+// Added some temporary code to calculate bouding radius, until the
+// scenery generation tools and scenery can be updated.
+//
+// Revision 1.6 1998/05/07 23:15:20 curt
+// Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
+// Added support for --tile-radius=n option.
+//
+// Revision 1.5 1998/05/02 01:52:17 curt
+// Playing around with texture coordinates.
+//
+// Revision 1.4 1998/04/30 12:35:31 curt
+// Added a command line rendering option specify smooth/flat shading.
+//
+// Revision 1.3 1998/04/25 22:06:32 curt
+// Edited cvs log messages in source files ... bad bad bad!
+//
+// Revision 1.2 1998/04/24 00:51:08 curt
+// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
+// Tweaked the scenery file extentions to be "file.obj" (uncompressed)
+// or "file.obz" (compressed.)
+//
+// Revision 1.1 1998/04/22 13:22:47 curt
+// C++ - ifing the code a bit.
+//
+// Revision 1.10 1998/04/21 17:02:45 curt
+// Prepairing for C++ integration.
+//
+// Revision 1.9 1998/04/14 02:23:17 curt
+// Code reorganizations. Added a Lib/ directory for more general libraries.
+//
+// Revision 1.8 1998/04/08 23:30:08 curt
+// Adopted Gnu automake/autoconf system.
+//
+// Revision 1.7 1998/04/03 22:11:38 curt
+// Converting to Gnu autoconf system.
+//
+// Revision 1.6 1998/02/18 15:07:10 curt
+// Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
+// drivers will work.)
+//
+// Revision 1.5 1998/02/16 13:39:45 curt
+// Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
+// tiles to occasionally be missing.
+//
+// Revision 1.4 1998/01/31 00:43:27 curt
+// Added MetroWorks patches from Carmen Volpe.
+//
+// Revision 1.3 1998/01/29 00:51:40 curt
+// First pass at tile cache, dynamic tile loading and tile unloading now works.
+//
+// Revision 1.2 1998/01/27 00:48:04 curt
+// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
+// system and commandline/config file processing code.
+//
+// Revision 1.1 1998/01/24 00:03:29 curt
+// Initial revision.
-/*
- * tilemgr.cxx -- routines to handle dynamic management of scenery tiles
- *
- * Written by Curtis Olson, started January 1998.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
+// tilemgr.cxx -- routines to handle dynamic management of scenery tiles
+//
+// Written by Curtis Olson, started January 1998.
+//
+// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+// (Log is kept at end of this file)
#ifdef HAVE_CONFIG_H
#include <Math/mat3.h>
-#define FG_LOCAL_X_Y 81 /* max(o->tile_diameter) ** 2 */
+#define FG_LOCAL_X_Y 81 // max(o->tile_diameter) ** 2
-/* closest (potentially viewable) tiles, centered on current tile.
- * This is an array of pointers to cache indexes. */
+// closest (potentially viewable) tiles, centered on current tile.
+// This is an array of pointers to cache indexes.
int tiles[FG_LOCAL_X_Y];
-/* Initialize the Tile Manager subsystem */
+// Initialize the Tile Manager subsystem
int fgTileMgrInit( void ) {
fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
return 1;
}
-/* load a tile */
+// load a tile
void fgTileMgrLoadTile( struct fgBUCKET *p, int *index) {
+ fgTILECACHE *c;
+
+ c = &global_tile_cache;
+
fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n",
p->lon, p->lat, p->x, p->y);
- /* if not in cache, load tile into the next available slot */
- if ( (*index = fgTileCacheExists(p)) < 0 ) {
- *index = fgTileCacheNextAvail();
- fgTileCacheEntryFillIn(*index, p);
+ // if not in cache, load tile into the next available slot
+ if ( (*index = c->Exists(p)) < 0 ) {
+ *index = c->NextAvail();
+ c->EntryFillIn(*index, p);
}
fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
}
-/* given the current lon/lat, fill in the array of local chunks. If
- * the chunk isn't already in the cache, then read it from disk. */
+// given the current lon/lat, fill in the array of local chunks. If
+// the chunk isn't already in the cache, then read it from disk.
int fgTileMgrUpdate( void ) {
+ fgTILECACHE *c;
fgFLIGHT *f;
fgOPTIONS *o;
struct fgBUCKET p1, p2;
static struct fgBUCKET p_last = {-1000, 0, 0, 0};
int i, j, dw, dh;
+ c = &global_tile_cache;
f = current_aircraft.flight;
o = ¤t_options;
if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
(p1.x == p_last.x) && (p1.y == p_last.y) ) {
- /* same bucket as last time */
+ // same bucket as last time
fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
} else if ( p_last.lon == -1000 ) {
- /* First time through, initialize the system and load all
- * relavant tiles */
+ // First time through, initialize the system and load all
+ // relavant tiles
fgPrintf( FG_TERRAIN, FG_INFO, " First time through ... ");
fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
o->tile_diameter * o->tile_diameter);
- /* wipe tile cache */
- fgTileCacheInit();
+ // wipe/initialize tile cache
+ c->Init();
- /* build the local area list and update cache */
+ // build the local area list and update cache
for ( j = 0; j < o->tile_diameter; j++ ) {
for ( i = 0; i < o->tile_diameter; i++ ) {
fgBucketOffset(&p1, &p2, i - dw, j - dh);
}
}
} else {
- /* We've moved to a new bucket, we need to scroll our
- * structures, and load in the new tiles */
+ // We've moved to a new bucket, we need to scroll our
+ // structures, and load in the new tiles
- /* CURRENTLY THIS ASSUMES WE CAN ONLY MOVE TO ADJACENT TILES.
- AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
- THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION. */
+ // CURRENTLY THIS ASSUMES WE CAN ONLY MOVE TO ADJACENT TILES.
+ // AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
+ // THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION.
fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n",
p1.lon, p1.lat, p1.x, p1.y);
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
o->tile_diameter);
for ( j = 0; j < o->tile_diameter; j++ ) {
- /* scrolling East */
+ // scrolling East
for ( i = 0; i < o->tile_diameter - 1; i++ ) {
- tiles[(j*o->tile_diameter) + i] = tiles[(j*o->tile_diameter) + i + 1];
+ tiles[(j*o->tile_diameter) + i] =
+ tiles[(j*o->tile_diameter) + i + 1];
}
- /* load in new column */
+ // load in new column
fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
- fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + o->tile_diameter - 1]);
+ fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) +
+ o->tile_diameter - 1]);
}
} else if ( (p1.lon < p_last.lon) ||
( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
o->tile_diameter);
for ( j = 0; j < o->tile_diameter; j++ ) {
- /* scrolling West */
+ // scrolling West
for ( i = o->tile_diameter - 1; i > 0; i-- ) {
- tiles[(j*o->tile_diameter) + i] = tiles[(j*o->tile_diameter) + i - 1];
+ tiles[(j*o->tile_diameter) + i] =
+ tiles[(j*o->tile_diameter) + i - 1];
}
- /* load in new column */
+ // load in new column
fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + 0]);
}
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
o->tile_diameter);
for ( i = 0; i < o->tile_diameter; i++ ) {
- /* scrolling North */
+ // scrolling North
for ( j = 0; j < o->tile_diameter - 1; j++ ) {
tiles[(j * o->tile_diameter) + i] =
tiles[((j+1) * o->tile_diameter) + i];
}
- /* load in new column */
+ // load in new column
fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
- fgTileMgrLoadTile(&p2, &tiles[((o->tile_diameter-1)*o->tile_diameter) + i]);
+ fgTileMgrLoadTile(&p2, &tiles[((o->tile_diameter-1) *
+ o->tile_diameter) + i]);
}
} else if ( (p1.lat < p_last.lat) ||
( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
o->tile_diameter);
for ( i = 0; i < o->tile_diameter; i++ ) {
- /* scrolling South */
+ // scrolling South
for ( j = o->tile_diameter - 1; j > 0; j-- ) {
tiles[(j * o->tile_diameter) + i] =
tiles[((j-1) * o->tile_diameter) + i];
}
- /* load in new column */
+ // load in new column
fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
fgTileMgrLoadTile(&p2, &tiles[0 + i]);
}
// Calculate if point/radius is inside view frustum
-//
static int viewable( fgCartesianPoint3d *cp, double radius ) {
fgVIEW *v;
MAT3hvec world, eye;
}
-/* Render the local tiles */
+// Render the local tiles
void fgTileMgrRender( void ) {
+ fgTILECACHE *c;
fgFLIGHT *f;
fgOPTIONS *o;
fgVIEW *v;
int culled = 0;
int drawn = 0;
+ c = &global_tile_cache;
f = current_aircraft.flight;
o = ¤t_options;
v = ¤t_view;
- /* Find current translation offset */
+ // Find current translation offset
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
- index = fgTileCacheExists(&p);
- fgTileCacheEntryInfo(index, &display_list, &scenery.next_center, &radius );
+ index = c->Exists(&p);
+ c->EntryInfo(index, &display_list, &scenery.next_center, &radius );
fgPrintf( FG_TERRAIN, FG_DEBUG,
"Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n",
for ( i = 0; i < (o->tile_diameter * o->tile_diameter); i++ ) {
index = tiles[i];
- /* fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index); */
- fgTileCacheEntryInfo(index, &display_list, &local_ref, &radius );
+ // fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index);
+ c->EntryInfo(index, &display_list, &local_ref, &radius );
if ( display_list >= 0 ) {
}
-/* $Log$
-/* Revision 1.10 1998/05/17 16:59:34 curt
-/* Frist pass at view frustum culling now operational.
-/*
- * Revision 1.9 1998/05/16 13:09:58 curt
- * Beginning to add support for view frustum culling.
- * Added some temporary code to calculate bouding radius, until the
- * scenery generation tools and scenery can be updated.
- *
- * Revision 1.8 1998/05/07 23:15:21 curt
- * Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
- * Added support for --tile-radius=n option.
- *
- * Revision 1.7 1998/05/06 03:16:42 curt
- * Added an option to control square tile radius.
- *
- * Revision 1.6 1998/05/02 01:52:18 curt
- * Playing around with texture coordinates.
- *
- * Revision 1.5 1998/04/30 12:35:32 curt
- * Added a command line rendering option specify smooth/flat shading.
- *
- * Revision 1.4 1998/04/27 03:30:14 curt
- * Minor transformation adjustments to try to keep scenery tiles closer to
- * (0, 0, 0) GLfloats run out of precision at the distances we need to model
- * the earth, but we can do a bunch of pre-transformations using double math
- * and then cast to GLfloat once everything is close in where we have less
- * precision problems.
- *
- * Revision 1.3 1998/04/25 22:06:32 curt
- * Edited cvs log messages in source files ... bad bad bad!
- *
- * Revision 1.2 1998/04/24 00:51:09 curt
- * Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
- * Tweaked the scenery file extentions to be "file.obj" (uncompressed)
- * or "file.obz" (compressed.)
- *
- * Revision 1.1 1998/04/22 13:22:48 curt
- * C++ - ifing the code a bit.
- *
- * Revision 1.25 1998/04/18 04:14:07 curt
- * Moved fg_debug.c to it's own library.
- *
- * Revision 1.24 1998/04/14 02:23:18 curt
- * Code reorganizations. Added a Lib/ directory for more general libraries.
- *
- * Revision 1.23 1998/04/08 23:30:08 curt
- * Adopted Gnu automake/autoconf system.
- *
- * Revision 1.22 1998/04/03 22:11:38 curt
- * Converting to Gnu autoconf system.
- *
- * Revision 1.21 1998/03/23 21:23:05 curt
- * Debugging output tweaks.
- *
- * Revision 1.20 1998/03/14 00:30:51 curt
- * Beginning initial terrain texturing experiments.
- *
- * Revision 1.19 1998/02/20 00:16:25 curt
- * Thursday's tweaks.
- *
- * Revision 1.18 1998/02/19 13:05:54 curt
- * Incorporated some HUD tweaks from Michelle America.
- * Tweaked the sky's sunset/rise colors.
- * Other misc. tweaks.
- *
- * Revision 1.17 1998/02/16 13:39:46 curt
- * Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
- * tiles to occasionally be missing.
- *
- * Revision 1.16 1998/02/12 21:59:53 curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.14 1998/02/09 21:30:19 curt
- * Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
- *
- * Revision 1.13 1998/02/07 15:29:46 curt
- * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.12 1998/02/01 03:39:55 curt
- * Minor tweaks.
- *
- * Revision 1.11 1998/01/31 00:43:27 curt
- * Added MetroWorks patches from Carmen Volpe.
- *
- * Revision 1.10 1998/01/29 00:51:40 curt
- * First pass at tile cache, dynamic tile loading and tile unloading now works.
- *
- * Revision 1.9 1998/01/27 03:26:44 curt
- * Playing with new fgPrintf command.
- *
- * Revision 1.8 1998/01/27 00:48:04 curt
- * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
- * system and commandline/config file processing code.
- *
- * Revision 1.7 1998/01/26 15:55:25 curt
- * Progressing on building dynamic scenery system.
- *
- * Revision 1.6 1998/01/24 00:03:30 curt
- * Initial revision.
- *
- * Revision 1.5 1998/01/19 19:27:18 curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.4 1998/01/19 18:40:38 curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.3 1998/01/13 00:23:11 curt
- * Initial changes to support loading and management of scenery tiles. Note,
- * there's still a fair amount of work left to be done.
- *
- * Revision 1.2 1998/01/08 02:22:27 curt
- * Continue working on basic features.
- *
- * Revision 1.1 1998/01/07 23:50:51 curt
- * "area" renamed to "tile"
- *
- * Revision 1.2 1998/01/07 03:29:29 curt
- * Given an arbitrary lat/lon, we can now:
- * generate a unique index for the chunk containing the lat/lon
- * generate a path name to the chunk file
- * build a list of the indexes of all the nearby areas.
- *
- * Revision 1.1 1998/01/07 02:05:48 curt
- * Initial revision.
- * */
-
-
+// $Log$
+// Revision 1.11 1998/05/20 20:53:55 curt
+// Moved global ref point and radius (bounding sphere info, and offset) to
+// data file rather than calculating it on the fly.
+// Fixed polygon winding problem in scenery generation stage rather than
+// compensating for it on the fly.
+// Made a fgTILECACHE class.
+//
+// Revision 1.10 1998/05/17 16:59:34 curt
+// Frist pass at view frustum culling now operational.
+//
+// Revision 1.9 1998/05/16 13:09:58 curt
+// Beginning to add support for view frustum culling.
+// Added some temporary code to calculate bouding radius, until the
+// scenery generation tools and scenery can be updated.
+//
+// Revision 1.8 1998/05/07 23:15:21 curt
+// Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
+// Added support for --tile-radius=n option.
+//
+// Revision 1.7 1998/05/06 03:16:42 curt
+// Added an option to control square tile radius.
+//
+// Revision 1.6 1998/05/02 01:52:18 curt
+// Playing around with texture coordinates.
+//
+// Revision 1.5 1998/04/30 12:35:32 curt
+// Added a command line rendering option specify smooth/flat shading.
+//
+// Revision 1.4 1998/04/27 03:30:14 curt
+// Minor transformation adjustments to try to keep scenery tiles closer to
+// (0, 0, 0) GLfloats run out of precision at the distances we need to model
+// the earth, but we can do a bunch of pre-transformations using double math
+// and then cast to GLfloat once everything is close in where we have less
+// precision problems.
+//
+// Revision 1.3 1998/04/25 22:06:32 curt
+// Edited cvs log messages in source files ... bad bad bad!
+//
+// Revision 1.2 1998/04/24 00:51:09 curt
+// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
+// Tweaked the scenery file extentions to be "file.obj" (uncompressed)
+// or "file.obz" (compressed.)
+//
+// Revision 1.1 1998/04/22 13:22:48 curt
+// C++ - ifing the code a bit.
+//
+// Revision 1.25 1998/04/18 04:14:07 curt
+// Moved fg_debug.c to it's own library.
+//
+// Revision 1.24 1998/04/14 02:23:18 curt
+// Code reorganizations. Added a Lib/ directory for more general libraries.
+//
+// Revision 1.23 1998/04/08 23:30:08 curt
+// Adopted Gnu automake/autoconf system.
+//
+// Revision 1.22 1998/04/03 22:11:38 curt
+// Converting to Gnu autoconf system.
+//
+// Revision 1.21 1998/03/23 21:23:05 curt
+// Debugging output tweaks.
+//
+// Revision 1.20 1998/03/14 00:30:51 curt
+// Beginning initial terrain texturing experiments.
+//
+// Revision 1.19 1998/02/20 00:16:25 curt
+// Thursday's tweaks.
+//
+// Revision 1.18 1998/02/19 13:05:54 curt
+// Incorporated some HUD tweaks from Michelle America.
+// Tweaked the sky's sunset/rise colors.
+// Other misc. tweaks.
+//
+// Revision 1.17 1998/02/16 13:39:46 curt
+// Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
+// tiles to occasionally be missing.
+//
+// Revision 1.16 1998/02/12 21:59:53 curt
+// Incorporated code changes contributed by Charlie Hotchkiss
+// <chotchkiss@namg.us.anritsu.com>
+//
+// Revision 1.14 1998/02/09 21:30:19 curt
+// Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
+//
+// Revision 1.13 1998/02/07 15:29:46 curt
+// Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
+// <chotchkiss@namg.us.anritsu.com>
+//
+// Revision 1.12 1998/02/01 03:39:55 curt
+// Minor tweaks.
+//
+// Revision 1.11 1998/01/31 00:43:27 curt
+// Added MetroWorks patches from Carmen Volpe.
+//
+// Revision 1.10 1998/01/29 00:51:40 curt
+// First pass at tile cache, dynamic tile loading and tile unloading now works.
+//
+// Revision 1.9 1998/01/27 03:26:44 curt
+// Playing with new fgPrintf command.
+//
+// Revision 1.8 1998/01/27 00:48:04 curt
+// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
+// system and commandline/config file processing code.
+//
+// Revision 1.7 1998/01/26 15:55:25 curt
+// Progressing on building dynamic scenery system.
+//
+// Revision 1.6 1998/01/24 00:03:30 curt
+// Initial revision.
+//
+// Revision 1.5 1998/01/19 19:27:18 curt
+// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+// This should simplify things tremendously.
+//
+// Revision 1.4 1998/01/19 18:40:38 curt
+// Tons of little changes to clean up the code and to remove fatal errors
+// when building with the c++ compiler.
+//
+// Revision 1.3 1998/01/13 00:23:11 curt
+// Initial changes to support loading and management of scenery tiles. Note,
+// there's still a fair amount of work left to be done.
+//
+// Revision 1.2 1998/01/08 02:22:27 curt
+// Continue working on basic features.
+//
+// Revision 1.1 1998/01/07 23:50:51 curt
+// "area" renamed to "tile"
+//
+// Revision 1.2 1998/01/07 03:29:29 curt
+// Given an arbitrary lat/lon, we can now:
+// generate a unique index for the chunk containing the lat/lon
+// generate a path name to the chunk file
+// build a list of the indexes of all the nearby areas.
+//
+// Revision 1.1 1998/01/07 02:05:48 curt
+// Initial revision.
-/**************************************************************************
- * tilemgr.hxx -- routines to handle dynamic management of scenery tiles
- *
- * Written by Curtis Olson, started January 1998.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
+// tilemgr.hxx -- routines to handle dynamic management of scenery tiles
+//
+// Written by Curtis Olson, started January 1998.
+//
+// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+// (Log is kept at end of this file)
#ifndef _TILEMGR_HXX
#endif
-/* Initialize the Tile Manager subsystem */
+// Initialize the Tile Manager subsystem
int fgTileMgrInit( void );
-/* given the current lon/lat, fill in the array of local chunks. If
- * the chunk isn't already in the cache, then read it from disk. */
+// given the current lon/lat, fill in the array of local chunks. If
+// the chunk isn't already in the cache, then read it from disk.
int fgTileMgrUpdate( void );
-/* Render the local tiles --- hack, hack, hack */
+// Render the local tiles --- hack, hack, hack
void fgTileMgrRender( void );
-#endif /* _TILEMGR_HXX */
-
-
-/* $Log$
-/* Revision 1.1 1998/04/22 13:22:49 curt
-/* C++ - ifing the code a bit.
-/*
- * Revision 1.6 1998/04/21 17:02:45 curt
- * Prepairing for C++ integration.
- *
- * Revision 1.5 1998/02/12 21:59:53 curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.4 1998/01/22 02:59:42 curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.3 1998/01/19 18:40:38 curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.2 1998/01/13 00:23:11 curt
- * Initial changes to support loading and management of scenery tiles. Note,
- * there's still a fair amount of work left to be done.
- *
- * Revision 1.1 1998/01/07 23:50:51 curt
- * "area" renamed to "tile"
- *
- * */
-
-
+#endif // _TILEMGR_HXX
+
+
+// $Log$
+// Revision 1.2 1998/05/20 20:53:56 curt
+// Moved global ref point and radius (bounding sphere info, and offset) to
+// data file rather than calculating it on the fly.
+// Fixed polygon winding problem in scenery generation stage rather than
+// compensating for it on the fly.
+// Made a fgTILECACHE class.
+//
+// Revision 1.1 1998/04/22 13:22:49 curt
+// C++ - ifing the code a bit.
+//
+// Revision 1.6 1998/04/21 17:02:45 curt
+// Prepairing for C++ integration.
+//
+// Revision 1.5 1998/02/12 21:59:53 curt
+// Incorporated code changes contributed by Charlie Hotchkiss
+// <chotchkiss@namg.us.anritsu.com>
+//
+// Revision 1.4 1998/01/22 02:59:42 curt
+// Changed #ifdef FILE_H to #ifdef _FILE_H
+//
+// Revision 1.3 1998/01/19 18:40:38 curt
+// Tons of little changes to clean up the code and to remove fatal errors
+// when building with the c++ compiler.
+//
+// Revision 1.2 1998/01/13 00:23:11 curt
+// Initial changes to support loading and management of scenery tiles. Note,
+// there's still a fair amount of work left to be done.
+//
+// Revision 1.1 1998/01/07 23:50:51 curt
+// "area" renamed to "tile"