Translation(const SGVec3d& axis) :
_axis(axis)
{ }
- void setValue(double value)
- { _value = value; }
virtual void transform(osg::Matrix& matrix)
{
osg::Matrix tmp;
SGTexTransformAnimation::appendTexTranslate(const SGPropertyNode* config,
UpdateCallback* updateCallback)
{
- std::string propertyName = config->getStringValue("property", "/null");
+ std::string propertyName = config->getStringValue("property", "");
SGSharedPtr<SGExpressiond> value;
- if (getModelRoot()->hasChild(propertyName))
- value = new SGPropertyExpression<double>(getModelRoot()->getNode(propertyName));
- else
+ if (propertyName.empty())
value = new SGConstExpression<double>(0);
+ else {
+ SGPropertyNode* inputProperty = getModelRoot()->getNode(propertyName, true);
+ value = new SGPropertyExpression<double>(inputProperty);
+ }
- SGSharedPtr<SGExpressiond> animationValue;
SGInterpTable* table = read_interpolation_table(config);
if (table) {
value = new SGInterpTableExpression<double>(value, table);
value = new SGStepExpression<double>(value,
config->getDoubleValue("step", 0),
config->getDoubleValue("scroll", 0));
- animationValue = value->simplify();
+ value = value->simplify();
} else {
double biasValue = config->getDoubleValue("bias", 0);
if (biasValue != 0)
double maxClip = config->getDoubleValue("max", SGLimitsd::max());
value = new SGClipExpression<double>(value, minClip, maxClip);
}
- animationValue = value->simplify();
+ value = value->simplify();
}
SGVec3d axis(config->getDoubleValue("axis/x", 0),
config->getDoubleValue("axis/y", 0),
Translation* translation;
translation = new Translation(normalize(axis));
translation->setValue(config->getDoubleValue("starting-position", 0));
- updateCallback->appendTransform(translation, animationValue);
+ updateCallback->appendTransform(translation, value);
}
void
SGTexTransformAnimation::appendTexRotate(const SGPropertyNode* config,
UpdateCallback* updateCallback)
{
- std::string propertyName = config->getStringValue("property", "/null");
+ std::string propertyName = config->getStringValue("property", "");
SGSharedPtr<SGExpressiond> value;
- if (getModelRoot()->hasChild(propertyName))
- value = new SGPropertyExpression<double>(getModelRoot()->getNode(propertyName));
- else
+ if (propertyName.empty())
value = new SGConstExpression<double>(0);
+ else {
+ SGPropertyNode* inputProperty = getModelRoot()->getNode(propertyName, true);
+ value = new SGPropertyExpression<double>(inputProperty);
+ }
- SGSharedPtr<SGExpressiond> animationValue;
SGInterpTable* table = read_interpolation_table(config);
if (table) {
value = new SGInterpTableExpression<double>(value, table);
value = new SGStepExpression<double>(value,
config->getDoubleValue("step", 0),
config->getDoubleValue("scroll", 0));
- animationValue = value->simplify();
+ value = value->simplify();
} else {
double biasValue = config->getDoubleValue("bias", 0);
if (biasValue != 0)
double maxClip = config->getDoubleValue("max-deg", SGLimitsd::max());
value = new SGClipExpression<double>(value, minClip, maxClip);
}
- animationValue = value->simplify();
+ value = value->simplify();
}
SGVec3d axis(config->getDoubleValue("axis/x", 0),
config->getDoubleValue("axis/y", 0),
Rotation* rotation;
rotation = new Rotation(normalize(axis), center);
rotation->setValue(config->getDoubleValue("starting-position-deg", 0));
- updateCallback->appendTransform(rotation, animationValue);
+ updateCallback->appendTransform(rotation, value);
}