X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScenery%2Ftilemgr.hxx;h=766513d019053ae7f8b900fa9bbf17eca95b8130;hb=3d4806adbe6705f785fd950bd4b4afde1cb4f8d2;hp=f8e4f4b684394b5f8dcf7f9bd356047cfe88fb3a;hpb=8a756eee5404eefbe88d0899439366b50e491c2a;p=flightgear.git diff --git a/src/Scenery/tilemgr.hxx b/src/Scenery/tilemgr.hxx index f8e4f4b68..766513d01 100644 --- a/src/Scenery/tilemgr.hxx +++ b/src/Scenery/tilemgr.hxx @@ -25,95 +25,90 @@ #define _TILEMGR_HXX #include -#include +#include #include -#include -#include - -class SGReaderWriterBTGOptions; +#include "SceneryPager.hxx" +#include "tileentry.hxx" +#include "tilecache.hxx" namespace osg { class Node; } -class FGTileMgr : public simgear::ModelLoadHelper { +namespace simgear +{ +class SGTerraSync; +class SGReaderWriterOptions; +} + +class FGTileMgr : public SGSubsystem { private: // Tile loading state enum load_state { - Start = 0, - Inited = 1, - Running = 2 + Start = 0, + Inited = 1, + Running = 2 }; - load_state state; - - // initialize the cache - void initialize_queue(); + load_state state, last_state; - // schedule a tile for loading - void sched_tile( const SGBucket& b, const bool is_inner_ring ); + // schedule a tile for loading, returns true when tile is already loaded + bool sched_tile( const SGBucket& b, double priority,bool current_view, double request_time); // schedule a needed buckets for loading - void schedule_needed(double visibility_meters, const SGBucket& curr_bucket); + void schedule_needed(const SGBucket& curr_bucket, double rangeM); SGBucket previous_bucket; SGBucket current_bucket; SGBucket pending; - osg::ref_ptr _options; - - // x and y distance of tiles to load/draw - float vis; - int xrange, yrange; + osg::ref_ptr _options; // current longitude latitude double longitude; double latitude; - double altitude_m; + double scheduled_visibility; /** * tile cache */ - simgear::TileCache tile_cache; + TileCache tile_cache; + simgear::SGTerraSync* _terra_sync; -public: - FGTileMgr(); + // update various queues internal queues + void update_queues(); - ~FGTileMgr(); + // schedule tiles for the viewer bucket + void schedule_tiles_at(const SGGeod& location, double rangeM); - // Initialize the Tile Manager - int init(); + static void refresh_tile(void* tileMgr, long tileIndex); - // Update the various queues maintained by the tilemagr (private - // internal function, do not call directly.) - void update_queues(); + SGPropertyNode_ptr _visibilityMeters; + SGPropertyNode_ptr _maxTileRangeM, _disableNasalHooks; + SGPropertyNode_ptr _scenery_loaded, _scenery_override; - // given the current lon/lat (in degrees), fill in the array of - // local chunks. If the chunk isn't already in the cache, then - // read it from disk. - int update( double visibility_meters ); - int update( SGLocation *location, double visibility_meters); + osg::ref_ptr _pager; - // Prepare the ssg nodes corresponding to each tile. For each - // tile, set the ssg transform and update it's range selector - // based on current visibilty void prep_ssg_nodes( float - // visibility_meters ); - void prep_ssg_nodes(float visibility_meters ); +public: + FGTileMgr(); + ~FGTileMgr(); - const SGBucket& get_current_bucket () const { return current_bucket; } + // Initialize the Tile Manager + virtual void init(); + virtual void reinit(); + virtual void update(double dt); - /// Returns true if scenery is avaliable for the given lat, lon position - /// within a range of range_m. - /// lat and lon are expected to be in degrees. - bool scenery_available(double lat, double lon, double range_m); + const SGBucket& get_current_bucket () const { return current_bucket; } - // Load a model for a tile - osg::Node* loadTileModel(const string& modelPath, bool cacheModel); + // Returns true if scenery is available for the given lat, lon position + // within a range of range_m. + // lat and lon are expected to be in degrees. + bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0); - // Returns true if all the tiles in the tile cache have been loaded + // Returns true if tiles around current view position have been loaded bool isSceneryLoaded(); };