#include <plib/ssg.h>
#include <plib/ul.h>
-#include <simgear/misc/exception.hxx>
+#include <simgear/structure/exception.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/scene/model/animation.hxx>
+#include <simgear/scene/model/model.hxx>
#include "panelnode.hxx"
-#include "model.hxx"
#include "model_panel.hxx"
SG_USING_STD(vector);
SGPropertyNode props;
// Load the 3D aircraft object itself
- SGPath xmlpath;
SGPath modelpath = path;
- if ( ulIsAbsolutePathName( path.c_str() ) ) {
- xmlpath = modelpath;
- }
- else {
- xmlpath = fg_root;
- xmlpath.append(modelpath.str());
+ if ( !ulIsAbsolutePathName( path.c_str() ) ) {
+ SGPath tmp = fg_root;
+ tmp.append(modelpath.str());
+ modelpath = tmp;
}
// Check for an XML wrapper
- if (xmlpath.str().substr(xmlpath.str().size() - 4, 4) == ".xml") {
- readProperties(xmlpath.str(), &props);
+ if (modelpath.str().substr(modelpath.str().size() - 4, 4) == ".xml") {
+ readProperties(modelpath.str(), &props);
if (props.hasValue("/path")) {
modelpath = modelpath.dir();
modelpath.append(props.getStringValue("/path"));
// Assume that textures are in
// the same location as the XML file.
if (model == 0) {
- ssgTexturePath((char *)xmlpath.dir().c_str());
+ ssgTexturePath((char *)modelpath.dir().c_str());
model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
if (model == 0)
throw sg_exception("Failed to load 3D model");
ssgTransform * alignmainmodel = new ssgTransform;
alignmainmodel->addKid(model);
sgMat4 res_matrix;
- fgMakeOffsetsMatrix(&res_matrix,
+ sgMakeOffsetsMatrix(&res_matrix,
props.getFloatValue("/offsets/heading-deg", 0.0),
props.getFloatValue("/offsets/roll-deg", 0.0),
props.getFloatValue("/offsets/pitch-deg", 0.0),
const char * name = animation_nodes[i]->getStringValue("name", 0);
vector<SGPropertyNode_ptr> name_nodes =
animation_nodes[i]->getChildren("object-name");
- fgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
+ sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
sim_time_sec);
}
SGPropertyNode_ptr node = model_nodes[i];
ssgTransform * align = new ssgTransform;
sgMat4 res_matrix;
- fgMakeOffsetsMatrix(&res_matrix,
+ sgMakeOffsetsMatrix(&res_matrix,
node->getFloatValue("offsets/heading-deg", 0.0),
node->getFloatValue("offsets/roll-deg", 0.0),
node->getFloatValue("offsets/pitch-deg", 0.0),
node->getFloatValue("offsets/z-m", 0.0));
align->setTransform(res_matrix);
- ssgBranch * kid = fgLoad3DModel( fg_root, node->getStringValue("path"),
+ ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"),
prop_root, sim_time_sec );
align->addKid(kid);
model->addKid(align);