Updates to the alpha-test animation class

This commit is contained in:
ehofman 2004-01-08 10:25:23 +00:00
parent 3d43bc0480
commit 40414f2823
3 changed files with 7 additions and 13 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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);