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:
parent
8f501de78c
commit
33a2e2128f
7 changed files with 3 additions and 49 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include <osg/Referenced>
|
||||
#include <osg/Node>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
using std::string;
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue