scenery: The tile entries load callback is not needed anymore.
The stg loader can do this itself.
This commit is contained in:
parent
8d3e1b06be
commit
44c716bb03
4 changed files with 4 additions and 68 deletions
|
@ -38,21 +38,6 @@
|
|||
#include "globals.hxx"
|
||||
#include "options.hxx"
|
||||
|
||||
class DummyLoadHelper : public simgear::ModelLoadHelper {
|
||||
public:
|
||||
virtual osg::Node *loadTileModel(const string& modelPath, bool)
|
||||
{
|
||||
try {
|
||||
SGSharedPtr<SGPropertyNode> prop = new SGPropertyNode;
|
||||
return simgear::SGModelLib::loadModel(modelPath,
|
||||
globals->get_props());
|
||||
} catch (...) {
|
||||
std::cerr << "Error loading \"" << modelPath << "\"" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class GraphDumpHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
@ -120,8 +105,6 @@ fgviewerMain(int argc, char** argv)
|
|||
{
|
||||
|
||||
sgUserDataInit(0);
|
||||
DummyLoadHelper dummyLoadHelper;
|
||||
simgear::TileEntry::setModelLoadHelper(&dummyLoadHelper);
|
||||
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc, argv);
|
||||
|
|
|
@ -48,9 +48,7 @@
|
|||
#include "SceneryPager.hxx"
|
||||
#include "tilemgr.hxx"
|
||||
|
||||
using std::for_each;
|
||||
using flightgear::SceneryPager;
|
||||
using simgear::SGModelLib;
|
||||
using simgear::TileEntry;
|
||||
using simgear::TileCache;
|
||||
|
||||
|
@ -89,8 +87,9 @@ void FGTileMgr::init() {
|
|||
const string_list &sc = globals->get_fg_scenery();
|
||||
fp.clear();
|
||||
std::copy(sc.begin(), sc.end(), back_inserter(fp));
|
||||
|
||||
TileEntry::setModelLoadHelper(this);
|
||||
_options->setPluginStringData("SimGear::FG_ROOT", globals->get_fg_root());
|
||||
if (!_disableNasalHooks->getBoolValue())
|
||||
_options->setModelData(new FGNasalModelDataProxy);
|
||||
|
||||
reinit();
|
||||
}
|
||||
|
@ -220,48 +219,6 @@ void FGTileMgr::schedule_needed(const SGBucket& curr_bucket, double vis)
|
|||
}
|
||||
}
|
||||
|
||||
osg::Node*
|
||||
FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel)
|
||||
{
|
||||
SGPath fullPath = modelPath;
|
||||
if (fullPath.isRelative()) {
|
||||
string_list sc = globals->get_fg_scenery();
|
||||
|
||||
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
osg::Node* result = 0;
|
||||
try {
|
||||
if(cacheModel)
|
||||
result =
|
||||
SGModelLib::loadModel(fullPath.str(), globals->get_props(),
|
||||
_disableNasalHooks->getBoolValue() ? NULL : new FGNasalModelDataProxy);
|
||||
else
|
||||
{
|
||||
result=
|
||||
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();
|
||||
SG_LOG( SG_TERRAIN, SG_ALERT, m );
|
||||
} catch (const sg_exception& exc) { // XXX may be redundant
|
||||
SG_LOG( SG_TERRAIN, SG_ALERT, exc.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the various queues maintained by the tilemagr (private
|
||||
* internal function, do not call directly.)
|
||||
|
|
|
@ -42,7 +42,7 @@ class SGTerraSync;
|
|||
class SGReaderWriterOptions;
|
||||
}
|
||||
|
||||
class FGTileMgr : public SGSubsystem, public simgear::ModelLoadHelper {
|
||||
class FGTileMgr : public SGSubsystem {
|
||||
|
||||
private:
|
||||
|
||||
|
@ -111,9 +111,6 @@ public:
|
|||
/// lat and lon are expected to be in degrees.
|
||||
bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0);
|
||||
|
||||
// Load a model for a tile
|
||||
osg::Node* loadTileModel(const std::string& modelPath, bool cacheModel);
|
||||
|
||||
// Returns true if tiles around current view position have been loaded
|
||||
bool isSceneryLoaded();
|
||||
};
|
||||
|
|
|
@ -55,7 +55,6 @@ main(int argc, char** argv)
|
|||
// pulled in by the linker ...
|
||||
// FIXME: make that more explicit clear and call an initialization function
|
||||
simgear::ModelRegistry::instance();
|
||||
simgear::TileEntry::setModelLoadHelper(NULL);
|
||||
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc, argv);
|
||||
|
|
Loading…
Reference in a new issue