summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/clipblendnode.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-03-04 13:47:06 +0000
committerSean Harmer <sean.harmer@kdab.com>2017-03-17 08:37:29 +0000
commitd8c5bd3b28c82733212926bc8a2d67fb23cfe820 (patch)
tree897c624839fb3774bd9c37941737c1d87cf58324 /src/animation/backend/clipblendnode.cpp
parentcb0c04ccba8b70f0954cbbd69e322db06330c8a7 (diff)
Add ClipResults to ClipBlendNode indexed by animator id
A blend tree (or subset of) can be shared between multiple animators. This implies that when evaluating blend trees we need to be able to store and retrieve the results of node evaluations on a per animator basis (as each animator may well have a different start time and therefore map to different local times for the same blend tree). Presently this is done by storing the blend tree node evaluation results within the jobs themselves. Instead, let's delegate this to the blend tree nodes. This is the first step in making the blend tree more general to support more complicated blend operations such as generalised lerps, barycentric lerps, multidimensional lerps etc. Future commits will build up support for this in parallel with the current implementation and then remove the existing implementation when complete. Change-Id: Ife097ec11571c71e9e3d420b3ca67efa2e1639cc Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/animation/backend/clipblendnode.cpp')
-rw-r--r--src/animation/backend/clipblendnode.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/animation/backend/clipblendnode.cpp b/src/animation/backend/clipblendnode.cpp
index 10220d9c9..02e8cef50 100644
--- a/src/animation/backend/clipblendnode.cpp
+++ b/src/animation/backend/clipblendnode.cpp
@@ -160,6 +160,27 @@ ClipBlendNode::BlendType Animation::ClipBlendNode::blendType() const
return m_blendType;
}
+void ClipBlendNode::setClipResults(Qt3DCore::QNodeId animatorId, const ClipResults &clipResults)
+{
+ // Do we already have an entry for this animator?
+ const int animatorIndex = m_animatorIds.indexOf(animatorId);
+ if (animatorIndex == -1) {
+ // Nope, add it
+ m_animatorIds.push_back(animatorId);
+ m_clipResults.push_back(clipResults);
+ } else {
+ m_clipResults[animatorIndex] = clipResults;
+ }
+}
+
+ClipResults ClipBlendNode::clipResults(Qt3DCore::QNodeId animatorId) const
+{
+ const int animatorIndex = m_animatorIds.indexOf(animatorId);
+ if (animatorIndex != -1)
+ return m_clipResults[animatorIndex];
+ return ClipResults();
+}
+
} // Animation
} // Qt3DAnimation