//
// This file is in the Public Domain, and comes with no warranty.
-#include "modelmgr.hxx"
+#include <plib/ssg.h>
#include <Main/fg_props.hxx>
+#include <Scenery/scenery.hxx>
+
+#include "modelmgr.hxx"
+#include "model.hxx"
FGModelMgr::FGModelMgr ()
- : _scene(new ssgRoot),
- _nearplane(0.5f),
- _farplane(120000.0f)
+ : _selector(new ssgSelector)
{
}
FGModelMgr::~FGModelMgr ()
{
- for (int i = 0; i < _instances.size(); i++) {
+ for (unsigned int i = 0; i < _instances.size(); i++) {
+ globals->get_scenery()->get_models_branch()
+ ->removeKid(_instances[i]->model->getSceneGraph());
delete _instances[i];
}
- delete _scene;
}
void
FGModelMgr::init ()
{
- vector<SGPropertyNode *> model_nodes =
+ vector<SGPropertyNode_ptr> model_nodes =
fgGetNode("/models", true)->getChildren("model");
- for (int i = 0; i < model_nodes.size(); i++) {
+ for (unsigned int i = 0; i < model_nodes.size(); i++) {
SGPropertyNode * node = model_nodes[i];
SG_LOG(SG_GENERAL, SG_INFO,
"Adding model " << node->getStringValue("name", "[unnamed]"));
else
model->setHeadingDeg(node->getDoubleValue("heading-deg"));
- // Add this model to the scene graph
- _scene->addKid(model->getSceneGraph());
+ // Add this model to the global scene graph
+ globals->get_scenery()->get_scene_graph()->addKid(model->getSceneGraph());
// Save this instance for updating
_instances.push_back(instance);
}
void
-FGModelMgr::update (int dt)
+FGModelMgr::update (double dt)
{
- for (int i = 0; i < _instances.size(); i++) {
+ for (unsigned int i = 0; i < _instances.size(); i++) {
Instance * instance = _instances[i];
FG3DModel * model = instance->model;
void
FGModelMgr::draw ()
{
- ssgSetNearFar(_nearplane, _farplane);
- ssgCullAndDraw(_scene);
+// ssgSetNearFar(_nearplane, _farplane);
+// ssgCullAndDraw(_scene);
}