Better fix for the constant scale factor problem
This commit is contained in:
parent
dd4326f7c4
commit
d534cf6f02
@ -220,7 +220,7 @@ public:
|
|||||||
_interpTable(interpTable)
|
_interpTable(interpTable)
|
||||||
{ }
|
{ }
|
||||||
virtual double getValue() const
|
virtual double getValue() const
|
||||||
{ return _interpTable->interpolate(_propertyNode->getDoubleValue()); }
|
{ return _interpTable->interpolate(_propertyNode ? _propertyNode->getDoubleValue() : 0); }
|
||||||
private:
|
private:
|
||||||
SGSharedPtr<SGPropertyNode const> _propertyNode;
|
SGSharedPtr<SGPropertyNode const> _propertyNode;
|
||||||
SGSharedPtr<SGInterpTable const> _interpTable;
|
SGSharedPtr<SGInterpTable const> _interpTable;
|
||||||
@ -1050,9 +1050,9 @@ public:
|
|||||||
if (!_condition || _condition->test()) {
|
if (!_condition || _condition->test()) {
|
||||||
SGScaleAnimation::Transform* transform;
|
SGScaleAnimation::Transform* transform;
|
||||||
transform = static_cast<SGScaleAnimation::Transform*>(node);
|
transform = static_cast<SGScaleAnimation::Transform*>(node);
|
||||||
SGVec3d scale(_animationValue[0] ? _animationValue[0]->getValue() : 1.0,
|
SGVec3d scale(_animationValue[0]->getValue(),
|
||||||
_animationValue[1] ? _animationValue[1]->getValue() : 1.0,
|
_animationValue[1]->getValue(),
|
||||||
_animationValue[2] ? _animationValue[2]->getValue() : 1.0);
|
_animationValue[2]->getValue());
|
||||||
transform->setScaleFactor(scale);
|
transform->setScaleFactor(scale);
|
||||||
}
|
}
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
@ -1074,56 +1074,56 @@ SGScaleAnimation::SGScaleAnimation(const SGPropertyNode* configNode,
|
|||||||
|
|
||||||
std::string inputPropertyName;
|
std::string inputPropertyName;
|
||||||
inputPropertyName = configNode->getStringValue("property", "");
|
inputPropertyName = configNode->getStringValue("property", "");
|
||||||
|
SGPropertyNode* inputProperty = 0;
|
||||||
if (!inputPropertyName.empty()) {
|
if (!inputPropertyName.empty()) {
|
||||||
SGPropertyNode* inputProperty;
|
|
||||||
inputProperty = modelRoot->getNode(inputPropertyName.c_str(), true);
|
inputProperty = modelRoot->getNode(inputPropertyName.c_str(), true);
|
||||||
SGInterpTable* interpTable = read_interpolation_table(configNode);
|
}
|
||||||
if (interpTable) {
|
SGInterpTable* interpTable = read_interpolation_table(configNode);
|
||||||
SGInterpTableValue* value;
|
if (interpTable) {
|
||||||
value = new SGInterpTableValue(inputProperty, interpTable);
|
SGInterpTableValue* value;
|
||||||
_animationValue[0] = value;
|
value = new SGInterpTableValue(inputProperty, interpTable);
|
||||||
_animationValue[1] = value;
|
_animationValue[0] = value;
|
||||||
_animationValue[2] = value;
|
_animationValue[1] = value;
|
||||||
} else if (configNode->getBoolValue("use-personality", false)) {
|
_animationValue[2] = value;
|
||||||
SGPersScaleOffsetValue* value;
|
} else if (configNode->getBoolValue("use-personality", false)) {
|
||||||
value = new SGPersScaleOffsetValue(inputProperty, configNode,
|
SGPersScaleOffsetValue* value;
|
||||||
"x-factor", "x-offset",
|
value = new SGPersScaleOffsetValue(inputProperty, configNode,
|
||||||
factor, offset);
|
"x-factor", "x-offset",
|
||||||
value->setMin(configNode->getDoubleValue("x-min", 0));
|
factor, offset);
|
||||||
value->setMax(configNode->getDoubleValue("x-max", SGLimitsd::max()));
|
value->setMin(configNode->getDoubleValue("x-min", 0));
|
||||||
_animationValue[0] = value;
|
value->setMax(configNode->getDoubleValue("x-max", SGLimitsd::max()));
|
||||||
value = new SGPersScaleOffsetValue(inputProperty, configNode,
|
_animationValue[0] = value;
|
||||||
"y-factor", "y-offset",
|
value = new SGPersScaleOffsetValue(inputProperty, configNode,
|
||||||
factor, offset);
|
"y-factor", "y-offset",
|
||||||
value->setMin(configNode->getDoubleValue("y-min", 0));
|
factor, offset);
|
||||||
value->setMax(configNode->getDoubleValue("y-max", SGLimitsd::max()));
|
value->setMin(configNode->getDoubleValue("y-min", 0));
|
||||||
_animationValue[1] = value;
|
value->setMax(configNode->getDoubleValue("y-max", SGLimitsd::max()));
|
||||||
value = new SGPersScaleOffsetValue(inputProperty, configNode,
|
_animationValue[1] = value;
|
||||||
"z-factor", "z-offset",
|
value = new SGPersScaleOffsetValue(inputProperty, configNode,
|
||||||
factor, offset);
|
"z-factor", "z-offset",
|
||||||
value->setMin(configNode->getDoubleValue("z-min", 0));
|
factor, offset);
|
||||||
value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
|
value->setMin(configNode->getDoubleValue("z-min", 0));
|
||||||
_animationValue[2] = value;
|
value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
|
||||||
} else {
|
_animationValue[2] = value;
|
||||||
SGScaleOffsetValue* value = new SGScaleOffsetValue(inputProperty);
|
} else {
|
||||||
value->setScale(configNode->getDoubleValue("x-factor", factor));
|
SGScaleOffsetValue* value = new SGScaleOffsetValue(inputProperty);
|
||||||
value->setOffset(configNode->getDoubleValue("x-offset", offset));
|
value->setScale(configNode->getDoubleValue("x-factor", factor));
|
||||||
value->setMin(configNode->getDoubleValue("x-min", 0));
|
value->setOffset(configNode->getDoubleValue("x-offset", offset));
|
||||||
value->setMax(configNode->getDoubleValue("x-max", SGLimitsd::max()));
|
value->setMin(configNode->getDoubleValue("x-min", 0));
|
||||||
_animationValue[0] = value;
|
value->setMax(configNode->getDoubleValue("x-max", SGLimitsd::max()));
|
||||||
value = new SGScaleOffsetValue(inputProperty);
|
_animationValue[0] = value;
|
||||||
value->setScale(configNode->getDoubleValue("y-factor", factor));
|
value = new SGScaleOffsetValue(inputProperty);
|
||||||
value->setOffset(configNode->getDoubleValue("y-offset", offset));
|
value->setScale(configNode->getDoubleValue("y-factor", factor));
|
||||||
value->setMin(configNode->getDoubleValue("y-min", 0));
|
value->setOffset(configNode->getDoubleValue("y-offset", offset));
|
||||||
value->setMax(configNode->getDoubleValue("y-max", SGLimitsd::max()));
|
value->setMin(configNode->getDoubleValue("y-min", 0));
|
||||||
_animationValue[1] = value;
|
value->setMax(configNode->getDoubleValue("y-max", SGLimitsd::max()));
|
||||||
value = new SGScaleOffsetValue(inputProperty);
|
_animationValue[1] = value;
|
||||||
value->setScale(configNode->getDoubleValue("z-factor", factor));
|
value = new SGScaleOffsetValue(inputProperty);
|
||||||
value->setOffset(configNode->getDoubleValue("z-offset", offset));
|
value->setScale(configNode->getDoubleValue("z-factor", factor));
|
||||||
value->setMin(configNode->getDoubleValue("z-min", 0));
|
value->setOffset(configNode->getDoubleValue("z-offset", offset));
|
||||||
value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
|
value->setMin(configNode->getDoubleValue("z-min", 0));
|
||||||
_animationValue[2] = value;
|
value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
|
||||||
}
|
_animationValue[2] = value;
|
||||||
}
|
}
|
||||||
_initialValue[0] = configNode->getDoubleValue("x-starting-scale", 1);
|
_initialValue[0] = configNode->getDoubleValue("x-starting-scale", 1);
|
||||||
_initialValue[0] *= configNode->getDoubleValue("x-factor", factor);
|
_initialValue[0] *= configNode->getDoubleValue("x-factor", factor);
|
||||||
|
Loading…
Reference in New Issue
Block a user