summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/handler.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-08-21 14:36:23 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-08-30 12:59:13 +0000
commita60a3d30c84f3521521da01965085d41c51c1617 (patch)
treeedaf385cf8df09af530680859033c632528e582d /src/animation/backend/handler.cpp
parentdc4a29aa578c1c00fc750d1f6882e45f09134b47 (diff)
Add Skeleton backend node to the animation aspect
The animation aspect can already animate any property of a QNode subclass. However, the render aspect allows to render a skinned mesh utilising a QSkeletonLoader that does not create the corresponding frontend QJoint objects (subclasses of QNode). Some skeletons can be large (10's or 100's of joints) so this is a good memory conserving optimization. The consequence of not creating the frontend joints however, is that without the QNodes to address, we cannot animate their local poses. To combat this without giving up on the above optimization we add a backend node for QAbstractSkeleton to the animation aspect. This node contains a vector of local poses for the joints in the same order as the render aspect creates and flattens the joint hierarchy in (see the vector of JointInfo in the SkeletonData in the render aspect). The animation aspect can then use this special knowledge to efficiently animate the joints of a skeleton and each frame, inform the render aspect backend of the new set of local pose transformations, prior to the render aspect calculating the skinning matrix palette and supplying that to the armature component for rendering. This will require the animation aspect to be able to map channels in an animation onto the joint indices of the skeleton backend nodes. By default, they will be applied to matching indices in the vector of local poses. However, an optional name property will be allowed in the animation clip channels to permit re-mapping of animation clips to similar skeletons (i.e. allow animations to be reused between different skeletons where they share some joint names). This will be done in follow up commits. Change-Id: I81ad258f59bb0ddd6a49456840c860783f6fb340 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation/backend/handler.cpp')
-rw-r--r--src/animation/backend/handler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/animation/backend/handler.cpp b/src/animation/backend/handler.cpp
index ce7aa3c17..b8e89703e 100644
--- a/src/animation/backend/handler.cpp
+++ b/src/animation/backend/handler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -58,6 +58,7 @@ Handler::Handler()
, m_channelMappingManager(new ChannelMappingManager)
, m_channelMapperManager(new ChannelMapperManager)
, m_clipBlendNodeManager(new ClipBlendNodeManager)
+ , m_skeletonManager(new SkeletonManager)
, m_loadAnimationClipJob(new LoadAnimationClipJob)
, m_findRunningClipAnimatorsJob(new FindRunningClipAnimatorsJob)
, m_buildBlendTreesJob(new BuildBlendTreesJob)