From 7e65ab2d3b6a70caeb48dc280124aefdc3eb924b Mon Sep 17 00:00:00 2001 From: mfranz Date: Wed, 12 Apr 2006 20:27:38 +0000 Subject: [PATCH] add support to textranslate & texrotate animation --- simgear/scene/model/animation.cxx | 20 ++++++++++++++++++-- simgear/scene/model/animation.hxx | 4 +++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 5dddc5bd..9e41c6cd 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -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) diff --git a/simgear/scene/model/animation.hxx b/simgear/scene/model/animation.hxx index 0ab2bb21..c4ab3d9e 100644 --- a/simgear/scene/model/animation.hxx +++ b/simgear/scene/model/animation.hxx @@ -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; -- 2.39.5