#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
}
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();
// 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 )
// 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();
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();
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();
// 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" );
}
// 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");
}