To be more consistent with GLSL naming. Also, the original naming was
quite misleading, as normalize() is used in GLSL for something
completely different.
If building with deprecated APIs, the Functions.h header includes the
new Packing.h header and the {de,}normalize() functions are defined as
deprecated aliases to the new functions. This will be removed at some
point in the future.
With -O2 the test works, but with -O1 the compiler complains about
missing instruction. I guess -O2 just optimizes it away in this
particular case, so the safe option is to not use it at all.
Mainly a convenience function in case you want to compute sin and cos of
the same, potentially longer expression, and you don't want to have
repeated code or temporary variables. On some architectures might use
faster instruction that computes both values in one shot.
It is often annoying to write e.g. this, especially in generic code:
T dot = Math::Vector<size, T>::dot(a, b);
When this is more than enough and the compiler can infer the rest from
the context:
T dot = Math::dot(a, b);
There are more downsides and confusing cases (you can call
Math::Vector<3, T>::dot(), Math::Vector3<T>::dot() and Color3::dot() and
it is still the same function), so I made these as free functions in
Math namespace. You can now also abuse ADL for the calls, but I would
advise against that for better readability:
T d = dot(a, b); // dot?! what on earth is dot? and what is a?
The only downside found when porting is that you need to specify the
type somehow when having both parameters as initializer lists:
T d = dot({2.0f, -1.5f}, {1.0f, 2.5f}); // error
T d = dot(Complex{2.0f, -1.5f}, {1.0f, 2.5f}); // okay
But that's probably reasonable (and it's also highly corner case,
the functions were used this way only in tests).
The original static member functions are of course still present, but
marked as deprecated and will be removed at some point in future.
As we are now using absolute includes, there is no need to prefix
everything with "magnum<Namespace>" etc. All generated configuration
files are renamed to configure.h and their path is included _before_
everything else to avoid accidental collisions.
The only places where they aren't absolute are:
- when header is included from corresponding source file
- when including headers which are not part of final installation (e.g.
test-specific configuration, headers from Implementation/)
Everything what was in src/ is now in src/Corrade, everything from
src/Plugins is now in src/MagnumPlugins, everything from external/ is in
src/MagnumExternal. Added new CMakeLists.txt file and updated the other
ones for the moves, no other change was made. If MAGNUM_BUILD_DEPRECATED
is set, everything compiles and installs like previously except for the
plugins, which are now in MagnumPlugins and not in Magnum/Plugins.
No Vector<size, T> and std::initializer_list versions yet, as the
algorithm for it is pretty complicated and I'm not sure that they will
be used frequently enough to deserve their existence.
Also fixed unary RectangularMatrix::operator-() and Vector::operator-()
documentation (was stating that the operation is done in-place, which is
impossible.
31ce072f39 was wrong, this header is
harmful. This beast includes ~46k LOC, much more than <*stream> class of
headers. Rewritten min() and max() manually, which surprisingly leads to
shorter implementation than previously. Compilation time on my machine
reduced from ~4:30 to ~4:21, not bad.
First, removed functions which can be done with Vector's member
functions and functions from Functions.h. More flexibility and less
redundant code which leads to easier SIMD implementation later.
Vector4 a;
Float b = a.maxAbs(); // before
Float b = Math::abs(a).max(); // now
Second, removed all functions from RectangularMatrix which are
implemented in Vector and added conversion from RectangularMatrix to
Vector and back. Also for more flexibility and less redundant code (i.e.
reusing SIMD-optimized Vector::max() instead of writing it again).
Matrix4x3 a;
Float b = a.max(); // before
Float b = a.toVector().max(); // now