Modified Files:
AIBase.cxx AIManager.cxx AIManager.hxx: Remove dead code. No ground intersection on AI models. Note that the carrier still reenables that nodemask.
This commit is contained in:
parent
b8dffe05ab
commit
6cf05270f5
3 changed files with 4 additions and 78 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/scene/model/location.hxx>
|
||||
#include <simgear/scene/model/model.hxx>
|
||||
#include <simgear/scene/util/SGNodeMasks.hxx>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
|
||||
|
@ -171,23 +172,9 @@ FGAIBase::load3DModel(const string& fg_root,
|
|||
SGPropertyNode *prop_root,
|
||||
double sim_time_sec)
|
||||
{
|
||||
// some more code here to check whether a model with this name has already been loaded
|
||||
// if not load it, otherwise, get the memory pointer and do something like
|
||||
// SetModel as in ATC/AIEntity.cxx
|
||||
osg::Group* personality_branch = new osg::Group;
|
||||
|
||||
//model = manager->getModel(path);
|
||||
//if (!(model)) {
|
||||
model = sgLoad3DModel(fg_root,
|
||||
path,
|
||||
prop_root,
|
||||
sim_time_sec);
|
||||
// manager->setModel(path, model.get());
|
||||
//}
|
||||
personality_branch->addChild( model.get() );
|
||||
|
||||
return personality_branch;
|
||||
//return model;
|
||||
model = sgLoad3DModel(fg_root, path, prop_root, sim_time_sec);
|
||||
model->setNodeMask(model->getNodeMask() & ~SG_NODEMASK_TERRAIN_BIT);
|
||||
return model.get();
|
||||
}
|
||||
|
||||
bool FGAIBase::isa( object_type otype ) {
|
||||
|
|
|
@ -256,46 +256,6 @@ FGAIManager::loadScenarioFile(const std::string& filename)
|
|||
}
|
||||
}
|
||||
|
||||
// This code keeps track of models that have already been loaded
|
||||
// Eventually we'd prbably need to find a way to keep track of models
|
||||
// that are unloaded again
|
||||
osg::Node* FGAIManager::getModel(const string& path)
|
||||
{
|
||||
ModelVecIterator i = loadedModels.begin();
|
||||
//cerr << "Reference count summary " << endl;
|
||||
int count = 0;
|
||||
while (i != loadedModels.end())
|
||||
{
|
||||
count += i->getNumRefs() -1;
|
||||
//cerr << "Model " << i->getPath() << " has reference count of " << i->getNumRefs() << " ";
|
||||
if (i->getNumRefs() == 1)
|
||||
{
|
||||
i = loadedModels.erase(i);
|
||||
//cerr << "[ Deleted ]" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
//cerr << endl;
|
||||
}
|
||||
}
|
||||
//cerr << "Reference summary end : " << count << "models allocated" << endl;
|
||||
i = loadedModels.begin();
|
||||
|
||||
while (i != loadedModels.end())
|
||||
{
|
||||
if (i->getPath() == path)
|
||||
return i->getModelId();
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FGAIManager::setModel(const string& path, osg::Node *model)
|
||||
{
|
||||
loadedModels.push_back(FGModelID(path,model));
|
||||
}
|
||||
|
||||
bool FGAIManager::getStartPosition(const string& id, const string& pid,
|
||||
SGGeod& geodPos, double& hdng, SGVec3d& uvw)
|
||||
{
|
||||
|
|
|
@ -37,26 +37,9 @@
|
|||
#include <Traffic/Schedule.hxx>
|
||||
|
||||
SG_USING_STD(list);
|
||||
SG_USING_STD(vector);
|
||||
|
||||
class FGModelID
|
||||
{
|
||||
private:
|
||||
osg::ref_ptr<osg::Node> model;
|
||||
string path;
|
||||
public:
|
||||
FGModelID(const string& pth, osg::Node* mdl) { path =pth; model=mdl;};
|
||||
osg::Node* const getModelId() const { return model.get();};
|
||||
const string & getPath() const { return path;};
|
||||
int getNumRefs() const { return model->referenceCount(); };
|
||||
};
|
||||
|
||||
typedef vector<FGModelID> ModelVec;
|
||||
typedef vector<FGModelID>::iterator ModelVecIterator;
|
||||
|
||||
class FGAIThermal;
|
||||
|
||||
|
||||
class FGAIManager : public SGSubsystem
|
||||
{
|
||||
|
||||
|
@ -68,7 +51,6 @@ private:
|
|||
typedef ai_list_type::const_iterator ai_list_const_iterator;
|
||||
|
||||
ai_list_type ai_list;
|
||||
ModelVec loadedModels;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -99,9 +81,6 @@ public:
|
|||
|
||||
void processScenario( const string &filename );
|
||||
|
||||
osg::Node* getModel(const string& path);
|
||||
void setModel(const string& path, osg::Node *model);
|
||||
|
||||
static SGPropertyNode_ptr loadScenarioFile(const std::string& filename);
|
||||
|
||||
static bool getStartPosition(const string& id, const string& pid,
|
||||
|
|
Loading…
Reference in a new issue