Better fix for the constant scale factor problem

This commit is contained in:
fredb 2007-01-21 11:15:36 +00:00
parent dd4326f7c4
commit d534cf6f02

View File

@ -220,7 +220,7 @@ public:
_interpTable(interpTable)
{ }
virtual double getValue() const
{ return _interpTable->interpolate(_propertyNode->getDoubleValue()); }
{ return _interpTable->interpolate(_propertyNode ? _propertyNode->getDoubleValue() : 0); }
private:
SGSharedPtr<SGPropertyNode const> _propertyNode;
SGSharedPtr<SGInterpTable const> _interpTable;
@ -1050,9 +1050,9 @@ public:
if (!_condition || _condition->test()) {
SGScaleAnimation::Transform* transform;
transform = static_cast<SGScaleAnimation::Transform*>(node);
SGVec3d scale(_animationValue[0] ? _animationValue[0]->getValue() : 1.0,
_animationValue[1] ? _animationValue[1]->getValue() : 1.0,
_animationValue[2] ? _animationValue[2]->getValue() : 1.0);
SGVec3d scale(_animationValue[0]->getValue(),
_animationValue[1]->getValue(),
_animationValue[2]->getValue());
transform->setScaleFactor(scale);
}
traverse(node, nv);
@ -1074,9 +1074,10 @@ SGScaleAnimation::SGScaleAnimation(const SGPropertyNode* configNode,
std::string inputPropertyName;
inputPropertyName = configNode->getStringValue("property", "");
SGPropertyNode* inputProperty = 0;
if (!inputPropertyName.empty()) {
SGPropertyNode* inputProperty;
inputProperty = modelRoot->getNode(inputPropertyName.c_str(), true);
}
SGInterpTable* interpTable = read_interpolation_table(configNode);
if (interpTable) {
SGInterpTableValue* value;
@ -1124,7 +1125,6 @@ SGScaleAnimation::SGScaleAnimation(const SGPropertyNode* configNode,
value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
_animationValue[2] = value;
}
}
_initialValue[0] = configNode->getDoubleValue("x-starting-scale", 1);
_initialValue[0] *= configNode->getDoubleValue("x-factor", factor);
_initialValue[0] += configNode->getDoubleValue("x-offset", offset);