AbstractNodeAnimator class new in Git master
#include <Magnum/Ui/AbstractAnimator.h>
Base for node animators.
Base classes
- class AbstractAnimator new in Git master
- Base for animators.
Derived classes
- class NodeAnimator new in Git master
- Node animator.
Constructors, destructors, conversion operators
- AbstractNodeAnimator(AnimatorHandle handle) explicit
- Constructor.
- AbstractNodeAnimator(const AbstractNodeAnimator&) deleted
- Copying is not allowed.
- AbstractNodeAnimator(AbstractNodeAnimator&&) noexcept
- Move constructor.
Public functions
- auto operator=(const AbstractNodeAnimator&) -> AbstractNodeAnimator& deleted
- Copying is not allowed.
- auto operator=(AbstractNodeAnimator&&) -> AbstractNodeAnimator& noexcept
- Move assignment.
-
auto advance(Nanoseconds time,
Containers::
MutableBitArrayView activeStorage, Containers:: MutableBitArrayView startedStorage, Containers:: MutableBitArrayView stoppedStorage, const Containers:: StridedArrayView1D<Float>& factorStorage, Containers:: MutableBitArrayView removeStorage, const Containers:: StridedArrayView1D<Vector2>& nodeOffsets, const Containers:: StridedArrayView1D<Vector2>& nodeSizes, const Containers:: StridedArrayView1D<Float>& nodeOpacities, const Containers:: StridedArrayView1D<NodeFlags>& nodeFlags, Containers:: MutableBitArrayView nodesRemove) -> NodeAnimatorUpdates - Advance the animations.
Protected functions
- auto doFeatures() const -> AnimatorFeatures override
- Implementation for features()
Private functions
-
auto doAdvance(Containers::
BitArrayView active, Containers:: BitArrayView started, Containers:: BitArrayView stopped, const Containers:: StridedArrayView1D<const Float>& factors, const Containers:: StridedArrayView1D<Vector2>& nodeOffsets, const Containers:: StridedArrayView1D<Vector2>& nodeSizes, const Containers:: StridedArrayView1D<Float>& nodeOpacities, const Containers:: StridedArrayView1D<NodeFlags>& nodeFlags, Containers:: MutableBitArrayView nodesRemove) -> NodeAnimatorUpdates pure virtual - Advance the animations.
Function documentation
Magnum:: Ui:: AbstractNodeAnimator:: AbstractNodeAnimator(AnimatorHandle handle) explicit
Constructor.
| Parameters | |
|---|---|
| handle | Handle returned by AbstractUserInterface:: |
Magnum:: Ui:: AbstractNodeAnimator:: AbstractNodeAnimator(AbstractNodeAnimator&&) noexcept
Move constructor.
Performs a destructive move, i.e. the original object isn't usable afterwards anymore.
NodeAnimatorUpdates Magnum:: Ui:: AbstractNodeAnimator:: advance(Nanoseconds time,
Containers:: MutableBitArrayView activeStorage,
Containers:: MutableBitArrayView startedStorage,
Containers:: MutableBitArrayView stoppedStorage,
const Containers:: StridedArrayView1D<Float>& factorStorage,
Containers:: MutableBitArrayView removeStorage,
const Containers:: StridedArrayView1D<Vector2>& nodeOffsets,
const Containers:: StridedArrayView1D<Vector2>& nodeSizes,
const Containers:: StridedArrayView1D<Float>& nodeOpacities,
const Containers:: StridedArrayView1D<NodeFlags>& nodeFlags,
Containers:: MutableBitArrayView nodesRemove)
Advance the animations.
Used internally from AbstractUserInterface::
Expects that size of activeStorage, startedStorage, stoppedStorage, factorStorage and removeStorage matches capacity(), their contents get filled by update() internally. Expects that nodeOffsets, nodeSizes, nodeOpacities, nodeFlags and nodesRemove have the same size, the views should be large enough to contain any valid node ID. Delegates to doAdvance(), see its documentation for more information.
AnimatorFeatures Magnum:: Ui:: AbstractNodeAnimator:: doFeatures() const override protected
Implementation for features()
Exposes AnimatorFeature::
NodeAnimatorUpdates Magnum:: Ui:: AbstractNodeAnimator:: doAdvance(Containers:: BitArrayView active,
Containers:: BitArrayView started,
Containers:: BitArrayView stopped,
const Containers:: StridedArrayView1D<const Float>& factors,
const Containers:: StridedArrayView1D<Vector2>& nodeOffsets,
const Containers:: StridedArrayView1D<Vector2>& nodeSizes,
const Containers:: StridedArrayView1D<Float>& nodeOpacities,
const Containers:: StridedArrayView1D<NodeFlags>& nodeFlags,
Containers:: MutableBitArrayView nodesRemove) pure virtual private
Advance the animations.
| Parameters | |
|---|---|
| active in | Animation IDs that are active |
| started in | Animation IDs that started playing since last time |
| stopped in | Animation IDs that stopped playing since last time |
| factors in | Interpolation factors indexed by animation ID |
| nodeOffsets in/out | Node offsets to animate indexed by node ID |
| nodeSizes in/out | Node sizes to animate indexed by node ID |
| nodeOpacities in/out | Node opacities to animate indexed by node ID |
| nodeFlags in/out | Node flags to animate indexed by node ID |
| nodesRemove out | Which nodes to remove as a consequence of the animation |
| Returns | Node properties that were updated by the animation |
Implementation for advance(), which is called from AbstractUserInterface::
The active, started, stopped and factors views are guaranteed to have the same size as capacity(). The factors array is guaranteed to contain values in the range for animations that have a corresponding bit set in active, calculated equivalently to factor(AnimationHandle) const, and may contain random or uninitialized values for others. This function is always called with at least one active bit set.
Node handles corresponding to animation IDs are available in nodes(), node IDs can be then extracted from the handles using nodeHandleId(). The node IDs then index into the nodeOffsets, nodeSizes, nodeOpacities, nodeFlags and nodesRemove views. The nodeOffsets, nodeSizes, nodeOpacities, nodeFlags and nodesRemove views have the same size and are guaranteed to contain any valid node ID.
The nodeOffsets, nodeSizes, nodeOpacities and nodeFlags are views directly onto the actual node properties exposed by AbstractUserInterface::nodesRemove is all zeros initially before getting passed to the first node animator, subsequent animators get it in the state it was left in by the previous. The implementation is expected to only modify values that correspond to node IDs for active animations, returning a set of NodeAnimation values depending on what got changed. The return value is subsequently used to set corresponding UserInterfaceState flags to trigger internal state update and failing to correctly advertise what was modified may lead to strange behavior. On the other hand, conservatively returning more NodeAnimation values than was actually modified may lead to the internal state update doing a lot of otherwise unnecessary work every frame, negatively affecting performance.