Fix from Melchior: Set static values at every condition change, not only initially.
This commit is contained in:
@@ -1124,6 +1124,7 @@ SGMaterialAnimation::SGMaterialAnimation( SGPropertyNode *prop_root,
|
|||||||
SGPropertyNode_ptr props, const SGPath &texture_path)
|
SGPropertyNode_ptr props, const SGPath &texture_path)
|
||||||
: SGAnimation(props, new ssgBranch),
|
: SGAnimation(props, new ssgBranch),
|
||||||
_prop_root(prop_root),
|
_prop_root(prop_root),
|
||||||
|
_last_condition(false),
|
||||||
_prop_base(""),
|
_prop_base(""),
|
||||||
_texture_base(texture_path),
|
_texture_base(texture_path),
|
||||||
_cached_material(0),
|
_cached_material(0),
|
||||||
@@ -1192,6 +1193,8 @@ SGMaterialAnimation::SGMaterialAnimation( SGPropertyNode *prop_root,
|
|||||||
_thresh_prop = n ? _prop_root->getNode(path(n->getStringValue()), true) : 0;
|
_thresh_prop = n ? _prop_root->getNode(path(n->getStringValue()), true) : 0;
|
||||||
n = props->getChild("texture-prop");
|
n = props->getChild("texture-prop");
|
||||||
_tex_prop = n ? _prop_root->getNode(path(n->getStringValue()), true) : 0;
|
_tex_prop = n ? _prop_root->getNode(path(n->getStringValue()), true) : 0;
|
||||||
|
|
||||||
|
_static_update = _update;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SGMaterialAnimation::initColorGroup(SGPropertyNode_ptr group, ColorSpec *col, int flag)
|
void SGMaterialAnimation::initColorGroup(SGPropertyNode_ptr group, ColorSpec *col, int flag)
|
||||||
@@ -1230,8 +1233,15 @@ void SGMaterialAnimation::init()
|
|||||||
|
|
||||||
int SGMaterialAnimation::update()
|
int SGMaterialAnimation::update()
|
||||||
{
|
{
|
||||||
if (_condition && !_condition->test())
|
if (_condition) {
|
||||||
return 2;
|
bool cond = _condition->test();
|
||||||
|
if (cond && !_last_condition)
|
||||||
|
_update |= _static_update;
|
||||||
|
|
||||||
|
_last_condition = cond;
|
||||||
|
if (!cond)
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (_read & DIFFUSE)
|
if (_read & DIFFUSE)
|
||||||
updateColorGroup(&_diff, DIFFUSE);
|
updateColorGroup(&_diff, DIFFUSE);
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ private:
|
|||||||
float factor;
|
float factor;
|
||||||
float offset;
|
float offset;
|
||||||
float min;
|
float min;
|
||||||
float max;
|
float max;
|
||||||
SGPropertyNode_ptr value_prop;
|
SGPropertyNode_ptr value_prop;
|
||||||
SGPropertyNode_ptr factor_prop;
|
SGPropertyNode_ptr factor_prop;
|
||||||
SGPropertyNode_ptr offset_prop;
|
SGPropertyNode_ptr offset_prop;
|
||||||
@@ -507,6 +507,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
SGCondition *_condition;
|
SGCondition *_condition;
|
||||||
|
bool _last_condition;
|
||||||
SGPropertyNode *_prop_root;
|
SGPropertyNode *_prop_root;
|
||||||
string _prop_base;
|
string _prop_base;
|
||||||
SGPath _texture_base;
|
SGPath _texture_base;
|
||||||
@@ -516,6 +517,7 @@ private:
|
|||||||
ssgSimpleState* _cloned_material;
|
ssgSimpleState* _cloned_material;
|
||||||
unsigned _read;
|
unsigned _read;
|
||||||
unsigned _update;
|
unsigned _update;
|
||||||
|
unsigned _static_update;
|
||||||
bool _global;
|
bool _global;
|
||||||
ColorSpec _diff;
|
ColorSpec _diff;
|
||||||
ColorSpec _amb;
|
ColorSpec _amb;
|
||||||
|
|||||||
Reference in New Issue
Block a user