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:
parent
7845f33c74
commit
40f2294539
2 changed files with 57 additions and 51 deletions
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
|
||||
|
||||
#include "modelmgr.hxx"
|
||||
|
@ -45,8 +44,14 @@ FGModelMgr::init ()
|
|||
{
|
||||
vector<SGPropertyNode_ptr> model_nodes =
|
||||
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,
|
||||
"Adding model " << node->getStringValue("name", "[unnamed]"));
|
||||
Instance * instance = new Instance;
|
||||
|
@ -57,7 +62,7 @@ FGModelMgr::init ()
|
|||
node->getStringValue("path",
|
||||
"Models/Geometry/glider.ac"),
|
||||
globals->get_props(),
|
||||
globals->get_sim_time_sec(), 0, new FGNasalModelData );
|
||||
globals->get_sim_time_sec() );
|
||||
model->init( object );
|
||||
|
||||
// Set position and orientation either
|
||||
|
@ -109,7 +114,6 @@ FGModelMgr::init ()
|
|||
// Save this instance for updating
|
||||
add_instance(instance);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FGModelMgr::bind ()
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
virtual void unbind ();
|
||||
virtual void update (double dt);
|
||||
|
||||
virtual void add_model (SGPropertyNode * node);
|
||||
|
||||
/**
|
||||
* Add an instance of a dynamic model to the manager.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue