1
0
Fork 0

Simplify AI model loading.

Modified Files:
 	AIBallistic.cxx AIBallistic.hxx AIBase.cxx AICarrier.hxx
 	Makefile.am
Removed Files:
	AIModelData.cxx AIModelData.hxx
This commit is contained in:
frohlich 2009-06-22 21:04:52 +00:00 committed by Tim Moore
parent 8f501de78c
commit 33a2e2128f
7 changed files with 3 additions and 49 deletions

View file

@ -29,7 +29,6 @@
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include "AIModelData.hxx"
#include "AIBallistic.hxx" #include "AIBallistic.hxx"
#include <Main/util.hxx> #include <Main/util.hxx>
@ -118,12 +117,6 @@ void FGAIBallistic::readFromScenario(SGPropertyNode* scFileNode) {
setRandom(scFileNode->getBoolValue("random", false)); 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) { bool FGAIBallistic::init(bool search_in_AI_path) {
FGAIBase::init(search_in_AI_path); FGAIBase::init(search_in_AI_path);

View file

@ -43,8 +43,6 @@ public:
void readFromScenario(SGPropertyNode* scFileNode); void readFromScenario(SGPropertyNode* scFileNode);
virtual osg::Node* load3DModel(const string &path,
SGPropertyNode *prop_root);
bool init(bool search_in_AI_path=false); bool init(bool search_in_AI_path=false);
virtual void bind(); virtual void bind();
virtual void unbind(); virtual void unbind();

View file

@ -41,9 +41,9 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Scripting/NasalSys.hxx>
#include "AIBase.hxx" #include "AIBase.hxx"
#include "AIModelData.hxx"
#include "AIManager.hxx" #include "AIManager.hxx"
const char *default_model = "Models/Geometry/glider.ac"; 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) 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(); return model.get();
} }

View file

@ -24,9 +24,6 @@
#include <string> #include <string>
#include <list> #include <list>
#include <osg/Referenced>
#include <osg/Node>
#include <simgear/compiler.h> #include <simgear/compiler.h>
using std::string; using std::string;

View file

@ -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);
}

View file

@ -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

View file

@ -3,7 +3,6 @@ noinst_LIBRARIES = libAIModel.a
libAIModel_a_SOURCES = submodel.cxx submodel.hxx \ libAIModel_a_SOURCES = submodel.cxx submodel.hxx \
AIManager.hxx AIManager.cxx \ AIManager.hxx AIManager.cxx \
AIBase.hxx AIBase.cxx \ AIBase.hxx AIBase.cxx \
AIModelData.cxx AIModelData.hxx \
AIAircraft.hxx AIAircraft.cxx \ AIAircraft.hxx AIAircraft.cxx \
AIMultiplayer.hxx AIMultiplayer.cxx \ AIMultiplayer.hxx AIMultiplayer.cxx \
AIShip.hxx AIShip.cxx \ AIShip.hxx AIShip.cxx \