]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/modellib.cxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / model / modellib.cxx
index 988afea09baa2994c117fd1e2357b88664338a2f..8a55151090905f6eab95996d73406eed93c3da69 100644 (file)
@@ -39,8 +39,6 @@
 
 #include "modellib.hxx"
 
-#include <simgear/math/SGMath.hxx>
-
 using std::string;
 using namespace simgear;
 
@@ -59,6 +57,11 @@ void SGModelLib::init(const string &root_dir, SGPropertyNode* root)
     static_propRoot = root;
 }
 
+void SGModelLib::resetPropertyRoot()
+{
+    static_propRoot.clear();
+}
+
 void SGModelLib::setPanelFunc(panel_func pf)
 {
   static_panelFunc = pf;
@@ -109,7 +112,8 @@ SGModelLib::loadModel(const string &path,
                        SGModelData *data,
                        bool load2DPanels)
 {
-    osg::ref_ptr<SGReaderWriterOptions> opt = new SGReaderWriterOptions(*(osgDB::Registry::instance()->getOptions()));
+    osg::ref_ptr<SGReaderWriterOptions> opt;
+    opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
     opt->setPropertyNode(prop_root ? prop_root: static_propRoot.get());
     opt->setModelData(data);
     
@@ -132,9 +136,8 @@ SGModelLib::loadDeferredModel(const string &path, SGPropertyNode *prop_root,
     proxyNode->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
     proxyNode->setFileName(0, path);
 
-    osg::ref_ptr<SGReaderWriterOptions> opt
-        = new SGReaderWriterOptions(*(osgDB::Registry::instance()
-                                         ->getOptions()));
+    osg::ref_ptr<SGReaderWriterOptions> opt;
+    opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
     opt->setPropertyNode(prop_root ? prop_root: static_propRoot.get());
     opt->setModelData(data);
     opt->setLoadPanel(static_panelFunc);
@@ -158,9 +161,8 @@ SGModelLib::loadPagedModel(const string &path, SGPropertyNode *prop_root,
     plod->setFileName(0, path);
     plod->setRange(0, 0.0, 50.0*SG_NM_TO_METER);
 
-    osg::ref_ptr<SGReaderWriterOptions> opt
-        = new SGReaderWriterOptions(*(osgDB::Registry::instance()
-                                         ->getOptions()));
+    osg::ref_ptr<SGReaderWriterOptions> opt;
+    opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
     opt->setPropertyNode(prop_root ? prop_root: static_propRoot.get());
     opt->setModelData(data);
     opt->setLoadPanel(static_panelFunc);