X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FScenery%2Ftilemgr.cxx;h=4ebce444cabacd8aac80694a2264e70b42bb0ac2;hb=578df0f4845f565592663f86ea690fc5e96a14a4;hp=3bc9258ab20c9f85540c3d7e744f08bd885340a8;hpb=59d400d58b082d583959eb8c27c3155eaa301888;p=flightgear.git diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 3bc9258ab..4ebce444c 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -59,9 +59,10 @@ FGTileMgr::FGTileMgr(): state( Start ), last_state( Running ), vis( 16000 ), - _terra_sync(NULL) + _terra_sync(NULL), + _visibilityMeters(fgGetNode("/environment/visibility-m", true)), + _maxTileRangeM(fgGetNode("/sim/rendering/static-lod/bare", true)) { - _maxTileRangeM = fgGetNode("/sim/rendering/static-lod/bare", true); } @@ -89,8 +90,6 @@ void FGTileMgr::init() { std::copy(sc.begin(), sc.end(), back_inserter(fp)); TileEntry::setModelLoadHelper(this); - - _visibilityMeters = fgGetNode("/environment/visibility-m", true); reinit(); } @@ -245,21 +244,12 @@ FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel) if(cacheModel) result = SGModelLib::loadModel(fullPath.str(), globals->get_props(), - new FGNasalModelData); + _disableNasalHooks->getBoolValue() ? NULL : new FGNasalModelDataProxy); else { - /* TODO FGNasalModelData's callback "modelLoaded" isn't thread-safe. - * But deferred (or paged) OSG loading runs in a separate thread, which would - * trigger the FGNasalModelData::modelLoaded callback. We're easily doomed - * when this happens and the model actually contains a Nasal "load" hook - which - * would run the Nasal parser and Nasal script execution in a separate thread... - * => Disabling the callback for now, to test if all Nasal related segfaults are - * gone. Proper resolution is TBD. We'll need to somehow decouple the OSG callback, - * so we can run the Nasal stuff in the main thread. - */ result= - SGModelLib::loadDeferredModel(fullPath.str(), globals->get_props()/*, - new FGNasalModelData*/); + SGModelLib::loadDeferredModel(fullPath.str(), globals->get_props(), + _disableNasalHooks->getBoolValue() ? NULL : new FGNasalModelDataProxy); } } catch (const sg_io_exception& exc) { string m(exc.getMessage());