That one is reportedly using the more stable implementation, so just use
it. The code is then also easier to follow. Also added a matrix
decomposition test case and referencing it from the docs, in case
someone would need it again.
Slow and ugly, is here only for making quick'n'dirty alpha masked
drawing without a need for blending or depth sorting. Oh and also to
support the glTF alpha mask feature. Again, beware: *slow*.
MSVC 2015 and 2017 is clueless when it comes to trying to deduce the
template parameters (C2893: Failed to specialize function template). It
works when calling add<V, R> explicitly, but that makes the API hard to
use and inconsistent between platforms. The only possible workaround is
to make add() take *anything*, casting it to proper TrackView type and
then calling add() with explicit template parameters. This also neatly
resolves the Track/TrackView overload, as the static_cast is either a
no-op or it invokes the conversion operator on Track. The original code
also reportedly makes the Intellisense freezing like hell and adding
this overload fixes the freezes. Three birds with one stone.
The Player class definition is now full of typedefs, with the amount of
comments about why the typedefs are there much bigger than the actual
code. Oh well.
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.
I managed to work around that for Emscripten 1.38.5 by adding an
explicit definition of noexcept Player::Track copy
constructor/assignment, but that didn't solve anything for Emscripten,
iOS or Android. Since I can't reproduce that on *anything* I have on
this machine and it seems that the problem somehow just goes away when
using a more recent Clang, I decided to just remove the noexcept
specifier altogether.
I had a temptation to make it noexcept everywhere except Clang, but that
might add potential portability issues (code that works with GCC would
suddenly break on Clang without any clear reason).
Note that I don't mean all possible underlying types, just all possible
vector classes. This is needed for splines etc. which may be templated
and have result type a generic vector, for example.
For consistency with all other views such as Containers::ArrayView as
these are all relatively light types and so the construction should be
lightweight as well. OTOH, Track constructors are still explicit because
they're heavy and the user should experience the heaviness firsthand.
This reduces the templated code a bit, as I moved the index assertion to
the *.cpp file. Also the function now returns a reference to avoid
needless copies -- it's a view, but still quite a heavy view.
Moreover, this will prevent from passing e.g. integer-based keys to
Trade::AnimationData. And this also now allows me to add duration() to
Trade::AnimationData. I also moved all accessors that don't need a
concrete value type to this base class.