]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tilemgr.cxx
Simplify ssg branch deletion code. Saying we were doing it the
[flightgear.git] / src / Scenery / tilemgr.cxx
index 3de6ebce4baa2412e6a4fb9178f1394f8d305b43..8cf2b6c98d3480b01a9e95f4a8d5cf249f25f20d 100644 (file)
 #include <Math/vector.hxx>
 #include <Objects/materialmgr.hxx>
 #include <Objects/obj.hxx>
-#include <Weather/weather.hxx>
+
+#ifdef FG_NEW_WEATHER
+#  include <WeatherCM/FGLocalWeatherDatabase.h>
+#else
+#  include <Weather/weather.hxx>
+#endif
 
 #include "scenery.hxx"
 #include "tilecache.hxx"
@@ -89,6 +94,8 @@ int FGTileMgr::init( void ) {
        material_mgr.load_lib();
     }
 
+    global_tile_cache.init();
+
     state = Inited;
 
     return 1;
@@ -98,7 +105,7 @@ int FGTileMgr::init( void ) {
 // schedule a tile for loading
 static void disable_tile( int cache_index ) {
     // see if tile already exists in the cache
-    cout << "DISABLING CACHE ENTRY = " << cache_index << endl;
+    // cout << "DISABLING CACHE ENTRY = " << cache_index << endl;
     FGTileEntry *t = global_tile_cache.get_tile( cache_index );
     t->ssg_disable();
 }
@@ -111,7 +118,7 @@ int FGTileMgr::sched_tile( const FGBucket& b ) {
 
     if ( cache_index >= 0 ) {
        // tile exists in cache, reenable it.
-       cout << "REENABLING DISABLED TILE" << endl;
+       // cout << "REENABLING DISABLED TILE" << endl;
        FGTileEntry *t = global_tile_cache.get_tile( cache_index );
        t->select_ptr->select( 1 );
        t->mark_loaded();
@@ -386,7 +393,7 @@ FGTileMgr::current_elev_ssg( const Point3D& abs_view_pos,
 
     for ( int i = 0 ; i < num_hits ; i++ ) {
        ssgHit *h = &(results [ i ]) ;
-       cout << "got a hit!" << endl;
+       // cout << "got a hit!" << endl;
        /* Do something with 'h' */
     }
 
@@ -494,7 +501,7 @@ int FGTileMgr::update( void ) {
        // have something to see in our first frame.
        for ( i = 0; i < 9; ++i ) {
            if ( load_queue.size() ) {
-               FG_LOG( FG_TERRAIN, FG_INFO
+               FG_LOG( FG_TERRAIN, FG_DEBUG
                        "Load queue not empty, loading a tile" );
            
                FGLoadRec pending = load_queue.front();
@@ -510,7 +517,7 @@ int FGTileMgr::update( void ) {
 #if 0 
        // make sure load queue is flushed before doing shift
        while ( load_queue.size() ) {
-           FG_LOG( FG_TERRAIN, FG_INFO
+           FG_LOG( FG_TERRAIN, FG_DEBUG
                    "Load queue not empty, flushing queue before tile shift." );
            
            FGLoadRec pending = load_queue.front();
@@ -575,7 +582,7 @@ int FGTileMgr::update( void ) {
     }
 
     if ( load_queue.size() ) {
-       FG_LOG( FG_TERRAIN, FG_INFO, "Load queue not empty, loading a tile" );
+       FG_LOG( FG_TERRAIN, FG_DEBUG, "Load queue not empty, loading a tile" );
 
        FGLoadRec pending = load_queue.front();
        load_queue.pop_front();
@@ -688,7 +695,12 @@ void FGTileMgr::prep_ssg_nodes( void ) {
        if ( t->is_loaded() ) {
            // set range selector (LOD trick) to be distance to center
            // of tile + bounding radius
-           ranges[1] = current_weather.get_visibility() + t->bounding_radius;
+#ifdef FG_NEW_WEATHER
+           ranges[1] = WeatherDatabase->getWeatherVisibility()
+               + t->bounding_radius;
+#else
+           ranges[1] = current_weather.get_visibility()+t->bounding_radius;
+#endif
            t->range_ptr->setRanges( ranges, 2 );
 
            // calculate tile offset