//
// This file is in the Public Domain, and comes with no warranty.
+#ifdef _MSC_VER
+# pragma warning( disable: 4355 )
+#endif
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <algorithm>
#include <functional>
#include <vector>
-
-#include <osg/Math>
+#include <cstring>
#include <simgear/scene/model/placement.hxx>
#include <simgear/scene/model/modellib.hxx>
void
FGModelMgr::add_model (SGPropertyNode * node)
{
- SG_LOG(SG_GENERAL, SG_INFO,
+ SG_LOG(SG_AIRCRAFT, SG_INFO,
"Adding model " << node->getStringValue("name", "[unnamed]"));
- Instance * instance = new Instance;
- SGModelPlacement *model = new SGModelPlacement;
- instance->model = model;
- instance->node = node;
const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
osg::Node *object;
try {
- object = SGModelLib::loadPagedModel(path, globals->get_props());
+ object = SGModelLib::loadDeferredModel(path, globals->get_props());
} catch (const sg_throwable& t) {
- SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n "
+ SG_LOG(SG_AIRCRAFT, SG_ALERT, "Error loading " << path << ":\n "
<< t.getFormattedMessage() << t.getOrigin());
return;
}
+ Instance * instance = new Instance;
+ SGModelPlacement *model = new SGModelPlacement;
+ instance->model = model;
+ instance->node = node;
+
model->init( object );
// Set position and orientation either
{
double testNan(double val) throw (sg_range_exception)
{
- if (osg::isNaN(val))
+ if (SGMisc<double>::isNaN(val))
throw sg_range_exception("value is nan");
return val;
}
{
SGModelPlacement* model = instance->model;
double lon, lat, elev, roll, pitch, heading;
+ lon = lat = elev = roll = pitch = heading = 0.0;
try {
// Optionally set position from properties
pitch = testNan(instance->pitch_deg_node->getDoubleValue());
if (instance->heading_deg_node != 0)
heading = testNan(instance->heading_deg_node->getDoubleValue());
- } catch (const sg_range_exception& e) {
+ } catch (const sg_range_exception&) {
const char *path = instance->node->getStringValue("path",
"unknown");
- SG_LOG(SG_GENERAL, SG_INFO, "Instance of model " << path
+ SG_LOG(SG_AIRCRAFT, SG_INFO, "Instance of model " << path
<< " has invalid values");
return;
}