]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/modelmgr.cxx
Merge branch 'next' into comm-subsystem
[flightgear.git] / src / Model / modelmgr.cxx
index 600086d29e9d77ece1819bc319f6e8f6fac1fa87..139cf2d4f2441eb00e5c7fff7a1694d5c0abd32c 100644 (file)
@@ -16,6 +16,7 @@
 #include <algorithm>
 #include <functional>
 #include <vector>
+#include <cstring>
 
 #include <osg/Math>
 
@@ -69,21 +70,22 @@ FGModelMgr::add_model (SGPropertyNode * node)
 {
   SG_LOG(SG_GENERAL, SG_INFO,
          "Adding model " << node->getStringValue("name", "[unnamed]"));
-  Instance * instance = new Instance;
-  SGModelPlacement *model = new SGModelPlacement;
-  instance->model = model;
-  instance->node = node;
 
   const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
   osg::Node *object;
 
   try {
-    object = SGModelLib::loadPagedModel(path, globals->get_props());
+      object = SGModelLib::loadDeferredModel(path, globals->get_props());
   } catch (const sg_throwable& t) {
     SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n  "
         << t.getFormattedMessage() << t.getOrigin());
     return;
   }
+  
+  Instance * instance = new Instance;
+  SGModelPlacement *model = new SGModelPlacement;
+  instance->model = model;
+  instance->node = node;
 
   model->init( object );