From 33a2e2128f24ecf71621bbaab6bb5ce02b730d83 Mon Sep 17 00:00:00 2001 From: frohlich Date: Mon, 22 Jun 2009 21:04:52 +0000 Subject: [PATCH] Simplify AI model loading. Modified Files: AIBallistic.cxx AIBallistic.hxx AIBase.cxx AICarrier.hxx Makefile.am Removed Files: AIModelData.cxx AIModelData.hxx --- src/AIModel/AIBallistic.cxx | 7 ------- src/AIModel/AIBallistic.hxx | 2 -- src/AIModel/AIBase.cxx | 5 +++-- src/AIModel/AICarrier.hxx | 3 --- src/AIModel/AIModelData.cxx | 16 ---------------- src/AIModel/AIModelData.hxx | 18 ------------------ src/AIModel/Makefile.am | 1 - 7 files changed, 3 insertions(+), 49 deletions(-) delete mode 100644 src/AIModel/AIModelData.cxx delete mode 100644 src/AIModel/AIModelData.hxx diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx index 5b9a6f5da..367f2e3f5 100644 --- a/src/AIModel/AIBallistic.cxx +++ b/src/AIModel/AIBallistic.cxx @@ -29,7 +29,6 @@ #include -#include "AIModelData.hxx" #include "AIBallistic.hxx" #include
@@ -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); diff --git a/src/AIModel/AIBallistic.hxx b/src/AIModel/AIBallistic.hxx index 2d184b015..859bcd109 100644 --- a/src/AIModel/AIBallistic.hxx +++ b/src/AIModel/AIBallistic.hxx @@ -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(); diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index a57b5505d..973d4b69e 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -41,9 +41,9 @@ #include
#include +#include #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(); } diff --git a/src/AIModel/AICarrier.hxx b/src/AIModel/AICarrier.hxx index 2bf64003a..239e302d9 100644 --- a/src/AIModel/AICarrier.hxx +++ b/src/AIModel/AICarrier.hxx @@ -24,9 +24,6 @@ #include #include -#include -#include - #include using std::string; diff --git a/src/AIModel/AIModelData.cxx b/src/AIModel/AIModelData.cxx deleted file mode 100644 index 2073a3c55..000000000 --- a/src/AIModel/AIModelData.cxx +++ /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 index 6ebabf02b..000000000 --- a/src/AIModel/AIModelData.hxx +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __FGAIMODELDATA_HXX -#define __FGAIMODELDATA_HXX - -#include -#include - -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 _base; -}; - -#endif diff --git a/src/AIModel/Makefile.am b/src/AIModel/Makefile.am index c5520fba5..6dbfd7be2 100644 --- a/src/AIModel/Makefile.am +++ b/src/AIModel/Makefile.am @@ -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 \