//
// This file is in the Public Domain, and comes with no warranty.
+#ifdef HAVE_CONFIG_H
+# include <simgear_config.h>
+#endif
#include <string.h> // for strcmp()
#include <math.h>
SGPropertyNode_ptr props )
: SGAnimation(props, new ssgTransform),
_prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
- _x_factor(props->getDoubleValue("x-factor", 0)),
- _y_factor(props->getDoubleValue("y-factor", 0)),
- _z_factor(props->getDoubleValue("z-factor", 0)),
+ _x_factor(props->getDoubleValue("x-factor", 1.0)),
+ _y_factor(props->getDoubleValue("y-factor", 1.0)),
+ _z_factor(props->getDoubleValue("z-factor", 1.0)),
_x_offset(props->getDoubleValue("x-offset", 1.0)),
_y_offset(props->getDoubleValue("y-offset", 1.0)),
_z_offset(props->getDoubleValue("z-offset", 1.0)),
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);