]> git.mxchange.org Git - flightgear.git/commitdiff
Added an --materials-file option to select the materials file to use at startup.
authorAnders Gidenstam <anders@gidenstam.org>
Fri, 2 Sep 2011 18:26:55 +0000 (20:26 +0200)
committerAnders Gidenstam <anders@gidenstam.org>
Sat, 3 Sep 2011 19:48:50 +0000 (21:48 +0200)
The property /sim/rendering/materials-file can also be used for this purpose.

src/Main/fg_init.cxx
src/Main/fgviewer.cxx
src/Main/options.cxx

index c28c9d98e72de952568422b236122d3b0cf26e01..25fe5a6f726c59d15bf71a881f517844ea5d0eff 100644 (file)
@@ -1362,10 +1362,11 @@ bool fgInitSubsystems() {
     ////////////////////////////////////////////////////////////////////
 
     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);
     }
 
index 6568368050c2f5a9b94128e1b048bfaa571e3a0c..2f11aa66bd496d17891e78f1ec12a0484e3eb54d 100644 (file)
@@ -209,10 +209,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);
     }
 
index 472a4b742df059e380b2780b7efd6cc3329aba8e..172d133ea7e329e83d5807a57af9040e41d45b9a 100644 (file)
@@ -215,6 +215,7 @@ fgSetDefaults ()
     fgSetBool("/sim/rendering/enhanced-lighting", false);
     fgSetBool("/sim/rendering/distance-attenuation", false);
     fgSetBool("/sim/rendering/specular-highlight", true);
+    fgSetString("/sim/rendering/materials-file", "materials.xml");
     fgSetInt("/sim/startup/xsize", 800);
     fgSetInt("/sim/startup/ysize", 600);
     fgSetInt("/sim/rendering/bits-per-pixel", 16);
@@ -1407,6 +1408,7 @@ struct OptionDesc {
     {"texture-filtering",            false, OPTION_INT,    "/sim/rendering/filtering", 1, "", 0 },
     {"disable-wireframe",            false, OPTION_BOOL,   "/sim/rendering/wireframe", false, "", 0 },
     {"enable-wireframe",             false, OPTION_BOOL,   "/sim/rendering/wireframe", true, "", 0 },
+    {"materials-file",               true,  OPTION_STRING, "/sim/rendering/materials-file", false, "", 0 },
     {"disable-terrasync",            false, OPTION_BOOL,   "/sim/terrasync/enabled", false, "", 0 },
     {"enable-terrasync",             false, OPTION_BOOL,   "/sim/terrasync/enabled", true, "", 0 },
     {"terrasync-dir",                true,  OPTION_STRING, "/sim/terrasync/scenery-dir", false, "", 0 },