From 22f2fac56b486f7ab9125d3a71d26fa441c4d325 Mon Sep 17 00:00:00 2001 From: frohlich Date: Mon, 7 Jan 2008 22:05:48 +0000 Subject: [PATCH] Modified Files: simgear/scene/model/animation.cxx: Change factor/offset order for texture animations. Fixes remaining bug with texture animations. --- simgear/scene/model/animation.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index b47da182..88fd835a 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -173,6 +173,19 @@ read_factor_offset(const SGPropertyNode* configNode, SGExpressiond* expr, return expr; } +static SGExpressiond* +read_offset_factor(const SGPropertyNode* configNode, SGExpressiond* expr, + const std::string& factor, const std::string& offset) +{ + double offsetValue = configNode->getDoubleValue(offset, 0); + if (offsetValue != 0) + expr = new SGBiasExpression(expr, offsetValue); + double factorValue = configNode->getDoubleValue(factor, 1); + if (factorValue != 1) + expr = new SGScaleExpression(expr, factorValue); + return expr; +} + static SGExpressiond* read_value(const SGPropertyNode* configNode, SGPropertyNode* modelRoot, const char* unit, double defMin, double defMax) @@ -1866,7 +1879,7 @@ SGTexTransformAnimation::appendTexTranslate(const SGPropertyNode* config, value = new SGStepExpression(value, config->getDoubleValue("step", 0), config->getDoubleValue("scroll", 0)); - value = read_factor_offset(config, value, "factor", "offset"); + value = read_offset_factor(config, value, "factor", "offset"); if (config->hasChild("min") || config->hasChild("max")) { double minClip = config->getDoubleValue("min", -SGLimitsd::max()); @@ -1914,7 +1927,7 @@ SGTexTransformAnimation::appendTexRotate(const SGPropertyNode* config, value = new SGStepExpression(value, config->getDoubleValue("step", 0), config->getDoubleValue("scroll", 0)); - value = read_factor_offset(config, value, "factor", "offset-deg"); + value = read_offset_factor(config, value, "factor", "offset-deg"); if (config->hasChild("min-deg") || config->hasChild("max-deg")) { double minClip = config->getDoubleValue("min-deg", -SGLimitsd::max()); -- 2.39.5