Browse Source

Animation: put a reminder for myself.

At the moment, with the major use case, which is playing back glTF
animations, one can't use atStrict() because there Extrapolation is
specified to be always Constant. The atStrict() function behaves as
Extrapolate and one would need to patch the imported tracks to add
explicit keyframes at the beginning/end of the duration that emulate the
Constant behavior.
pull/191/head
Vladimír Vondruš 8 years ago
parent
commit
06c811bb4d
  1. 4
      src/Magnum/Animation/Player.h

4
src/Magnum/Animation/Player.h

@ -660,6 +660,7 @@ template<class T, class K> template<class V, class R, class Callback> Player<T,
auto callbackPtr = static_cast<void(*)(const K&, const R&, void*)>(callback);
return addInternal(track,
[](const TrackViewStorage<K>& track, K key, std::size_t& hint, void*, void(*callback)(), void* userData) {
/** @todo try to use atStrict() if possible */
reinterpret_cast<void(*)(const K&, const R&, void*)>(callback)(key, static_cast<const TrackView<K, V, R>&>(track).at(key, hint), userData);
}, nullptr, reinterpret_cast<void(*)()>(callbackPtr), userData);
}
@ -668,6 +669,7 @@ template<class T, class K> template<class V, class R, class U, class Callback> P
auto callbackPtr = static_cast<void(*)(const K&, const R&, U&)>(callback);
return addInternal(track,
[](const TrackViewStorage<K>& track, K key, std::size_t& hint, void*, void(*callback)(), void* userData) {
/** @todo try to use atStrict() if possible */
reinterpret_cast<void(*)(const K&, const R&, U&)>(callback)(key, static_cast<const TrackView<K, V, R>&>(track).at(key, hint), *static_cast<U*>(userData));
}, nullptr, reinterpret_cast<void(*)()>(callbackPtr), &userData);
}
@ -676,6 +678,7 @@ template<class T, class K> template<class V, class R, class Callback> Player<T,
auto callbackPtr = static_cast<void(*)(const K&, const R&, void*)>(callback);
return addInternal(track,
[](const TrackViewStorage<K>& track, K key, std::size_t& hint, void* destination, void(*callback)(), void* userData) {
/** @todo try to use atStrict() if possible */
R result = static_cast<const TrackView<K, V, R>&>(track).at(key, hint);
if(result == *static_cast<R*>(destination)) return;
reinterpret_cast<void(*)(const K&, const R&, void*)>(callback)(key, result, userData);
@ -687,6 +690,7 @@ template<class T, class K> template<class V, class R, class U, class Callback> P
auto callbackPtr = static_cast<void(*)(const K&, const R&, U&)>(callback);
return addInternal(track,
[](const TrackViewStorage<K>& track, K key, std::size_t& hint, void* destination, void(*callback)(), void* userData) {
/** @todo try to use atStrict() if possible */
R result = static_cast<const TrackView<K, V, R>&>(track).at(key, hint);
if(result == *static_cast<R*>(destination)) return;
reinterpret_cast<void(*)(const K&, const R&, U&)>(callback)(key, result, *static_cast<U*>(userData));

Loading…
Cancel
Save