#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/scene/model/modellib.hxx>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/scene/model/modellib.hxx>
// remove all nodes we might have left behind
osg::Group* group = globals->get_scenery()->get_terrain_branch();
group->removeChildren(0, group->getNumChildren());
// remove all nodes we might have left behind
osg::Group* group = globals->get_scenery()->get_terrain_branch();
group->removeChildren(0, group->getNumChildren());
- _options = new SGReaderWriterBTGOptions;
- _options->setMatlib(globals->get_matlib());
- _options->setUseRandomObjects(fgGetBool("/sim/rendering/random-objects", true));
- _options->setUseRandomVegetation(fgGetBool("/sim/rendering/random-vegetation", true));
+ _options = new simgear::SGReaderWriterOptions;
+ _options->setMaterialLib(globals->get_matlib());
+ _options->setPropertyNode(globals->get_props());
+
osgDB::FilePathList &fp = _options->getDatabasePathList();
const string_list &sc = globals->get_fg_scenery();
fp.clear();
std::copy(sc.begin(), sc.end(), back_inserter(fp));
TileEntry::setModelLoadHelper(this);
osgDB::FilePathList &fp = _options->getDatabasePathList();
const string_list &sc = globals->get_fg_scenery();
fp.clear();
std::copy(sc.begin(), sc.end(), back_inserter(fp));
TileEntry::setModelLoadHelper(this);
state = Inited;
previous_bucket.make_bad();
current_bucket.make_bad();
longitude = latitude = -1000.0;
state = Inited;
previous_bucket.make_bad();
current_bucket.make_bad();
longitude = latitude = -1000.0;
/* schedule a tile for loading, keep request for given amount of time.
* Returns true if tile is already loaded. */
bool FGTileMgr::sched_tile( const SGBucket& b, double priority, bool current_view, double duration)
/* schedule a tile for loading, keep request for given amount of time.
* Returns true if tile is already loaded. */
bool FGTileMgr::sched_tile( const SGBucket& b, double priority, bool current_view, double duration)
SG_LOG( SG_TERRAIN, SG_ALERT,
"Attempting to schedule tiles for bogus lon and lat = ("
<< longitude << "," << latitude << ")" );
SG_LOG( SG_TERRAIN, SG_ALERT,
"Attempting to schedule tiles for bogus lon and lat = ("
<< longitude << "," << latitude << ")" );
- xrange = (int)(vis / tile_width) + 1;
- yrange = (int)(vis / tile_height) + 1;
+ double tileRangeM = std::min(vis,_maxTileRangeM->getDoubleValue());
+ xrange = (int)(tileRangeM / tile_width) + 1;
+ yrange = (int)(tileRangeM / tile_height) + 1;
string_list sc = globals->get_fg_scenery();
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
string_list sc = globals->get_fg_scenery();
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
- SGPath tmpPath(*it);
- tmpPath.append(modelPath);
- if (tmpPath.exists()) {
- fullPath = tmpPath;
- break;
- }
+ // fg_senery contains empty strings as "markers" (see FGGlobals::set_fg_scenery)
+ if (!it->empty()) {
+ SGPath tmpPath(*it);
+ tmpPath.append(modelPath);
+ if (tmpPath.exists()) {
+ fullPath = tmpPath;
+ break;
+ }
+ }
- SGModelLib::loadPagedModel(modelPath, 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());
m += " ";
m += exc.getLocation().asString();
} catch (const sg_io_exception& exc) {
string m(exc.getMessage());
m += " ";
m += exc.getLocation().asString();
{
// schedule tile for loading with osg pager
pager->queueRequest(e->tileFileName,
{
// schedule tile for loading with osg pager
pager->queueRequest(e->tileFileName,
SGVec3d viewPos = globals->get_current_view()->get_view_pos();
double vis = _visibilityMeters->getDoubleValue();
schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
SGVec3d viewPos = globals->get_current_view()->get_view_pos();
double vis = _visibilityMeters->getDoubleValue();
schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
- 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.
SG_LOG( SG_TERRAIN, SG_INFO, "FGTileMgr::update()" );
scheduled_visibility = range_m;
schedule_needed(current_bucket, range_m);
if (current_bucket != previous_bucket) {
// We've moved to a new bucket, we need to schedule any
// needed tiles for loading.
SG_LOG( SG_TERRAIN, SG_INFO, "FGTileMgr::update()" );
scheduled_visibility = range_m;
schedule_needed(current_bucket, range_m);