Browse Source

Animation: adapt to Corrade changes.

pull/338/head
Vladimír Vondruš 7 years ago
parent
commit
fb930187c1
  1. 8
      doc/snippets/MagnumAnimation.cpp
  2. 8
      src/Magnum/Animation/Interpolation.h
  3. 8
      src/Magnum/Animation/Test/Benchmark.cpp
  4. 4
      src/Magnum/Animation/Test/TrackViewTest.cpp
  5. 54
      src/Magnum/Animation/Track.h
  6. 28
      src/Magnum/Trade/Test/AnimationDataTest.cpp

8
doc/snippets/MagnumAnimation.cpp

@ -342,12 +342,12 @@ const Keyframe data[]{
};
Animation::TrackView<Float, Vector2> positions{
{&data[0].time, Containers::arraySize(data), sizeof(Keyframe)},
{&data[0].position, Containers::arraySize(data), sizeof(Keyframe)},
{data, &data[0].time, Containers::arraySize(data), sizeof(Keyframe)},
{data, &data[0].position, Containers::arraySize(data), sizeof(Keyframe)},
Math::lerp};
Animation::TrackView<Float, Deg> rotations{
{&data[0].time, Containers::arraySize(data), sizeof(Keyframe)},
{&data[0].rotation, Containers::arraySize(data), sizeof(Keyframe)},
{data, &data[0].time, Containers::arraySize(data), sizeof(Keyframe)},
{data, &data[0].rotation, Containers::arraySize(data), sizeof(Keyframe)},
Math::lerp};
Float time = 2.2f;

8
src/Magnum/Animation/Interpolation.h

@ -198,7 +198,7 @@ documentation for more information.
@ref Math::slerp(), @ref Math::sclerp()
@experimental
*/
template<class K, class V, class R = ResultOf<V>> R interpolate(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Extrapolation before, Extrapolation after, R(*interpolator)(const V&, const V&, Float), K frame, std::size_t& hint);
template<class K, class V, class R = ResultOf<V>> R interpolate(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Extrapolation before, Extrapolation after, R(*interpolator)(const V&, const V&, Float), K frame, std::size_t& hint);
/**
@brief Interpolate animation value with strict constraints
@ -221,7 +221,7 @@ Used internally from @ref Track::atStrict() / @ref TrackView::atStrict(), see
@ref Math::sclerp()
@experimental
*/
template<class K, class V, class R = ResultOf<V>> R interpolateStrict(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, R(*interpolator)(const V&, const V&, Float), K frame, std::size_t& hint);
template<class K, class V, class R = ResultOf<V>> R interpolateStrict(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, R(*interpolator)(const V&, const V&, Float), K frame, std::size_t& hint);
/**
@brief Combine easing function and an interpolator
@ -368,7 +368,7 @@ template<class V, class R> auto interpolatorFor(Interpolation interpolation) ->
return Implementation::TypeTraits<V, R>::interpolator(interpolation);
}
template<class K, class V, class R> R interpolate(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, const Extrapolation before, const Extrapolation after, R(*const interpolator)(const V&, const V&, Float), K frame, std::size_t& hint) {
template<class K, class V, class R> R interpolate(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, const Extrapolation before, const Extrapolation after, R(*const interpolator)(const V&, const V&, Float), K frame, std::size_t& hint) {
CORRADE_ASSERT(keys.size() == values.size(), "Animation::interpolate(): keys and values don't have the same size", {});
/* No data, return default-constructed value */
@ -404,7 +404,7 @@ template<class K, class V, class R> R interpolate(const Containers::StridedArray
Math::lerpInverted(Float(keys[hint]), Float(keys[hint + 1]), Float(frame)));
}
template<class K, class V, class R> R interpolateStrict(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, R(*const interpolator)(const V&, const V&, Float), const K frame, std::size_t& hint) {
template<class K, class V, class R> R interpolateStrict(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, R(*const interpolator)(const V&, const V&, Float), const K frame, std::size_t& hint) {
CORRADE_ASSERT(keys.size() >= 2, "Animation::interpolateStrict(): at least two keyframes required", {});
CORRADE_ASSERT(keys.size() == values.size(), "Animation::interpolateStrict(): keys and values don't have the same size", {});

8
src/Magnum/Animation/Test/Benchmark.cpp

@ -53,8 +53,8 @@ struct Benchmark: TestSuite::Tester {
Containers::Array<Float> _keys;
Containers::Array<Int> _values;
Containers::Array<std::pair<Float, Int>> _interleaved;
Containers::StridedArrayView<const Float> _keysInterleaved;
Containers::StridedArrayView<const Int> _valuesInterleaved;
Containers::StridedArrayView1D<const Float> _keysInterleaved;
Containers::StridedArrayView1D<const Int> _valuesInterleaved;
TrackView<Float, Int> _track;
TrackView<Float, Int> _trackInterleaved;
};
@ -88,8 +88,8 @@ Benchmark::Benchmark() {
for(std::size_t i = 0; i != DataSize; ++i)
_keys[i] = _interleaved[i].first = Float(i)*3.1254f;
_keysInterleaved = {&_interleaved[0].first, _interleaved.size(), sizeof(std::pair<Float, Int>)};
_valuesInterleaved = {&_interleaved[0].second, _interleaved.size(), sizeof(std::pair<Float, Int>)};
_keysInterleaved = {_interleaved, &_interleaved[0].first, _interleaved.size(), sizeof(std::pair<Float, Int>)};
_valuesInterleaved = {_interleaved, &_interleaved[0].second, _interleaved.size(), sizeof(std::pair<Float, Int>)};
_track = TrackView<Float, Int>{
Containers::arrayView(_keys), Containers::arrayView(_values), Math::select};

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

@ -417,7 +417,7 @@ Float lerpHalf(const Half& a, const Half& b, Float t) {
void TrackViewTest::atDifferentResultType() {
const TrackView<Float, Half, Float> a{
{&Keyframes[0].first, Containers::arraySize(Keyframes), sizeof(Keyframes[0])},
{Keyframes, &Keyframes[0].first, Containers::arraySize(Keyframes), sizeof(Keyframes[0])},
HalfValues, lerpHalf};
std::size_t hint{};
@ -428,7 +428,7 @@ void TrackViewTest::atDifferentResultType() {
void TrackViewTest::atDifferentResultTypeStrict() {
const TrackView<Float, Half, Float> a{
{&Keyframes[0].first, Containers::arraySize(Keyframes), sizeof(Keyframes[0])},
{Keyframes, &Keyframes[0].first, Containers::arraySize(Keyframes), sizeof(Keyframes[0])},
HalfValues, lerpHalf};
std::size_t hint{};

54
src/Magnum/Animation/Track.h

@ -303,8 +303,8 @@ template<class K, class V, class R
*
* @see @ref data(), @ref values(), @ref operator[]()
*/
Containers::StridedArrayView<const K> keys() const {
return _data ? Containers::StridedArrayView<const K>{&_data[0].first, _data.size(), sizeof(std::pair<K, V>)} : nullptr;
Containers::StridedArrayView1D<const K> keys() const {
return _data ? Containers::StridedArrayView1D<const K>{_data, &_data[0].first, _data.size(), sizeof(std::pair<K, V>)} : nullptr;
}
/**
@ -312,8 +312,8 @@ template<class K, class V, class R
*
* @see @ref data(), @ref keys(), @ref operator[]()
*/
Containers::StridedArrayView<const V> values() const {
return _data ? Containers::StridedArrayView<const V>{&_data[0].second, _data.size(), sizeof(std::pair<K, V>)} : nullptr;
Containers::StridedArrayView1D<const V> values() const {
return _data ? Containers::StridedArrayView1D<const V>{_data, &_data[0].second, _data.size(), sizeof(std::pair<K, V>)} : nullptr;
}
/**
@ -466,17 +466,17 @@ template<class K> class TrackViewStorage {
*
* @see @ref TrackView::values(), @ref TrackView::operator[]()
*/
Containers::StridedArrayView<const K> keys() const {
Containers::StridedArrayView1D<const K> keys() const {
return _keys;
}
private:
template<class, class, class> friend class TrackView;
template<class V, class R> explicit TrackViewStorage(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, R(*interpolator)(const V&, const V&, Float), Extrapolation before, Extrapolation after) noexcept: _keys{keys}, _values{reinterpret_cast<const Containers::StridedArrayView<const char>&>(values)}, _interpolator{reinterpret_cast<void(*)()>(interpolator)}, _interpolation{interpolation}, _before{before}, _after{after} {}
template<class V, class R> explicit TrackViewStorage(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolation interpolation, R(*interpolator)(const V&, const V&, Float), Extrapolation before, Extrapolation after) noexcept: _keys{keys}, _values{reinterpret_cast<const Containers::StridedArrayView1D<const char>&>(values)}, _interpolator{reinterpret_cast<void(*)()>(interpolator)}, _interpolation{interpolation}, _before{before}, _after{after} {}
Containers::StridedArrayView<const K> _keys;
Containers::StridedArrayView<const char> _values;
Containers::StridedArrayView1D<const K> _keys;
Containers::StridedArrayView1D<const char> _values;
void(*_interpolator)(void);
Interpolation _interpolation;
Extrapolation _before, _after;
@ -527,17 +527,17 @@ template<class K, class V, class R
* The keyframe data are assumed to be stored in sorted order. It's not
* an error to have two successive keyframes with the same frame value.
* The @ref interpolation() field is set to @ref Interpolation::Custom.
* See @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Interpolator, Extrapolation, Extrapolation) or
* @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Extrapolation, Extrapolation)
* See @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolation, Interpolator, Extrapolation, Extrapolation) or
* @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolation, Extrapolation, Extrapolation)
* for an alternative.
*/
/*implicit*/ TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{keys, values, Interpolation::Custom, interpolator, before, after} {}
/*implicit*/ TrackView(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{keys, values, Interpolation::Custom, interpolator, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation)
* Equivalent to calling @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolator, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation.
*/
/*implicit*/ TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{keys, values, interpolator, extrapolation, extrapolation} {}
/*implicit*/ TrackView(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{keys, values, interpolator, extrapolation, extrapolation} {}
/**
* @brief Construct with custom interpolator from an interleaved array
@ -547,9 +547,9 @@ template<class K, class V, class R
* @param after Extrapolation behavior after
*
* Converts @p data to a pair of strided array views and calls
* @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation).
* @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolator, Extrapolation, Extrapolation).
*/
/*implicit*/ TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackView<K, V, R>{Containers::StridedArrayView<const K>{data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView<const V>{data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolator, before, after} {}
/*implicit*/ TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackView<K, V, R>{Containers::StridedArrayView1D<const K>{data, data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView1D<const V>{data, data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolator, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(Containers::ArrayView<const std::pair<K, V>>, Interpolator, Extrapolation, Extrapolation)
@ -572,13 +572,13 @@ template<class K, class V, class R
* supply their own interpolator function to @ref at() or
* @ref atStrict().
*/
/*implicit*/ TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{keys, values, interpolation, interpolator, before, after} {}
/*implicit*/ TrackView(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{keys, values, interpolation, interpolator, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Interpolator, Extrapolation, Extrapolation)
* Equivalent to calling @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolation, Interpolator, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation.
*/
/*implicit*/ TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{keys, values, interpolation, interpolator, extrapolation, extrapolation} {}
/*implicit*/ TrackView(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{keys, values, interpolation, interpolator, extrapolation, extrapolation} {}
/**
* @brief Construct with both generic and custom interpolator from an interleaved array
@ -589,9 +589,9 @@ template<class K, class V, class R
* @param after Extrapolation behavior after
*
* Converts @p data to a pair of strided array views and calls
* @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation).
* @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolator, Extrapolation, Extrapolation).
*/
/*implicit*/ TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{Containers::StridedArrayView<const K>{data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView<const V>{data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolation, interpolator, before, after} {}
/*implicit*/ TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{Containers::StridedArrayView1D<const K>{data, data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView1D<const V>{data, data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolation, interpolator, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(Containers::ArrayView<const std::pair<K, V>>, Interpolation, Interpolator, Extrapolation, Extrapolation)
@ -613,13 +613,13 @@ template<class K, class V, class R
* @p interpolation using @ref interpolatorFor(). See its documentation
* for more information.
*/
/*implicit*/ TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{keys, values, interpolation, interpolatorFor<V, R>(interpolation), before, after} {}
/*implicit*/ TrackView(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: TrackViewStorage<K>{keys, values, interpolation, interpolatorFor<V, R>(interpolation), before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolation, Extrapolation, Extrapolation)
* Equivalent to calling @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolation, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation.
*/
/*implicit*/ TrackView(const Containers::StridedArrayView<const K>& keys, const Containers::StridedArrayView<const V>& values, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{keys, values, interpolation, extrapolation, extrapolation} {}
/*implicit*/ TrackView(const Containers::StridedArrayView1D<const K>& keys, const Containers::StridedArrayView1D<const V>& values, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant) noexcept: TrackView<K, V, R>{keys, values, interpolation, extrapolation, extrapolation} {}
/**
* @brief Construct with generic interpolation behavior from an interleaved array
@ -629,9 +629,9 @@ template<class K, class V, class R
* @param after Extrapolation behavior after
*
* Converts @p data to a pair of strided array views and calls
* @ref TrackView(const Containers::StridedArrayView<const K>&, const Containers::StridedArrayView<const V>&, Interpolator, Extrapolation, Extrapolation).
* @ref TrackView(const Containers::StridedArrayView1D<const K>&, const Containers::StridedArrayView1D<const V>&, Interpolator, Extrapolation, Extrapolation).
*/
/*implicit*/ TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: TrackView<K, V, R>{Containers::StridedArrayView<const K>{data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView<const V>{data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolation, before, after} {}
/*implicit*/ TrackView(Containers::ArrayView<const std::pair<K, V>> data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: TrackView<K, V, R>{Containers::StridedArrayView1D<const K>{data, data ? &data[0].first : nullptr, data.size(), sizeof(std::pair<K, V>)}, Containers::StridedArrayView1D<const V>{data, data ? &data[0].second : nullptr, data.size(), sizeof(std::pair<K, V>)}, interpolation, before, after} {}
/** @overload
* Equivalent to calling @ref TrackView(Containers::ArrayView<const std::pair<K, V>>, Interpolation, Extrapolation, Extrapolation)
@ -653,8 +653,8 @@ template<class K, class V, class R
*
* @see @ref keys(), @ref operator[]()
*/
Containers::StridedArrayView<const V> values() const {
return reinterpret_cast<const Containers::StridedArrayView<const V>&>(TrackViewStorage<K>::_values);
Containers::StridedArrayView1D<const V> values() const {
return reinterpret_cast<const Containers::StridedArrayView1D<const V>&>(TrackViewStorage<K>::_values);
}
/**

28
src/Magnum/Trade/Test/AnimationDataTest.cpp

@ -93,15 +93,15 @@ void AnimationDataTest::construct() {
{AnimationTrackType::Vector3,
AnimationTrackTargetType::Translation3D, 42,
Animation::TrackView<Float, Vector3>{
{&view[0].time, view.size(), sizeof(Data)},
{&view[0].position, view.size(), sizeof(Data)},
{view, &view[0].time, view.size(), sizeof(Data)},
{view, &view[0].position, view.size(), sizeof(Data)},
Animation::Interpolation::Constant,
animationInterpolatorFor<Vector3>(Animation::Interpolation::Constant)}},
{AnimationTrackType::Quaternion,
AnimationTrackTargetType::Rotation3D, 1337,
Animation::TrackView<Float, Quaternion>{
{&view[0].time, view.size(), sizeof(Data)},
{&view[0].rotation, view.size(), sizeof(Data)},
{view, &view[0].time, view.size(), sizeof(Data)},
{view, &view[0].rotation, view.size(), sizeof(Data)},
Animation::Interpolation::Linear,
animationInterpolatorFor<Quaternion>(Animation::Interpolation::Linear)}}
}}, {-1.0f, 7.0f}, &state};
@ -155,14 +155,14 @@ void AnimationDataTest::constructImplicitDuration() {
{AnimationTrackType::Bool,
AnimationTrackTargetType(129), 0,
Animation::TrackView<Float, bool>{
{&view[0].time, 2, sizeof(Data)},
{&view[0].value, 2, sizeof(Data)},
{view, &view[0].time, 2, sizeof(Data)},
{view, &view[0].value, 2, sizeof(Data)},
Animation::Interpolation::Constant}},
{AnimationTrackType::Bool,
AnimationTrackTargetType(130), 1,
Animation::TrackView<Float, bool>{
{&view[2].time, 2, sizeof(Data)},
{&view[2].value, 2, sizeof(Data)},
{view, &view[2].time, 2, sizeof(Data)},
{view, &view[2].value, 2, sizeof(Data)},
Animation::Interpolation::Linear}}
}}, &state};
@ -224,15 +224,15 @@ void AnimationDataTest::constructMove() {
{AnimationTrackType::Vector3,
AnimationTrackTargetType::Translation3D, 42,
Animation::TrackView<Float, Vector3>{
{&view[0].time, view.size(), sizeof(Data)},
{&view[0].position, view.size(), sizeof(Data)},
{view, &view[0].time, view.size(), sizeof(Data)},
{view, &view[0].position, view.size(), sizeof(Data)},
Animation::Interpolation::Constant,
animationInterpolatorFor<Vector3>(Animation::Interpolation::Constant)}},
{AnimationTrackType::Quaternion,
AnimationTrackTargetType::Rotation3D, 1337,
Animation::TrackView<Float, Quaternion>{
{&view[0].time, view.size(), sizeof(Data)},
{&view[0].rotation, view.size(), sizeof(Data)},
{view, &view[0].time, view.size(), sizeof(Data)},
{view, &view[0].rotation, view.size(), sizeof(Data)},
Animation::Interpolation::Linear,
animationInterpolatorFor<Quaternion>(Animation::Interpolation::Linear)}}
}}, {-1.0f, 7.0f}, &state};
@ -324,8 +324,8 @@ void AnimationDataTest::trackCustomResultType() {
AnimationTrackType::Vector3,
AnimationTrackTargetType::Scaling3D, 0,
Animation::TrackView<Float, Vector3i, Vector3>{
{&view[0].time, view.size(), sizeof(Data)},
{&view[0].position, view.size(), sizeof(Data)},
{view, &view[0].time, view.size(), sizeof(Data)},
{view, &view[0].position, view.size(), sizeof(Data)},
[](const Vector3i& a, const Vector3i& b, Float t) -> Vector3 {
return Math::lerp(Vector3{a}*0.01f, Vector3{b}*0.01f, t);
}}}}

Loading…
Cancel
Save