From: ehofman Date: Thu, 8 Jan 2004 10:25:23 +0000 (+0000) Subject: Updates to the alpha-test animation class X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=40414f2823e426e12d2edfe7975a0ec9997b1f89;p=simgear.git Updates to the alpha-test animation class --- diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 30e5d16a..67c69cb0 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -872,10 +872,8 @@ SGTexMultipleAnimation::update() // Implementation of SGAlphaTestAnimation //////////////////////////////////////////////////////////////////////// -SGAlphaTestAnimation::SGAlphaTestAnimation (SGPropertyNode *prop_root, - SGPropertyNode_ptr props) - : SGAnimation(props, new ssgBranch), - _done(false) +SGAlphaTestAnimation::SGAlphaTestAnimation(SGPropertyNode_ptr props) + : SGAnimation(props, new ssgBranch) { _alpha_clamp = props->getFloatValue("alpha-factor", 0.0); } @@ -884,12 +882,9 @@ SGAlphaTestAnimation::~SGAlphaTestAnimation () { } -void SGAlphaTestAnimation::update() +void SGAlphaTestAnimation::init() { - if (!_done) { - _done = true; - setAlphaClampToBranch(_branch,_alpha_clamp); - } + setAlphaClampToBranch(_branch,_alpha_clamp); } void SGAlphaTestAnimation::setAlphaClampToBranch(ssgBranch *b, float clamp) diff --git a/simgear/scene/model/animation.hxx b/simgear/scene/model/animation.hxx index d5063feb..3c73eb47 100644 --- a/simgear/scene/model/animation.hxx +++ b/simgear/scene/model/animation.hxx @@ -387,10 +387,9 @@ private: class SGAlphaTestAnimation : public SGAnimation { public: - SGAlphaTestAnimation (SGPropertyNode *prop_root, - SGPropertyNode_ptr props); + SGAlphaTestAnimation(SGPropertyNode_ptr props); virtual ~SGAlphaTestAnimation (); - virtual void update(); + virtual void init(); private: void setAlphaClampToBranch(ssgBranch *b, float clamp); bool _done; diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index 96ebebaa..c2fdbb1c 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -131,7 +131,7 @@ sgMakeAnimation( ssgBranch * model, } else if (!strcmp("blend", type)) { animation = new SGBlendAnimation(prop_root, node); } else if (!strcmp("alpha-test", type)) { - animation = new SGAlphaTestAnimation(prop_root, node); + animation = new SGAlphaTestAnimation(node); } else { animation = new SGNullAnimation(node); SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);