}
}
+ // Set up the range selector node
+ float ranges[2];
+ ssgRangeSelector * lod = new ssgRangeSelector;
+ lod->addKid(_model);
+ ranges[0] = props.getFloatValue("range/min-m", 0);
+ ranges[1] = props.getFloatValue("range/max-m", 5000);
+ lod->setRanges(ranges, 2);
+
+
// Set up the alignment node
ssgTransform * align = new ssgTransform;
- align->addKid(_model);
+ align->addKid(lod);
sgMat4 rot_matrix;
sgMat4 off_matrix;
sgMat4 res_matrix;
_selector->addKid(_position);
_selector->clrTraversalMaskBits(SSGTRAV_HOT);
-
// Set up a location class
_location = (FGLocation *) new FGLocation;
const char * type = node->getStringValue("type");
if (!strcmp("none", type)) {
animation = new NullAnimation();
+ } else if (!strcmp("range", type)) {
+ animation = new RangeAnimation();
} else if (!strcmp("select", type)) {
animation = new SelectAnimation();
} else if (!strcmp("spin", type)) {
}
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FG3DModel::RangeAnimation
+////////////////////////////////////////////////////////////////////////
+
+FG3DModel::RangeAnimation::RangeAnimation ()
+ : _branch(new ssgRangeSelector)
+{
+}
+
+FG3DModel::RangeAnimation::~RangeAnimation ()
+{
+ _branch = 0;
+}
+
+void
+FG3DModel::RangeAnimation::init (ssgEntity * object,
+ SGPropertyNode * props)
+{
+ float ranges[2];
+ splice_branch(_branch, object);
+ _branch->setName(props->getStringValue("name", 0));
+ ranges[0] = props->getFloatValue("min-m", 0);
+ ranges[1] = props->getFloatValue("max-m", 5000);
+ _branch->setRanges(ranges, 2);
+}
+
+void
+FG3DModel::RangeAnimation::update (int dt)
+{
+}
+
+
\f
////////////////////////////////////////////////////////////////////////
// Implementation of FG3DModel::SelectAnimation
ssgBranch * _branch;
};
+
+ /**
+ * A range, or level-of-detail (LOD) animation.
+ */
+ class RangeAnimation : public Animation
+ {
+ public:
+ RangeAnimation ();
+ virtual ~RangeAnimation ();
+ virtual void init (ssgEntity * object, SGPropertyNode * props);
+ virtual void update (int dt);
+ private:
+ ssgRangeSelector * _branch;
+ };
+
/**
* Animation to select alternative versions of the same object.