Provide command line arguments for fgviewer.
Provide --fg-root and --fg-scenery command line processing for fgviewer.
This commit is contained in:
parent
80f9092460
commit
e389b45599
1 changed files with 14 additions and 8 deletions
|
@ -90,29 +90,31 @@ main(int argc, char** argv)
|
||||||
fog->setDensity(1e-6);
|
fog->setDensity(1e-6);
|
||||||
camera->getOrCreateStateSet()->setAttribute(fog);
|
camera->getOrCreateStateSet()->setAttribute(fog);
|
||||||
|
|
||||||
const char *fg_root_env = std::getenv("FG_ROOT");
|
|
||||||
std::string fg_root;
|
std::string fg_root;
|
||||||
if (fg_root_env)
|
if (arguments.read("--fg-root", fg_root)) {
|
||||||
|
} else if (const char *fg_root_env = std::getenv("FG_ROOT")) {
|
||||||
fg_root = fg_root_env;
|
fg_root = fg_root_env;
|
||||||
else
|
} else {
|
||||||
#if defined(PKGDATADIR)
|
#if defined(PKGDATADIR)
|
||||||
fg_root = PKGDATADIR;
|
fg_root = PKGDATADIR;
|
||||||
#else
|
#else
|
||||||
fg_root = ".";
|
fg_root = ".";
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
osgDB::FilePathList filePathList;
|
std::string fg_scenery;
|
||||||
filePathList.push_back(fg_root);
|
|
||||||
|
|
||||||
const char *fg_scenery_env = std::getenv("FG_SCENERY");
|
|
||||||
string_list path_list;
|
string_list path_list;
|
||||||
if (fg_scenery_env) {
|
if (arguments.read("--fg-scenery", fg_scenery)) {
|
||||||
|
path_list.push_back(fg_scenery);
|
||||||
|
} else if (const char *fg_scenery_env = std::getenv("FG_SCENERY")) {
|
||||||
path_list = sgPathSplit(fg_scenery_env);
|
path_list = sgPathSplit(fg_scenery_env);
|
||||||
} else {
|
} else {
|
||||||
SGPath path(fg_root);
|
SGPath path(fg_root);
|
||||||
path.append("Scenery");
|
path.append("Scenery");
|
||||||
path_list.push_back(path.str());
|
path_list.push_back(path.str());
|
||||||
}
|
}
|
||||||
|
osgDB::FilePathList filePathList;
|
||||||
|
filePathList.push_back(fg_root);
|
||||||
for (unsigned i = 0; i < path_list.size(); ++i) {
|
for (unsigned i = 0; i < path_list.size(); ++i) {
|
||||||
SGPath pt(path_list[i]), po(path_list[i]);
|
SGPath pt(path_list[i]), po(path_list[i]);
|
||||||
pt.append("Terrain");
|
pt.append("Terrain");
|
||||||
|
@ -153,6 +155,10 @@ main(int argc, char** argv)
|
||||||
btgOptions->getDatabasePathList() = filePathList;
|
btgOptions->getDatabasePathList() = filePathList;
|
||||||
btgOptions->setMatlib(ml);
|
btgOptions->setMatlib(ml);
|
||||||
|
|
||||||
|
// Here, all arguments are processed
|
||||||
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
arguments.writeErrorMessages(std::cerr);
|
||||||
|
|
||||||
// read the scene from the list of file specified command line args.
|
// read the scene from the list of file specified command line args.
|
||||||
osg::ref_ptr<osg::Node> loadedModel;
|
osg::ref_ptr<osg::Node> loadedModel;
|
||||||
loadedModel = osgDB::readNodeFiles(arguments, btgOptions);
|
loadedModel = osgDB::readNodeFiles(arguments, btgOptions);
|
||||||
|
|
Loading…
Add table
Reference in a new issue