summaryrefslogtreecommitdiffstats
path: root/tests/auto/animation/animationutils
Commit message (Collapse)AuthorAgeFilesLines
* Rename AnimationClipLoader to AnimationClipSean Harmer2017-04-121-26/+26
| | | | | | | | It handles both loadign from file and from data constructed using the public API. Change-Id: Ic9e71dc60c36869548323312f7129df6c9edd763 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add a flag to AnimationClipLoader to track where its data comes fromSean Harmer2017-04-121-0/+5
| | | | | | | Nicer than implicitly tracking it via m_source.isEmpty(). Change-Id: I120cb3728504b2bbc77d5959711a3f94731399ce Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add allDependencyIds() pure virtual and overrides to backend nodesSean Harmer2017-03-261-0/+5
| | | | | | | | This will be used to visit all nodes by the visitor for the purpose of collecting vlaue nodes that should be evaluated. Change-Id: Iff84eed2ee139a0ecd3639994549e5859b5827d0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename dependencyIds() to currentDependencyIds()Sean Harmer2017-03-261-1/+1
| | | | | | | | | | We need to add another function that returns all potential dependencies rather than just those that are dependencies given the current state (blend value). Make room for that by renaming this to a more descriptive name. Change-Id: I06cdc2e471007e3bd40cd7b687a4a2c21e4b2828 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove blend() virtual function from backend blend tree nodesSean Harmer2017-03-261-3/+0
| | | | | | | | No longer needed as replaced by the more general doBlend() protected virtual. Change-Id: I5f11c068f8a379baa53a033e5ce8ce63ff64d5ba Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add overload of buildPropertyMappingsSean Harmer2017-03-251-0/+196
| | | | | | | | | | Eventually we should remove the original form which is currently called by the non-blended animation code path. It will be better to merge the blended and non-blended code paths so we have less code to maintain. Also the blended code path seems more efficient. Change-Id: Ib6aa4006e4b830a32b985527bae900ce6f3facec Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add function to generate component indices for blend tree formatSean Harmer2017-03-253-0/+577
| | | | | | | | | | This generates the format indices required by the formatClipResults() function which performs the gather to reorder the raw results from an animation clip to the format used by the blend tree/animator. Change-Id: I5cd8fbe366792ae9d8317f098699c413450b9b87 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add function assignChannelComponentIndicesSean Harmer2017-03-251-0/+66
| | | | | | | | | | | | | | This iterates through the channel description and assigns channel component indices in ascending order. The next step will be to use this in conjunction with the channel description with the layout of channels in each clip to generate the format indices that will allow us to quickly map from the clip's raw ClipResults to ClipResults formatted in the layotu used by the blend tree/animator. Change-Id: I04dd5a21ca8355529118cfb2b05f4904e43ef0e2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add a function to build list of unique channel names and typesSean Harmer2017-03-251-0/+126
| | | | | | | This will be needed to construct the data layout for blend trees. Change-Id: I0b11076f5ecd55cfad094d864f3f8270841fc62a Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add function to format clip results using a gather operationSean Harmer2017-03-251-0/+68
| | | | | | | | | If an index in the format is -1 put a default value of 0 into the formatted results. This will allow clips to not have to provide every channel used anywhere by the blend tree. Change-Id: I9e18d0840e75a959ef680cbd54259a74c9331fa8 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add function to evaluate a blend treeSean Harmer2017-03-251-0/+335
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out with this design, evaluating the blend tree is actually really simple. Visit the tree nodes and call blend on the interior nodes. The leaf nodes will already have their values from an earlier stage. This also makes apparent yet another opportunity for parallelism during the blend tree evaluation. The blend tree may contain independent subtrees that can safely be evaluated in parallel. Once we have the ability for jobs to spawn jobs there are at least 3 ways we can have parallelism in the blend tree evaluation: 1) Each blended clip animator can be processed in its own job. 2) Sub trees of the blend tree can be evaluated in parallel, relying upon dependencies between jobs to do this properly. 3) Within each node's doBlend() there is potential to use a parallel implementation of the map operation like parallel_for in TBB. There are also other opportunities in earlier stages of processing such as when evaluating the actual clips, we then need a gather operation to map the clip results into the layout used by the blend tree. This evaluations could be done in parallel as well as a parallel gather (which is just a map with a random access read operation). This all bodes well for being able to process large numbers of animations each containing large numbers of channels which will be needed when we add support for skeletons. Change-Id: Id81e3a5e563a7ef9b7ac39b90c518c656cf8a3cf Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add missing parentheses in conditionalSean Harmer2017-03-251-2/+2
| | | | | Change-Id: I58dc19a06283a5999dbcd76f74d095daf0a9017d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Add function to find set of leaf blend node ids that need evaluatingSean Harmer2017-03-191-0/+69
| | | | | | | | | | | | | | | | | | | We should only evaluate the clips that are actually dependencies of the blend tree being evaluated given its current state. At present this will simply be the set of all leaf nodes in the blend tree but in the future when we support generalised lerp nodes etc, this will yield the subset needed for the current state. This involved adding support for pre-order traversal of the blend tree. As a result, extended the visitor to work with both pre and post orders and for all nodes or only the dependencies. Note that we return the ids of the blend tree nodes, not the ids of the clips themsevles. This is so we can then index the results by blend node id in a later commit. Change-Id: Ia13fe90ec3090306c1e8ade316ce0540f36a67fd Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add function to evaluate clip at a given phaseSean Harmer2017-03-191-0/+107
| | | | | | | This is another piece of the puzzle for evaluating blend trees. Change-Id: If0604125b11bacf0c205a69a59d39f601dd2ebd1 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add function to calculate phase of animation from global timeSean Harmer2017-03-191-0/+165
| | | | | | | | | | | | | | | | | When we come to evaluate animation blend trees, the resulting duration of the blend tree will also be blended. This means that we can't just map from global time to local time of each leaf node clip. Instead we need to evaluate the clips at a consistent phase. This way we can safely blend a 3 second walk animation cycle with a 2 second run animation cycle safely. So long as the animator lines up the foot falls at consistent phases. We will therefore need to be able to calculate the phase from the current global time and the blend tree's duration before we can eventually evaluate the clips at the phase. Change-Id: I7bce231cdc2eee8cb873f2c98c6c8c2e05533c8c Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Typedef QVector<float> as ClipResultsSean Harmer2017-03-171-4/+4
| | | | | | | | Will make it easier to read once we introduce a vector of ClipResults which will be needed shortly. Change-Id: I97c2ae3fcd431b075db96f255fdffcc117529a63 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Extend animation utils test to cover evaluationDataForAnimator()Sean Harmer2017-03-061-0/+99
| | | | | Change-Id: I537185cb10499562b7d578cd83ff28e2faba78b4 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Extend animation utils test to cover evaluationDataForClip()Sean Harmer2017-03-061-0/+131
| | | | | Change-Id: I1bdf856404ee20ddd9500e66ae48ed622801bd2e Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Extend animation utils test to cover channelComponentsToIndicesSean Harmer2017-03-061-0/+84
| | | | | Change-Id: Iacccdfc052b6739fcc0b8825d7f55b7ce70e6a40 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Extend animation utils test to cover channelComponentsToIndicesHelperSean Harmer2017-03-061-0/+204
| | | | | Change-Id: I4284d43da48a25dac6ff4c3c7b5f1b30e1b8e74f Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Extend animation utils test to cover evlaluateClipAtLocalTime()Sean Harmer2017-03-063-0/+370
| | | | | Change-Id: I5fb07fa2f8efe8e89fa33e0af7378d38d2488d00 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Extend test to cover preparePropertyChanges helperSean Harmer2017-03-061-0/+248
| | | | | Change-Id: Ic89792a47ea6ec85924d9d7ba352d98bf86f0469 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add test for localTimeFromGLobalTime helperSean Harmer2017-03-061-0/+165
| | | | | Change-Id: Icdf6ae7062ba4afc27fc7cd0573029a5c5b32bf5 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Remove AnimationUtils classSean Harmer2017-03-061-6/+6
| | | | | | | | | It was stateless, so make the static member functions free functions and export them for auto tests. We're already in the Qt3DAnimation::Animation namespace so this removes some visual clutter. Change-Id: I4e1a72c47d5bd4afb807ce5f6dc80dc0ce4bb213 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Refactor tst_animationutils to be data drivenSean Harmer2017-03-021-20/+63
| | | | | | | | Will allow to easily add more tests for other animation clips and mapping configurations. Change-Id: Ib125106f838d2e36c3ffefe5f5dcdfa869363f19 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Factor out some helper functions in AnimationUtils testSean Harmer2017-03-021-16/+43
| | | | | | | | Will make it easier to write additional tests that create these backend nodes. Change-Id: Ie2ce4427b495847451974b079e513e134d069d11 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Update naming of animation building blocksSean Harmer2017-03-022-48/+113
| | | | | | | | | | | | | | | | | | | Rename: Groups -> Channels Channels -> ChannelComponents Update function and variable names accordingly. Also updated ChannelComponents to contain not only the component suffix to make them more readable in large files. Replaced animation clip in AnimationUtils unit test and adjusted suffix -> component index mapping code to use upper case. Will update clips in manual test in a follow up commit. Change-Id: If5ed565d57efbed07a4d6771336a14f6a4cddb65 Reviewed-by: Mike Krus <mike.krus@kdab.com>
* Add test for AnimationUtilsSean Harmer2017-03-024-0/+164
Will extend in further commits. Change-Id: Idbdd95bdd3cfe0ab3f5d12295d15b32c116bc26b Reviewed-by: Mike Krus <mike.krus@kdab.com>