fgviewer: adapt to simgear upstream changes.
This commit is contained in:
parent
bb59af4357
commit
ba8fd4c7d1
1 changed files with 3 additions and 28 deletions
|
@ -48,19 +48,6 @@
|
||||||
#include <simgear/scene/model/ModelRegistry.hxx>
|
#include <simgear/scene/model/ModelRegistry.hxx>
|
||||||
#include <simgear/scene/model/modellib.hxx>
|
#include <simgear/scene/model/modellib.hxx>
|
||||||
|
|
||||||
class DummyLoadHelper : public simgear::ModelLoadHelper {
|
|
||||||
public:
|
|
||||||
virtual osg::Node *loadTileModel(const string& modelPath, bool)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
return simgear::SGModelLib::loadModel(modelPath, simgear::getPropertyRoot());
|
|
||||||
} catch (...) {
|
|
||||||
std::cerr << "Error loading \"" << modelPath << "\"" << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -68,8 +55,7 @@ main(int argc, char** argv)
|
||||||
// pulled in by the linker ...
|
// pulled in by the linker ...
|
||||||
// FIXME: make that more explicit clear and call an initialization function
|
// FIXME: make that more explicit clear and call an initialization function
|
||||||
simgear::ModelRegistry::instance();
|
simgear::ModelRegistry::instance();
|
||||||
DummyLoadHelper dummyLoadHelper;
|
simgear::TileEntry::setModelLoadHelper(NULL);
|
||||||
simgear::TileEntry::setModelLoadHelper(&dummyLoadHelper);
|
|
||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc, argv);
|
osg::ArgumentParser arguments(&argc, argv);
|
||||||
|
@ -136,17 +122,6 @@ main(int argc, char** argv)
|
||||||
path.append("Scenery");
|
path.append("Scenery");
|
||||||
fg_scenery = path.str();
|
fg_scenery = path.str();
|
||||||
}
|
}
|
||||||
string_list path_list = sgPathSplit(fg_scenery);
|
|
||||||
osgDB::FilePathList filePathList;
|
|
||||||
filePathList.push_back(fg_root);
|
|
||||||
for (unsigned i = 0; i < path_list.size(); ++i) {
|
|
||||||
SGPath pt(path_list[i]), po(path_list[i]);
|
|
||||||
pt.append("Terrain");
|
|
||||||
po.append("Objects");
|
|
||||||
filePathList.push_back(path_list[i]);
|
|
||||||
filePathList.push_back(pt.str());
|
|
||||||
filePathList.push_back(po.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
SGSharedPtr<SGPropertyNode> props = new SGPropertyNode;
|
SGSharedPtr<SGPropertyNode> props = new SGPropertyNode;
|
||||||
sgUserDataInit(props.get());
|
sgUserDataInit(props.get());
|
||||||
|
@ -178,11 +153,11 @@ main(int argc, char** argv)
|
||||||
options = new simgear::SGReaderWriterOptions(*ropt);
|
options = new simgear::SGReaderWriterOptions(*ropt);
|
||||||
else
|
else
|
||||||
options = new simgear::SGReaderWriterOptions;
|
options = new simgear::SGReaderWriterOptions;
|
||||||
options->getDatabasePathList() = filePathList;
|
osgDB::convertStringPathIntoFilePathList(fg_scenery,
|
||||||
|
options->getDatabasePathList());
|
||||||
options->setMaterialLib(ml);
|
options->setMaterialLib(ml);
|
||||||
options->setPropertyNode(props);
|
options->setPropertyNode(props);
|
||||||
options->setPluginStringData("SimGear::FG_ROOT", fg_root);
|
options->setPluginStringData("SimGear::FG_ROOT", fg_root);
|
||||||
options->setPluginStringData("SimGear::FG_SCENERY", fg_scenery);
|
|
||||||
osgDB::Registry::instance()->setOptions(options.get());
|
osgDB::Registry::instance()->setOptions(options.get());
|
||||||
|
|
||||||
// Here, all arguments are processed
|
// Here, all arguments are processed
|
||||||
|
|
Loading…
Add table
Reference in a new issue