FGTileMgr::FGTileMgr():
state( Start ),
+ last_state( Running ),
vis( 16000 ),
_terra_sync(NULL)
{
SGModelLib::loadModel(fullPath.str(), globals->get_props(),
new FGNasalModelData);
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()/*,
+ new FGNasalModelData*/);
+ }
} catch (const sg_io_exception& exc) {
string m(exc.getMessage());
m += " ";
// disk.
void FGTileMgr::update(double)
{
- SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update()" );
SGVec3d viewPos = globals->get_current_view()->get_view_pos();
double vis = _visibilityMeters->getDoubleValue();
schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
// do tile load scheduling.
// Note that we need keep track of both viewer buckets and fdm buckets.
if ( state == Running ) {
- SG_LOG( SG_TERRAIN, SG_DEBUG, "State == Running" );
+ if (last_state != state)
+ {
+ SG_LOG( SG_TERRAIN, SG_DEBUG, "State == Running" );
+ }
if (current_bucket != previous_bucket) {
// We've moved to a new bucket, we need to schedule any
// needed tiles for loading.
// save bucket
previous_bucket = current_bucket;
} else if ( state == Start || state == Inited ) {
- SG_LOG( SG_TERRAIN, SG_INFO, "State == Start || Inited" );
+ SG_LOG( SG_TERRAIN, SG_DEBUG, "State == Start || Inited" );
// do not update bucket yet (position not valid in initial loop)
state = Running;
previous_bucket.make_bad();
}
+ last_state = state;
return 1;
}