]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tilemgr.cxx
Fix line endings
[flightgear.git] / src / Scenery / tilemgr.cxx
index 9b28c8894939dd70f10612af69d84c166746be02..ddfeb906a5b7bd1c68a78ebdce527cfa8bf0e3a2 100644 (file)
@@ -47,7 +47,7 @@
 
 #define TEST_LAST_HIT_CACHE
 
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
 SGLockedQueue<FGTileEntry *> FGTileMgr::attach_queue;
 SGLockedQueue<FGDeferredModel *> FGTileMgr::model_queue;
 #else
@@ -92,7 +92,7 @@ int FGTileMgr::init() {
     }
 
     while ( ! model_queue.empty() ) {
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
         FGDeferredModel* dm = model_queue.pop();
 #else
         FGDeferredModel* dm = model_queue.front();
@@ -156,7 +156,7 @@ void FGTileMgr::sched_tile( const SGBucket& b, const bool is_inner_ring ) {
 
 
 // schedule a needed buckets for loading
-void FGTileMgr::schedule_needed( double vis, SGBucket curr_bucket) {
+void FGTileMgr::schedule_needed( double vis, const SGBucket& curr_bucket) {
     // sanity check (unfortunately needed!)
     if ( longitude < -180.0 || longitude > 180.0 
          || latitude < -90.0 || latitude > 90.0 )
@@ -299,7 +299,7 @@ void FGTileMgr::update_queues()
 
             // cout << "loading next model ..." << endl;
             // load the next tile in the queue
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
             FGDeferredModel* dm = model_queue.pop();
 #else
             FGDeferredModel* dm = model_queue.front();
@@ -323,8 +323,13 @@ void FGTileMgr::update_queues()
                             SGShadowVolume::occluderTypeTileObject,
                             (ssgBranch *) dm->get_tile()->get_terra_transform());
                     }
-                } catch (const sg_exception& exc) {
-                    SG_LOG( SG_ALL, SG_ALERT, exc.getMessage() );
+                } catch (const sg_io_exception& exc) {
+                                       string m(exc.getMessage());
+                                       m += " ";
+                                       m += exc.getLocation().asString();
+                    SG_LOG( SG_ALL, SG_ALERT, m );
+                } catch (const sg_exception& exc) { // XXX may be redundant
+                    SG_LOG( SG_ALL, SG_ALERT, exc.getMessage());
                 }
                 
                 dm->get_tile()->dec_pending_models();
@@ -337,7 +342,7 @@ void FGTileMgr::update_queues()
     loader.update();
 
     if ( !attach_queue.empty() ) {
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
         FGTileEntry* e = attach_queue.pop();
 #else
         FGTileEntry* e = attach_queue.front();
@@ -364,7 +369,7 @@ void FGTileMgr::update_queues()
                 // get real serious and agressively free up some tiles so
                 // we don't explode our memory usage.
 
-                SG_LOG( SG_TERRAIN, SG_WARN,
+                SG_LOG( SG_TERRAIN, SG_ALERT,
                         "Warning: catching up on tile delete queue" );
             }
 
@@ -457,18 +462,17 @@ void FGTileMgr::prep_ssg_nodes( SGLocation *location, float vis ) {
     // traverse the potentially viewable tile list and update range
     // selector and transform
 
-    Point3D center = location->get_tile_center();
-    if (center == Point3D(0.0))
-      return;
     float *up = location->get_world_up();
 
     FGTileEntry *e;
     tile_cache.reset_traversal();
 
+    const double *vp = location->get_absolute_view_pos();
+    Point3D viewpos(vp[0], vp[1], vp[2]);
     while ( ! tile_cache.at_end() ) {
         // cout << "processing a tile" << endl;
         if ( (e = tile_cache.get_current()) ) {
-            e->prep_ssg_node( center, up, vis);
+            e->prep_ssg_node( viewpos, up, vis);
         } else {
             SG_LOG(SG_INPUT, SG_ALERT, "warning ... empty tile in cache");
         }