- }
-
- // Assume that textures are in
- // the same location as the XML file.
- if (model == 0) {
- ssgTexturePath((char *)xmlpath.dir().c_str());
- model = (ssgBranch *)ssgLoad((char *)modelpath.c_str());
- if (model == 0)
- throw sg_exception("Failed to load 3D model");
- }
-
- // Set up the alignment node
- ssgTransform * alignmainmodel = new ssgTransform;
- alignmainmodel->addKid(model);
- sgMat4 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),
- props.getFloatValue("/offsets/x-m", 0.0),
- props.getFloatValue("/offsets/y-m", 0.0),
- props.getFloatValue("/offsets/z-m", 0.0));
- alignmainmodel->setTransform(res_matrix);
-
- unsigned int i;
-
- // Load animations
- vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
- for (i = 0; i < animation_nodes.size(); i++) {
- const char * name = animation_nodes[i]->getStringValue("name", 0);
- vector<SGPropertyNode_ptr> name_nodes =
- animation_nodes[i]->getChildren("object-name");
- sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
- sim_time_sec);
- }