#ifndef TERRAIN_CACHE_H #define TERRAIN_CACHE_H #include "terrain_loader.h" #include #include #include class TerrainCache; struct TerrainCacheObject { typedef boost::shared_ptr p; TerrainCache *cache; float *heights; int x, y, width, height; TerrainCacheObject(TerrainCache *cache, int x, int y, int width, int height); virtual ~TerrainCacheObject(); }; class TerrainCache { friend class TerrainCacheObject; private: typedef std::pair intpair; typedef std::map cache_map; cache_map caches; TerrainLoader *tl; size_t max_size; TerrainCacheObject::p make_object(int x, int y, int width, int height); public: TerrainCache(int seed, fs::path root, size_t max_size); virtual ~TerrainCache(); TerrainCacheObject::p get_chunk(int x, int y, int width, int height); size_t get_size(); }; #endif