#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Main/viewmgr.hxx>
+#include <Scenery/scenery.hxx>
+
#include "acmodel.hxx"
+#include "model.hxx"
\f
delete _aircraft;
delete _scene;
// SSG will delete it
- globals->get_aircraft_branch()->removeKid(_selector);
+ globals->get_scenery()->get_aircraft_branch()->removeKid(_selector);
}
void
FGAircraftModel::init ()
{
- _aircraft = new FG3DModel;
- _aircraft->init(fgGetString("/sim/model/path", "Models/Geometry/glider.ac"));
+ _aircraft = new FGModelPlacement;
+ string path = fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
+ try {
+ _aircraft->init(path);
+ } catch (const sg_exception &ex) {
+ SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path);
+ SG_LOG(SG_GENERAL, SG_ALERT, "(Falling back to glider.ac.)");
+ _aircraft->init("Models/Geometry/glider.ac");
+ }
_scene->addKid(_aircraft->getSceneGraph());
_selector->addKid(_aircraft->getSceneGraph());
- globals->get_aircraft_branch()->addKid(_selector);
+ globals->get_scenery()->get_aircraft_branch()->addKid(_selector);
}
void
}
void
-FGAircraftModel::update (int dt)
+FGAircraftModel::update (double dt)
{
int view_number = globals->get_viewmgr()->get_current();