1
0
Fork 0

extract loop body into separate function to later allow model addition

at runtime; remove Nasal support for now (the model loader is currently
initialized before the Nasal subsystem is available)
This commit is contained in:
mfranz 2006-03-20 12:10:20 +00:00
parent 7845f33c74
commit 40f2294539
2 changed files with 57 additions and 51 deletions

View file

@ -18,7 +18,6 @@
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <Scripting/NasalSys.hxx>
#include "modelmgr.hxx" #include "modelmgr.hxx"
@ -45,8 +44,14 @@ FGModelMgr::init ()
{ {
vector<SGPropertyNode_ptr> model_nodes = vector<SGPropertyNode_ptr> model_nodes =
fgGetNode("/models", true)->getChildren("model"); fgGetNode("/models", true)->getChildren("model");
for (unsigned int i = 0; i < model_nodes.size(); i++) {
SGPropertyNode * node = model_nodes[i]; for (unsigned int i = 0; i < model_nodes.size(); i++)
add_model(model_nodes[i]);
}
void
FGModelMgr::add_model (SGPropertyNode * node)
{
SG_LOG(SG_GENERAL, SG_INFO, SG_LOG(SG_GENERAL, SG_INFO,
"Adding model " << node->getStringValue("name", "[unnamed]")); "Adding model " << node->getStringValue("name", "[unnamed]"));
Instance * instance = new Instance; Instance * instance = new Instance;
@ -57,7 +62,7 @@ FGModelMgr::init ()
node->getStringValue("path", node->getStringValue("path",
"Models/Geometry/glider.ac"), "Models/Geometry/glider.ac"),
globals->get_props(), globals->get_props(),
globals->get_sim_time_sec(), 0, new FGNasalModelData ); globals->get_sim_time_sec() );
model->init( object ); model->init( object );
// Set position and orientation either // Set position and orientation either
@ -109,7 +114,6 @@ FGModelMgr::init ()
// Save this instance for updating // Save this instance for updating
add_instance(instance); add_instance(instance);
} }
}
void void
FGModelMgr::bind () FGModelMgr::bind ()

View file

@ -64,6 +64,8 @@ public:
virtual void unbind (); virtual void unbind ();
virtual void update (double dt); virtual void update (double dt);
virtual void add_model (SGPropertyNode * node);
/** /**
* Add an instance of a dynamic model to the manager. * Add an instance of a dynamic model to the manager.
* *