From: durk Date: Sat, 21 Feb 2009 09:11:41 +0000 (+0000) Subject: Torsten Dreyer: the rotate animation has two ways to define a axis X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=812170ebce9c8e72de1191834d63d93a3698f204;p=simgear.git Torsten Dreyer: the rotate animation has two ways to define a axis 1. by using center/x-m and axis/[xyz] 2. by using axis/[xyz]1-m and axis/[xyz]2-m The translate animation only supports method 1. and here comes a patch that enables method 2 for this animations, too. --- diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 96057e80..cb5b0eee 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -655,9 +655,20 @@ SGTranslateAnimation::SGTranslateAnimation(const SGPropertyNode* configNode, else _initialValue = 0; - _axis[0] = configNode->getDoubleValue("axis/x", 0); - _axis[1] = configNode->getDoubleValue("axis/y", 0); - _axis[2] = configNode->getDoubleValue("axis/z", 0); + if (configNode->hasValue("axis/x1-m")) { + SGVec3d v1, v2; + v1[0] = configNode->getDoubleValue("axis/x1-m", 0); + v1[1] = configNode->getDoubleValue("axis/y1-m", 0); + v1[2] = configNode->getDoubleValue("axis/z1-m", 0); + v2[0] = configNode->getDoubleValue("axis/x2-m", 0); + v2[1] = configNode->getDoubleValue("axis/y2-m", 0); + v2[2] = configNode->getDoubleValue("axis/z2-m", 0); + _axis = v2 - v1; + } else { + _axis[0] = configNode->getDoubleValue("axis/x", 0); + _axis[1] = configNode->getDoubleValue("axis/y", 0); + _axis[2] = configNode->getDoubleValue("axis/z", 0); + } if (8*SGLimitsd::min() < norm(_axis)) _axis = normalize(_axis); }