]> git.mxchange.org Git - flightgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Sat, 6 Jan 2007 14:25:55 +0000 (14:25 +0000)
committerfrohlich <frohlich>
Sat, 6 Jan 2007 14:25:55 +0000 (14:25 +0000)
AIBase.cxx AIManager.cxx AIManager.hxx: Remove dead code.
No ground intersection on AI models. Note that the carrier still
reenables that nodemask.

src/AIModel/AIBase.cxx
src/AIModel/AIManager.cxx
src/AIModel/AIManager.hxx

index 836df56d5ee54ab607e15ec80ce04c95e0dcf022..27cc00eb96ed9f87a893241e1c227f7bdfa26e89 100644 (file)
@@ -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 ) {
index c5decd5e35c2924b31ef1686e06d55b7aea50c2b..1b6bf324d0038d29e5d2e88a193248d075063b0e 100644 (file)
@@ -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)
 {
index 4b6d4ef085fc2e05151877772dffb1d91f0e2d20..b88203d69cd7c418c63f431c2664a0f8cb9a796c 100644 (file)
 #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,