Magnum.h now doesn't include anything except OpenGL headers, thus
changes in Math library don't trigger recompilation of everything, but
only of things really depending on it.
Math constants moved to separate file for similar reasons, de-inlined
some functions to remove the need for some #includes.
Resulting (debug) executables are ~100 kB smaller, all operations
which were previously logarithmic are now done in constant time and
the whole implementation is a lot simpler.
Previously the scene was its own parent, which was good sometimes back
then, but it became so ugly and complicated hack ("my friend has access
to my privates"-style) that it needed to be replaced with something less
ugly.
Now there is an function isScene() which is overloaded in Scene. Yes,
it's possible to overload it anywhere else, but you better shouldn't
even think about it.
It only caused another maintenance burden and was confusing to users.
Now when scene graph is in SceneGraph namespace there is no need for
another grouping. Namespaces are (and should be) sufficient.
This reverts commit 79945ab6fc.
Conflicts:
src/BufferedImage.h
src/BufferedTexture.h
src/Framebuffer.h
src/Query.h
src/SceneGraph/Scene.h
While namespaces act for hierarchy, modules are something like "tags" -
usable when you want to check related classes of e.g. CubeMapTexture.
Not sure how to name module for Math and Physics namespaces and
Contexts/Trade, though.
Object::setClean() now computes absolute transformation while traversing
through object parents and passes it as parameter to clean(), which is
now virtual a meant to be reimplemented instead of setClean().
Updated and greatly improved unit test.
Improved parenting test, added test for transformation. Moved deleted
functions to public section, so the compiler prints error about deleted
functions, not about private functions.
Const function shouldn̈́'t return anything with which it would be possible
to change object's internal state:
* It is possible to get non-constant pointer to itself from
parent().children() array, so parent() cannot be const function.
* The same applies to scene().
* It is also possible to get non-constant pointer to itself from
children()[0].parent(), so children() also cannot be const function.
With C++11, objects can be passed nearly as easy as without these
convenience functions, for example:
Matrix4::scaling({0.5f, 1.0f, 0.5f});
which is nearly the same as the following, using convenience function:
Matrix4::scaling(0.5f, 1.0f, 0.5f);
Convenience functions can also be pretty confusing, for example:
Matrix4::rotation(1.0f, -1.0f, 2.0f, 2.0f); // wtf?
Matrix4::rotation(1.0f, {-1.0f, 2.0f, 2.0f}); // ah, okay!
There are also a few neat tricks, which cannot be done using convenience
functions, for example:
Matrix4::translate(Vector3::xAxis(3.0f)); // {3.0f, 0.0f, 0.0f}
Camera::setClearColor({0.1f, 0.1f, 0.1f}); // default 1.0f for alpha
It was overengineered and unnecessarily complicated. Now the camera is
specified only in Scene::draw(), which eliminates all the needs for
recalculating absolute object transformations on each camera
transformation change. Absolute object transformation is now computed
relative to root object or relative to camera object passed as
parameter. Because of that it is now also possible to draw the scene
using multiple cameras at once.
Not using macro this time, as some classes could want only to disable
either copy or move and with macros this would become unintuitive and
error-prone.