]> git.mxchange.org Git - flightgear.git/commitdiff
Simplify AI model loading.
authorfrohlich <frohlich>
Mon, 22 Jun 2009 21:04:52 +0000 (21:04 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 23 Jun 2009 08:54:10 +0000 (10:54 +0200)
Modified Files:
  AIBallistic.cxx AIBallistic.hxx AIBase.cxx AICarrier.hxx
  Makefile.am
Removed Files:
AIModelData.cxx AIModelData.hxx

src/AIModel/AIBallistic.cxx
src/AIModel/AIBallistic.hxx
src/AIModel/AIBase.cxx
src/AIModel/AICarrier.hxx
src/AIModel/AIModelData.cxx [deleted file]
src/AIModel/AIModelData.hxx [deleted file]
src/AIModel/Makefile.am

index 5b9a6f5dafd752fc275845fb964c5171df18ebe1..367f2e3f58c0a502d88caa32c5710ff10221e526 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <Scenery/scenery.hxx>
 
-#include "AIModelData.hxx"
 #include "AIBallistic.hxx"
 
 #include <Main/util.hxx>
@@ -118,12 +117,6 @@ 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);
 
index 2d184b015537dae2237699c96a2a04486c63779a..859bcd109896b5f95516ea202d5414e99fe8b69d 100644 (file)
@@ -43,8 +43,6 @@ 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();
index a57b5505d636c4d50ca17048702c93ff56d99ae2..973d4b69ecda3e397572d5910a5624613d51b617 100644 (file)
@@ -41,9 +41,9 @@
 
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
+#include <Scripting/NasalSys.hxx>
 
 #include "AIBase.hxx"
-#include "AIModelData.hxx"
 #include "AIManager.hxx"
 
 const char *default_model = "Models/Geometry/glider.ac";
@@ -207,7 +207,8 @@ void FGAIBase::initModel(osg::Node *node)
 
 osg::Node* FGAIBase::load3DModel(const string &path, SGPropertyNode *prop_root)
 {
-  model = SGModelLib::loadPagedModel(path, prop_root, new FGAIModelData(this, prop_root));
+  model = SGModelLib::loadPagedModel(path, prop_root, new FGNasalModelData(prop_root));
+  initModel(model.get());
   return model.get();
 }
 
index 2bf64003a4e3a753eb3d3d8b888e8fde09c7254d..239e302d9e8ca676303a3b452645cf5bf587afb4 100644 (file)
@@ -24,9 +24,6 @@
 #include <string>
 #include <list>
 
-#include <osg/Referenced>
-#include <osg/Node>
-
 #include <simgear/compiler.h>
 
 using std::string;
diff --git a/src/AIModel/AIModelData.cxx b/src/AIModel/AIModelData.cxx
deleted file mode 100644 (file)
index 2073a3c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#include "AIBase.hxx"
-#include "AIModelData.hxx"
-
-void FGAIModelData::modelLoaded(const string& path, SGPropertyNode *prop,
-                                   osg::Node *n)
-{
-    FGNasalModelData::modelLoaded(path, prop, n);
-    // SG_LOG(SG_NASAL, SG_ALERT, "FGAIModelData::modelLoaded(" << path << ")");
-    if(_base.valid())
-        _base->initModel(n);
-}
diff --git a/src/AIModel/AIModelData.hxx b/src/AIModel/AIModelData.hxx
deleted file mode 100644 (file)
index 6ebabf0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef __FGAIMODELDATA_HXX
-#define __FGAIMODELDATA_HXX
-
-#include <osg/observer_ptr>
-#include <Scripting/NasalSys.hxx>
-
-class FGAIBase;
-
-class FGAIModelData : public FGNasalModelData {
-public:
-    FGAIModelData(FGAIBase *b, SGPropertyNode *props = 0) : FGNasalModelData(props), _base(b) {}
-    virtual void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *);
-
-private:
-    osg::observer_ptr<FGAIBase> _base;
-};
-
-#endif
index c5520fba59604f3d6477d210d506a22e0d07fcec..6dbfd7be2d04254c1b58199c09fbd670af52d588 100644 (file)
@@ -3,7 +3,6 @@ noinst_LIBRARIES = libAIModel.a
 libAIModel_a_SOURCES = submodel.cxx submodel.hxx       \
                        AIManager.hxx AIManager.cxx \
                        AIBase.hxx AIBase.cxx   \
-                       AIModelData.cxx AIModelData.hxx \
                        AIAircraft.hxx AIAircraft.cxx \
                        AIMultiplayer.hxx AIMultiplayer.cxx \
                        AIShip.hxx AIShip.cxx \