]> git.mxchange.org Git - flightgear.git/commitdiff
Set the key SGModelLib callback to make aircraft-dir OSG loading work.
authorJames Turner <zakalawe@mac.com>
Thu, 29 Jul 2010 00:07:32 +0000 (01:07 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 29 Jul 2010 00:07:32 +0000 (01:07 +0100)
src/Cockpit/panel.cxx
src/Main/main.cxx
src/Model/model_panel.cxx

index be2f12570e8fb3d336e9e79d0c68ccee5b2a0155..9c39626ee6bd1dd4250047400a198064a1169b36 100644 (file)
@@ -122,11 +122,7 @@ FGTextureManager::createTexture (const string &relativePath, bool staticTexture)
 {
   osg::Texture2D* texture = _textureMap[relativePath].get();
   if (texture == 0) {
-    SG_LOG( SG_COCKPIT, SG_DEBUG,
-            "Texture " << relativePath << " does not yet exist" );
-    SGPath tpath(globals->get_fg_root());
-    tpath.append(relativePath);
-
+    SGPath tpath = globals->resolve_aircraft_path(relativePath);
     texture = SGLoadTexture2D(staticTexture, tpath);
 
     _textureMap[relativePath] = texture;
index 07c10598aa11bb8488658390feca43de41212c85..789d80ce885eaa6ce54a3dde72d6920b6e6d1663 100644 (file)
@@ -342,7 +342,7 @@ static void fgMainLoop( void ) {
     // implementation is an AI model and depends on that
     globals->get_multiplayer_mgr()->Update();
 
-#if ENABLE_ATCDCL
+#if ENABLE_ATCDCL  
     // Run ATC subsystem
     if (fgGetBool("/sim/atc/enabled"))
         globals->get_ATC_mgr()->update(delta_time_sec);
@@ -493,6 +493,20 @@ struct GeneralInitOperation : public GraphicsContextOperation
         SG_LOG ( SG_GENERAL, SG_INFO, "Depth buffer bits = " << tmp );
     }
 };
+
+
+osg::Node* load_panel(SGPropertyNode *n)
+{
+    osg::Geode* geode = new osg::Geode;
+    geode->addDrawable(new FGPanelNode(n));
+    return geode;
+}
+
+SGPath resolve_path(const std::string& s)
+{
+  return globals->resolve_maybe_aircraft_path(s);
+}
+
 }
 
 // This is the top level master main function that is registered as
@@ -573,8 +587,10 @@ static void fgIdleFunction ( void ) {
         ////////////////////////////////////////////////////////////////////
         globals->set_matlib( new SGMaterialLib );
         simgear::SGModelLib::init(globals->get_fg_root());
-
-
+        simgear::SGModelLib::setPropRoot(globals->get_props());
+        simgear::SGModelLib::setResolveFunc(resolve_path);
+        simgear::SGModelLib::setPanelFunc(load_panel);
+        
         ////////////////////////////////////////////////////////////////////
         // Initialize the TG scenery subsystem.
         ////////////////////////////////////////////////////////////////////
index eef538cb0a41c7b809e7e3a2078afdf3066c3090..b18d1f164187ac894b6f88df1badf6c0e704ee8f 100644 (file)
 using std::vector;
 
 using namespace simgear;
-
-static
-osg::Node* load_panel(SGPropertyNode *n)
-{
-    osg::Geode* geode = new osg::Geode;
-    geode->addDrawable(new FGPanelNode(n));
-    return geode;
-}
-
 \f
 ////////////////////////////////////////////////////////////////////////
 // Global functions.
@@ -39,7 +30,7 @@ osg::Node* load_panel(SGPropertyNode *n)
 osg::Node *
 fgLoad3DModelPanel(const string &path, SGPropertyNode *prop_root)
 {
-    osg::Node* node = SGModelLib::loadModel(path, prop_root, load_panel);
+    osg::Node* node = SGModelLib::loadModel(path, prop_root);
     if (node)
         node->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
     return node;