From 1b1045967823e890686a878eb259c7409bfbbd63 Mon Sep 17 00:00:00 2001
From: till busch <buti@bux.at>
Date: Mon, 17 Mar 2008 13:40:21 +0100
Subject: [PATCH] load submodels in main thread test - flightgear

---
 src/AIModel/AIBallistic.cxx |    8 ++++++++
 src/AIModel/AIBallistic.hxx |    2 ++
 src/AIModel/AIBase.hxx      |    2 +-
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx
index 000ce32..a08cc08 100644
--- a/src/AIModel/AIBallistic.cxx
+++ b/src/AIModel/AIBallistic.cxx
@@ -26,9 +26,11 @@
 #include <simgear/math/point3d.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/math/sg_geodesy.hxx>
+#include <simgear/scene/model/modellib.hxx>
 
 #include <Scenery/scenery.hxx>
 
+#include "AIModelData.hxx"
 #include "AIBallistic.hxx"
 
 #include <Main/util.hxx>
@@ -114,6 +116,12 @@ void FGAIBallistic::readFromScenario(SGPropertyNode* scFileNode) {
     setRandom(scFileNode->getBoolValue("random", false));
 }
 
+osg::Node* FGAIBallistic::load3DModel(const string &path, SGPropertyNode *prop_root)
+{
+  model = SGModelLib::loadModel(path, prop_root, new FGAIModelData(this, prop_root));
+  return model.get();
+}
+
 bool FGAIBallistic::init(bool search_in_AI_path) {
     FGAIBase::init(search_in_AI_path);
 
diff --git a/src/AIModel/AIBallistic.hxx b/src/AIModel/AIBallistic.hxx
index f00e389..b6fb58a 100644
--- a/src/AIModel/AIBallistic.hxx
+++ b/src/AIModel/AIBallistic.hxx
@@ -43,6 +43,8 @@ public:
 
     void readFromScenario(SGPropertyNode* scFileNode);
 
+    virtual osg::Node* load3DModel(const string &path,
+                           SGPropertyNode *prop_root);
     bool init(bool search_in_AI_path=false);
     virtual void bind();
     virtual void unbind();
diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx
index 87d100a..ec55ce9 100644
--- a/src/AIModel/AIBase.hxx
+++ b/src/AIModel/AIBase.hxx
@@ -267,7 +267,7 @@ public:
     inline double _getRange() { return range; };
     inline double _getBearing() { return bearing; };
 
-    osg::Node* load3DModel(const string &path,
+    virtual osg::Node* load3DModel(const string &path,
                            SGPropertyNode *prop_root);
  
     static bool _isNight();
-- 
1.5.2.5


