SG_LOG(SG_INPUT, SG_ALERT, "No object-name given for transformation");
} else {
for (unsigned int j = 0; j < name_nodes.size(); j++) {
- _animations.push_back(read_animation(name_nodes[j]->getStringValue(),
- animation_nodes[i]));
+ Animation animation;
+ read_animation(animation, name_nodes[j]->getStringValue(),
+ animation_nodes[i]);
+ _animations.push_back(animation);
}
}
}
}
}
-FGAircraftModel::Animation
-FGAircraftModel::read_animation (const string &object_name,
+void
+FGAircraftModel::read_animation (Animation &animation,
+ const string &object_name,
const SGPropertyNode * node)
{
- Animation animation;
-
// Find the object to be animated
ssgEntity * target = find_named_node(_model, object_name);
if (target != 0) {
SG_LOG(SG_INPUT, SG_INFO, " Target object is " << object_name);
} else {
- animation.type = Animation::None;
SG_LOG(SG_INPUT, SG_ALERT, "Object " << object_name
<< " not found in model");
- return animation;
+ return;
}
// Figure out the animation type
} else if (type_name == "none") {
SG_LOG(SG_INPUT, SG_INFO, "Reading disabled animation");
animation.type = Animation::None;
- return animation;
+ return;
} else {
animation.type = Animation::None;
SG_LOG(SG_INPUT, SG_ALERT, "Unknown animation type " << type_name);
- return animation;
+ return;
}
// Splice a transform node into the tree
animation.axis[2] = node->getFloatValue("axis/z", 0);
sgNormalizeVec3(animation.axis);
-
- return animation;
}
void
}
}
+
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FGAircraftModel::Animation
+////////////////////////////////////////////////////////////////////////
+
+FGAircraftModel::Animation::Animation ()
+ : name(""),
+ type(None),
+ transform(0),
+ prop(0),
+ factor(0),
+ offset(0),
+ position(0),
+ has_min(false),
+ min(0),
+ has_max(false),
+ max(0)
+{
+}
+
+FGAircraftModel::Animation::~Animation ()
+{
+ // pointers are managed elsewhere; these are just references
+}
+
/*
* Transform to rotate an object around its local axis
* from a relative frame of reference at center -- NHV
transform->setTransform(matrix);
}
-
// end of model.cxx