From 71f247ecb76ab6098f0010b373ceb23a3d0b6c55 Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 15 Mar 2017 12:46:20 +1100 Subject: [PATCH] Fix 2809. --- src/animations/ipo.cpp | 12 ++++++------ src/animations/ipo.hpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/animations/ipo.cpp b/src/animations/ipo.cpp index faa765ef0..453cd1f36 100644 --- a/src/animations/ipo.cpp +++ b/src/animations/ipo.cpp @@ -534,18 +534,18 @@ void Ipo::update(float time, Vec3 *xyz, Vec3 *hpr,Vec3 *scale) * the time. * \param t Time for which m_next_n needs to be updated. */ -void Ipo::updateNextN(float time) const +void Ipo::updateNextN(float *time) const { - time = m_ipo_data->adjustTime(time); + *time = m_ipo_data->adjustTime(*time); // Time was reset since the last cached value for n, // reset n to start from the beginning again. - if (time < m_ipo_data->m_points[m_next_n - 1].getW()) + if (*time < m_ipo_data->m_points[m_next_n - 1].getW()) m_next_n = 1; // Search for the first point in the (sorted) array which is greater or equal // to the current time. while (m_next_n < m_ipo_data->m_points.size() - 1 && - time >= m_ipo_data->m_points[m_next_n].getW()) + *time >= m_ipo_data->m_points[m_next_n].getW()) { m_next_n++; } // while @@ -564,7 +564,7 @@ float Ipo::get(float time, unsigned int index) const if(m_next_n==0) return m_ipo_data->m_points[0][index]; - updateNextN(time); + updateNextN(&time); float rval = m_ipo_data->get(time, index, m_next_n-1); assert(!std::isnan(rval)); @@ -587,7 +587,7 @@ void Ipo::getDerivative(float time, Vec3 *xyz) return; } - updateNextN(time); + updateNextN(&time); switch (m_ipo_data->m_channel) { case Ipo::IPO_LOCX: xyz->setX(m_ipo_data->getDerivative(time, m_next_n, 0)); break; diff --git a/src/animations/ipo.hpp b/src/animations/ipo.hpp index f1b83a3e9..d23941476 100644 --- a/src/animations/ipo.hpp +++ b/src/animations/ipo.hpp @@ -116,7 +116,7 @@ private: * it is declared mutable). */ mutable unsigned int m_next_n; - void updateNextN(float time) const; + void updateNextN(float *time) const; Ipo(const Ipo *ipo); public: