add <condition> support to textranslate & texrotate animation

This commit is contained in:
mfranz
2006-04-12 20:27:38 +00:00
parent fec769f632
commit 7e65ab2d3b
2 changed files with 21 additions and 3 deletions

View File

@@ -880,8 +880,13 @@ SGTexRotateAnimation::SGTexRotateAnimation( SGPropertyNode *prop_root,
_min_deg(props->getDoubleValue("min-deg")),
_has_max(props->hasValue("max-deg")),
_max_deg(props->getDoubleValue("max-deg")),
_position_deg(props->getDoubleValue("starting-position-deg", 0))
_position_deg(props->getDoubleValue("starting-position-deg", 0)),
_condition(0)
{
SGPropertyNode *node = props->getChild("condition");
if (node != 0)
_condition = sgReadCondition(prop_root, node);
_center[0] = props->getFloatValue("center/x", 0);
_center[1] = props->getFloatValue("center/y", 0);
_center[2] = props->getFloatValue("center/z", 0);
@@ -899,6 +904,9 @@ SGTexRotateAnimation::~SGTexRotateAnimation ()
int
SGTexRotateAnimation::update()
{
if (_condition && !_condition->test())
return 1;
if (_table == 0) {
_position_deg = _prop->getDoubleValue() * _factor + _offset_deg;
if (_has_min && _position_deg < _min_deg)
@@ -931,8 +939,13 @@ SGTexTranslateAnimation::SGTexTranslateAnimation( SGPropertyNode *prop_root,
_min(props->getDoubleValue("min")),
_has_max(props->hasValue("max")),
_max(props->getDoubleValue("max")),
_position(props->getDoubleValue("starting-position", 0))
_position(props->getDoubleValue("starting-position", 0)),
_condition(0)
{
SGPropertyNode *node = props->getChild("condition");
if (node != 0)
_condition = sgReadCondition(prop_root, node);
_axis[0] = props->getFloatValue("axis/x", 0);
_axis[1] = props->getFloatValue("axis/y", 0);
_axis[2] = props->getFloatValue("axis/z", 0);
@@ -947,6 +960,9 @@ SGTexTranslateAnimation::~SGTexTranslateAnimation ()
int
SGTexTranslateAnimation::update()
{
if (_condition && !_condition->test())
return 1;
if (_table == 0) {
_position = (apply_mods(_prop->getDoubleValue(), _step, _scroll) + _offset) * _factor;
if (_has_min && _position < _min)

View File

@@ -354,6 +354,7 @@ private:
sgMat4 _matrix;
sgVec3 _center;
sgVec3 _axis;
SGCondition * _condition;
};
@@ -381,6 +382,7 @@ private:
double _position;
sgMat4 _matrix;
sgVec3 _axis;
SGCondition * _condition;
};
@@ -508,7 +510,7 @@ private:
};
SGCondition *_condition;
bool _last_condition;
SGPropertyNode *_prop_root;
SGPropertyNode_ptr _prop_root;
string _prop_base;
SGPath _texture_base;
SGPath _texture;