]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/modellib.hxx
simgear/scene/sky/sky.cxx: Include sg_inlines.h with simgear/ prefix as all other...
[simgear.git] / simgear / scene / model / modellib.hxx
index 8840f400aa80fa98a5614f8fe1939e3f08d0d1d1..63358855b31a07a7f4a1893421713f91fa1aa92e 100644 (file)
 #include <string>
 
 #include <osg/Node>
+#include <osgDB/ReaderWriter>
 
 #include <simgear/props/props.hxx>
-
-using std::map;
-using std::string;
+#include <simgear/misc/sg_path.hxx>
 
 namespace simgear {
 
@@ -45,19 +44,17 @@ class SGModelLib
 public:
     typedef osg::Node *(*panel_func)(SGPropertyNode *);
 
-    static void init(const string &root_dir);
+    static void init(const std::string &root_dir);
 
+    static void setPropRoot(SGPropertyNode* root);
+    
+    static void setPanelFunc(panel_func pf);
+    
     // Load a 3D model (any format)
     // data->modelLoaded() will be called after the model is loaded
-    static osg::Node* loadModel(const string &path,
-                                SGPropertyNode *prop_root,
-                                SGModelData *data=0);
-
-    // Load a 3D model (any format)
-    // with a panel_func to load a panel
-    static osg::Node* loadModel(const string &path,
-                                SGPropertyNode *prop_root,
-                                panel_func pf);
+    static osg::Node* loadModel(const std::string &path,
+                                SGPropertyNode *prop_root = NULL,
+                                SGModelData *data=0, bool load2DPanels=false);
 
     // Load a 3D model (any format) through the DatabasePager.
     // Most models should be loaded using this function!
@@ -65,13 +62,20 @@ public:
     // data->modelLoaded() will be called after the model is loaded and
     // connected to the scene graph. See AIModelData on how to use this.
     // NOTE: AIModelData uses observer_ptr to avoid circular references.
-    static osg::Node* loadPagedModel(const string &path,
-                                     SGPropertyNode *prop_root,
+    static osg::Node* loadPagedModel(const std::string &path,
+                                     SGPropertyNode *prop_root = NULL,
                                      SGModelData *data=0);
 
+    static std::string findDataFile(const std::string& file, 
+      const osgDB::ReaderWriter::Options* opts = NULL,
+      SGPath currentDir = SGPath()); 
 protected:
     SGModelLib();
     ~SGModelLib ();
+    
+private:
+  static SGPropertyNode_ptr static_propRoot;
+  static panel_func static_panelFunc;
 };
 
 
@@ -83,15 +87,8 @@ protected:
 class SGModelData : public osg::Referenced {
 public:
     virtual ~SGModelData() {}
-    virtual void modelLoaded(const string& path, SGPropertyNode *prop,
+    virtual void modelLoaded(const std::string& path, SGPropertyNode *prop,
                              osg::Node* branch) = 0;
-    void setConfigProperties(SGPropertyNode *configProperties)
-    { _configProperties = configProperties; }
-    SGPropertyNode *getConfigProperties()
-    { return _configProperties; }
-
-private:
-    SGSharedPtr<SGPropertyNode> _configProperties;
 };
 
 }