#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>
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);
}
globals->set_matlib( new SGMaterialLib );
- simgear::SGModelLib::init(globals->get_fg_root());
+ simgear::SGModelLib::init(globals->get_fg_root(), globals->get_props());
// 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);
}
// 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()) {