SGPropertyNode_ptr props, const SGPath &texture_path)
: SGAnimation(props, new ssgBranch),
_prop_root(prop_root),
+ _last_condition(false),
_prop_base(""),
_texture_base(texture_path),
_cached_material(0),
_thresh_prop = n ? _prop_root->getNode(path(n->getStringValue()), true) : 0;
n = props->getChild("texture-prop");
_tex_prop = n ? _prop_root->getNode(path(n->getStringValue()), true) : 0;
+
+ _static_update = _update;
}
void SGMaterialAnimation::initColorGroup(SGPropertyNode_ptr group, ColorSpec *col, int flag)
int SGMaterialAnimation::update()
{
- if (_condition && !_condition->test())
- return 2;
+ if (_condition) {
+ bool cond = _condition->test();
+ if (cond && !_last_condition)
+ _update |= _static_update;
+
+ _last_condition = cond;
+ if (!cond)
+ return 2;
+ }
if (_read & DIFFUSE)
updateColorGroup(&_diff, DIFFUSE);
float factor;
float offset;
float min;
- float max;
+ float max;
SGPropertyNode_ptr value_prop;
SGPropertyNode_ptr factor_prop;
SGPropertyNode_ptr offset_prop;
}
};
SGCondition *_condition;
+ bool _last_condition;
SGPropertyNode *_prop_root;
string _prop_base;
SGPath _texture_base;
ssgSimpleState* _cloned_material;
unsigned _read;
unsigned _update;
+ unsigned _static_update;
bool _global;
ColorSpec _diff;
ColorSpec _amb;