1
0
Fork 0
flightgear/Simulator/Scenery/tilecache.hxx

105 lines
2.5 KiB
C++
Raw Normal View History

// 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$
1998-01-24 00:03:27 +00:00
#ifndef _TILECACHE_HXX
#define _TILECACHE_HXX
1998-01-24 00:03:27 +00:00
1998-04-22 13:21:26 +00:00
#ifndef __cplusplus
# error This library requires C++
1998-04-21 17:02:27 +00:00
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
1998-04-03 22:09:02 +00:00
#ifdef HAVE_WINDOWS_H
1998-01-24 00:03:27 +00:00
# include <windows.h>
#endif
#include <GL/glut.h>
#include <XGL/xgl.h>
1999-03-25 19:03:24 +00:00
#include <Bucket/newbucket.hxx>
1998-10-16 00:51:46 +00:00
#include <Math/point3d.hxx>
1998-01-24 00:03:27 +00:00
#include "tile.hxx"
// 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
1998-01-24 00:03:27 +00:00
// A class to store and manage a pile of tiles
class fgTILECACHE {
// enum
// {
// // For best results... i.e. to avoid tile load problems and blank areas
// // FG_TILE_CACHE_SIZE >= (o->tile_diameter + 1) ** 2
// FG_TILE_CACHE_SIZE = 121
// };
// cache storage space
fgTILE tile_cache[ FG_TILE_CACHE_SIZE ];
public:
// Constructor
fgTILECACHE( void );
// Initialize the tile cache subsystem
1998-09-14 12:45:23 +00:00
void init( void );
// Search for the specified "bucket" in the cache
1999-03-25 19:03:24 +00:00
int exists( const FGBucket& p );
// Return index of next available slot in tile cache
1998-09-14 12:45:23 +00:00
int next_avail( void );
// Free a tile cache entry
1998-09-14 12:45:23 +00:00
void entry_free( int index );
// Fill in a tile cache entry with real data for the specified bucket
1999-03-25 19:03:24 +00:00
void fill_in( int index, FGBucket& p );
// Return a pointer to the specified tile cache entry
fgTILE *get_tile( int index ) {
return &tile_cache[index];
}
// Destructor
~fgTILECACHE( void );
1998-01-24 00:03:27 +00:00
};
// the tile cache
extern fgTILECACHE global_tile_cache;
#endif // _TILECACHE_HXX