]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/model.cxx
Change FGSteam into a proper subsystem rather than a collection of
[flightgear.git] / src / Model / model.cxx
index 3f1078cff0da8dd72d7bc533582bac359e3bd03c..64621ea0c67429af8df04b4b0b33b99a99a261db 100644 (file)
@@ -26,6 +26,7 @@
 #include <Scenery/scenery.hxx>
 
 #include "model.hxx"
+#include "panelnode.hxx"
 
 
 \f
@@ -197,16 +198,19 @@ FG3DModel::init (const string &path)
       modelpath = modelpath.dir();
       modelpath.append(props.getStringValue("/path"));
     } else {
-      throw sg_exception("No path for model");
+      if (_model == 0)
+       _model = new ssgBranch;
     }
   }
 
                                 // Assume that textures are in
                                 // the same location as the XML file.
-  ssgTexturePath((char *)xmlpath.dir().c_str());
-  _model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
-  if (_model == 0)
-    throw sg_exception("Failed to load 3D model");
+  if (_model == 0) {
+    ssgTexturePath((char *)xmlpath.dir().c_str());
+    _model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
+    if (_model == 0)
+      throw sg_exception("Failed to load 3D model");
+  }
 
                                 // Set up the alignment node
   ssgTransform * align = new ssgTransform;
@@ -241,6 +245,14 @@ FG3DModel::init (const string &path)
     }
   }
 
+                                // Load panels
+  vector<SGPropertyNode_ptr> panel_nodes = props.getChildren("panel");
+  for (i = 0; i < panel_nodes.size(); i++) {
+    printf("Reading a panel in model.cxx\n");
+    FGPanelNode * panel = new FGPanelNode(panel_nodes[i]);
+    _model->addKid(panel);
+  }
+
                                // Load sub-models
   vector<SGPropertyNode_ptr> model_nodes = props.getChildren("model");
   for (i = 0; i < model_nodes.size(); i++) {