Browse Source

Animation: add TrackViewStorage::interpolator().

It was the last remaining field that wasn't queryable from this
type-erased base.
pull/617/head
Vladimír Vondruš 3 years ago
parent
commit
6a129b2cd2
  1. 3
      doc/changelog.dox
  2. 1
      src/Magnum/Animation/Test/TrackViewTest.cpp
  3. 12
      src/Magnum/Animation/Track.h

3
doc/changelog.dox

@ -438,6 +438,9 @@ See also:
@ref Animation::BasicEasing "easing functions" implemented with
double precision, in addition to single-precision @ref Animation::Easing,
and similar in spirit to the @ref Constants and @ref Constantsd typedefs.
- Added @ref Animation::TrackViewStorage::interpolator() for getting a
type-erased interpolator pointer without having to cast to a concrete
@ref Animation::TrackView type
@subsubsection changelog-latest-changes-debugtools DebugTools library

1
src/Magnum/Animation/Test/TrackViewTest.cpp

@ -569,6 +569,7 @@ void TrackViewTest::constructCopyStorage() {
Extrapolation::Extrapolated, Extrapolation::DefaultConstructed};
const TrackViewStorage<Float> b = a;
CORRADE_COMPARE(b.interpolator(), reinterpret_cast<void(*)()>(customLerp));
CORRADE_COMPARE(b.keys().size(), 2);
CORRADE_COMPARE(b.values().size(), 2);
CORRADE_COMPARE(Containers::arrayCast<Float>(b.keys())[1], 5.0f);

12
src/Magnum/Animation/Track.h

@ -482,6 +482,18 @@ template<class K> class TrackViewStorage {
return _keys.size();
}
/**
* @brief Type-erased interpolation function
* @m_since_latest
*
* Has to be cast to a type corresponding to the value type before use.
* Use @ref TrackView and @ref TrackView::interpolator() to get the
* interpolator function in a concrete type.
*/
void(*interpolator() const)() {
return _interpolator;
}
/**
* @brief Key data
*

Loading…
Cancel
Save