]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fgviewer.cxx
Expose a radio function (receiveBeacon) to the Nasal subsystem
[flightgear.git] / src / Main / fgviewer.cxx
index 6568368050c2f5a9b94128e1b048bfaa571e3a0c..99bdd8e65319fac1a692fdd6c8437a0d530b2e00 100644 (file)
@@ -25,7 +25,7 @@
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/scene/material/EffectCullVisitor.hxx>
 #include <simgear/scene/material/matlib.hxx>
-#include <simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx>
+#include <simgear/scene/util/SGReaderWriterOptions.hxx>
 #include <simgear/scene/tgdb/userdata.hxx>
 #include <simgear/scene/tgdb/TileEntry.hxx>
 #include <simgear/scene/model/ModelRegistry.hxx>
@@ -188,7 +188,6 @@ fgviewerMain(int argc, char** argv)
 
     globals = new FGGlobals;
 
-    fgInitFGRoot(arguments.argc(), arguments.argv());
     if ( !fgInitConfig(arguments.argc(), arguments.argv()) ) {
         SG_LOG( SG_GENERAL, SG_ALERT, "Config option parsing failed ..." );
         exit(-1);
@@ -209,10 +208,11 @@ fgviewerMain(int argc, char** argv)
     // Initialize the material property subsystem.
 
     SGPath mpath( globals->get_fg_root() );
-    mpath.append( "materials.xml" );
+    mpath.append( fgGetString("/sim/rendering/materials-file") );
     if ( ! globals->get_matlib()->load(globals->get_fg_root(), mpath.str(),
             globals->get_props()) ) {
-        SG_LOG( SG_GENERAL, SG_ALERT, "Error loading material lib!" );
+        SG_LOG( SG_GENERAL, SG_ALERT,
+                "Error loading materials file " << mpath.str() );
         exit(-1);
     }
 
@@ -223,15 +223,14 @@ fgviewerMain(int argc, char** argv)
     // The file path list must be set in the registry.
     osgDB::Registry::instance()->getDataFilePathList() = filePathList;
 
-    SGReaderWriterBTGOptions* btgOptions = new SGReaderWriterBTGOptions;
-    btgOptions->getDatabasePathList() = filePathList;
-    btgOptions->setMatlib(globals->get_matlib());
-    btgOptions->setUseRandomObjects(fgGetBool("/sim/rendering/random-objects", false));
-    btgOptions->setUseRandomVegetation(fgGetBool("/sim/rendering/random-vegetation", false));
+    simgear::SGReaderWriterOptions* options = new simgear::SGReaderWriterOptions;
+    options->getDatabasePathList() = filePathList;
+    options->setMaterialLib(globals->get_matlib());
+    options->setPropertyNode(globals->get_props());
 
     // read the scene from the list of file specified command line args.
     osg::ref_ptr<osg::Node> loadedModel;
-    loadedModel = osgDB::readNodeFiles(dataFiles, btgOptions);
+    loadedModel = osgDB::readNodeFiles(dataFiles, options);
 
     // if no model has been successfully loaded report failure.
     if (!loadedModel.valid()) {