Browse Source

Animation: add TrackViewStorage::values().

pull/445/head
Vladimír Vondruš 6 years ago
parent
commit
766b03fc38
  1. 5
      doc/changelog.dox
  2. 4
      src/Magnum/Animation/Test/TrackViewTest.cpp
  3. 15
      src/Magnum/Animation/Track.h

5
doc/changelog.dox

@ -64,6 +64,11 @@ See also:
be used by various importers to provide access to mesh data that is not
necessarily GPU-friendly.
@subsubsection changelog-latest-new-animation Animation library
- Added a @ref Animation::TrackViewStorage::values() getter for type-erased
access to track values
@subsubsection changelog-latest-new-audio Audio library
- Added a @ref Audio::Buffer::frequency() getter

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

@ -569,6 +569,10 @@ void TrackViewTest::constructCopyStorage() {
Extrapolation::Extrapolated, Extrapolation::DefaultConstructed};
const TrackViewStorage<Float> b = a;
CORRADE_COMPARE(b.keys().size(), 2);
CORRADE_COMPARE(b.values().size(), 2);
CORRADE_COMPARE(Containers::arrayCast<Float>(b.keys())[1], 5.0f);
CORRADE_COMPARE(Containers::arrayCast<Vector3>(b.values())[1], (Vector3{0.3f, 0.6f, 1.0f}));
auto& bv = *static_cast<const TrackView<Float, Vector3>*>(&b);

15
src/Magnum/Animation/Track.h

@ -485,12 +485,25 @@ template<class K> class TrackViewStorage {
/**
* @brief Key data
*
* @see @ref TrackView::values(), @ref TrackView::operator[]()
* @see @ref values(), @ref TrackView::operator[]()
*/
Containers::StridedArrayView1D<K> keys() const {
return _keys;
}
/**
* @brief Type-erased value data
* @m_since_latest
*
* Use @ref TrackView and @ref TrackView::values() to get a typed view,
* alternatively you can cast to a concrete type using
* @ref Corrade::Containers::arrayCast().
* @see @ref keys(), @ref TrackView::operator[]()
*/
Containers::StridedArrayView1D<typename std::conditional<std::is_const<K>::value, const char, char>::type> values() const {
return _values;
}
private:
template<class, class, class> friend class TrackView;

Loading…
Cancel
Save