summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2020-09-25 10:41:24 +0100
committerMike Krus <mike.krus@kdab.com>2020-09-25 11:57:54 +0100
commitbbecb4a4ffe06e7f96c108995bc5e75614eaa963 (patch)
tree677712233d56bdc9ec29a2be3380fcd8a0b78c81 /src/animation
parent96e9d67e40f1410f41cd9bae401948f10e448893 (diff)
Fix animation not running
Previous fix for compile issue forgot to account for the fact that the data changes after being registered with the class. Change-Id: Ice5238221f190f758ec3f25d883c56877c185e1c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/fcurve.cpp2
-rw-r--r--src/animation/backend/functionrangefinder.cpp34
-rw-r--r--src/animation/backend/functionrangefinder_p.h6
3 files changed, 21 insertions, 21 deletions
diff --git a/src/animation/backend/fcurve.cpp b/src/animation/backend/fcurve.cpp
index 18f1f427e..37c50bf15 100644
--- a/src/animation/backend/fcurve.cpp
+++ b/src/animation/backend/fcurve.cpp
@@ -47,7 +47,7 @@ namespace Qt3DAnimation {
namespace Animation {
FCurve::FCurve()
- : m_rangeFinder(m_localTimes)
+ : m_rangeFinder(&m_localTimes)
{
}
diff --git a/src/animation/backend/functionrangefinder.cpp b/src/animation/backend/functionrangefinder.cpp
index ed0ce1bea..84800b865 100644
--- a/src/animation/backend/functionrangefinder.cpp
+++ b/src/animation/backend/functionrangefinder.cpp
@@ -69,7 +69,7 @@ namespace Animation {
If the previous results are uncorrelated, a simple bisection is used.
*/
-FunctionRangeFinder::FunctionRangeFinder(const QList<float> &x)
+FunctionRangeFinder::FunctionRangeFinder(QList<float> *x)
: m_x(x)
, m_previousLowerBound(0)
, m_correlated(0)
@@ -78,8 +78,8 @@ FunctionRangeFinder::FunctionRangeFinder(const QList<float> &x)
, m_ascending(true)
{
updateAutomaticCorrelationThreshold();
- if (!m_x.isEmpty())
- m_ascending = (m_x.last() >= m_x.first());
+ if (!m_x->isEmpty())
+ m_ascending = (m_x->last() >= m_x->first());
}
/*!
@@ -88,14 +88,14 @@ FunctionRangeFinder::FunctionRangeFinder(const QList<float> &x)
*/
int FunctionRangeFinder::locate(float x) const
{
- if (m_x.size() < 2 || m_rangeSize < 2 || m_rangeSize > m_x.size())
+ if (m_x->size() < 2 || m_rangeSize < 2 || m_rangeSize > m_x->size())
return -1;
int jLower = 0;
- int jUpper = m_x.size() - 1;
+ int jUpper = m_x->size() - 1;
while (jUpper - jLower > 1) {
int jMid = (jUpper + jLower) >> 1;
- if ((x >= m_x[jMid]) == m_ascending)
+ if ((x >= m_x->at(jMid)) == m_ascending)
jLower = jMid;
else
jUpper = jMid;
@@ -104,7 +104,7 @@ int FunctionRangeFinder::locate(float x) const
m_correlated = std::abs(jLower - m_previousLowerBound) <= m_correlationThreshold;
m_previousLowerBound = jLower;
- return qMax(0, qMin(m_x.size() - m_rangeSize, jLower - ((m_rangeSize - 2) >> 1)));
+ return qMax(0, qMin(m_x->size() - m_rangeSize, jLower - ((m_rangeSize - 2) >> 1)));
}
/*!
@@ -113,24 +113,24 @@ int FunctionRangeFinder::locate(float x) const
*/
int FunctionRangeFinder::hunt(float x) const
{
- if (m_x.size() < 2 || m_rangeSize < 2 || m_rangeSize > m_x.size())
+ if (m_x->size() < 2 || m_rangeSize < 2 || m_rangeSize > m_x->size())
return -1;
int jLower = m_previousLowerBound;
int jMid;
int jUpper;
- if (jLower < 0 || jLower > (m_x.size() - 1)) {
+ if (jLower < 0 || jLower > (m_x->size() - 1)) {
jLower = 0;
- jUpper = m_x.size() - 1;
+ jUpper = m_x->size() - 1;
} else {
int increment = 1;
- if ((x >= m_x[jLower]) == m_ascending) {
+ if ((x >= m_x->at(jLower)) == m_ascending) {
for (;;) {
jUpper = jLower + increment;
- if (jUpper >= m_x.size() - 1) {
- jUpper = m_x.size() - 1;
+ if (jUpper >= m_x->size() - 1) {
+ jUpper = m_x->size() - 1;
break;
- } else if ((x < m_x[jUpper]) == m_ascending) {
+ } else if ((x < m_x->at(jUpper)) == m_ascending) {
break;
} else {
jLower = jUpper;
@@ -144,7 +144,7 @@ int FunctionRangeFinder::hunt(float x) const
if (jLower <= 0) {
jLower = 0;
break;
- } else if ((x >= m_x[jLower]) == m_ascending) {
+ } else if ((x >= m_x->at(jLower)) == m_ascending) {
break;
} else {
jUpper = jLower;
@@ -156,7 +156,7 @@ int FunctionRangeFinder::hunt(float x) const
while (jUpper - jLower > 1) {
jMid = (jUpper + jLower) >> 1;
- if ((x >= m_x[jMid]) == m_ascending)
+ if ((x >= m_x->at(jMid)) == m_ascending)
jLower = jMid;
else
jUpper = jMid;
@@ -165,7 +165,7 @@ int FunctionRangeFinder::hunt(float x) const
m_correlated = std::abs(jLower - m_previousLowerBound) <= m_correlationThreshold;
m_previousLowerBound = jLower;
- return qMax(0, qMin(m_x.size() - m_rangeSize, jLower - ((m_rangeSize - 2) >> 1)));
+ return qMax(0, qMin(m_x->size() - m_rangeSize, jLower - ((m_rangeSize - 2) >> 1)));
}
} // namespace Animation
diff --git a/src/animation/backend/functionrangefinder_p.h b/src/animation/backend/functionrangefinder_p.h
index 004bea4b8..fc379a311 100644
--- a/src/animation/backend/functionrangefinder_p.h
+++ b/src/animation/backend/functionrangefinder_p.h
@@ -61,7 +61,7 @@ namespace Animation {
class Q_AUTOTEST_EXPORT FunctionRangeFinder
{
public:
- FunctionRangeFinder(const QList<float> &x);
+ FunctionRangeFinder(QList<float> *x);
inline int findLowerBound(float x) const { return m_correlated ? hunt(x) : locate(x); }
@@ -74,14 +74,14 @@ public:
int correlationThreshold() const { return m_correlationThreshold; }
void updateAutomaticCorrelationThreshold()
{
- m_correlationThreshold = std::max(1, int(std::pow(float(m_x.size()), 0.25)));
+ m_correlationThreshold = std::max(1, int(std::pow(float(m_x->size()), 0.25)));
}
private:
int locate(float x) const;
int hunt(float x) const;
- QList<float> m_x;
+ QList<float> *m_x;
mutable int m_previousLowerBound;
mutable bool m_correlated;
int m_rangeSize;