From ef5a25ee541279fa5f472a3ec5f031ad4bf2d48f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 5 Mar 2021 21:57:33 +0100 Subject: [PATCH] SceneGraph: fix destruction order to preserve parent links. Before the parent link was gone before destructing the children and that just didn't make sense. The test added in previous commit now passes as expected. --- doc/changelog.dox | 12 ++++++++++++ src/Magnum/SceneGraph/Object.h | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 9c425ef7b..46bd51182 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -263,6 +263,12 @@ See also: and @ref Platform::EmscriptenApplication::Configuration::clearWindowFlags() for consistency with other application implementations +@subsubsection changelog-latest-changes-shaders SceneGraph library + +- @ref SceneGraph trees are now destructed in a way that preserves + @ref SceneGraph::Object::parent() links up to the root as well as + @ref SceneGraph::AbstractFeature::object() references + @subsubsection changelog-latest-changes-shaders Shaders library - In the original implementation of normal mapping in @ref Shaders::Phong, @@ -524,6 +530,12 @@ See also: afterwards. This can cause compilation breakages in case the type constructor has the parent parameter non-optional, pass the parent explicitly in that case. +- @ref SceneGraph trees are now destructed in a way that preserves + @ref SceneGraph::Object::parent() links up to the root as well as + @ref SceneGraph::AbstractFeature::object() references. Previous behavior + made both @cpp nullptr @ce even before the object/feature destructors were + called and so it's assumed no code relied on such behavior, nevertheless + it's a subtle change worth mentioning. - Due to the rework of @ref Shaders::Phong to support directional and attenuated point lights, the original behavior of unattenuated point lights isn't available anymore. For backwards compatibility, light positions diff --git a/src/Magnum/SceneGraph/Object.h b/src/Magnum/SceneGraph/Object.h index 07f8e1b0f..2437052cf 100644 --- a/src/Magnum/SceneGraph/Object.h +++ b/src/Magnum/SceneGraph/Object.h @@ -104,7 +104,7 @@ class documentation or @ref compilation-speedup-hpp for more information. */ template class Object: public AbstractObject, public Transformation #ifndef DOXYGEN_GENERATING_OUTPUT - , private Containers::LinkedList>, private Containers::LinkedListItem, Object> + , private Containers::LinkedListItem, Object>, private Containers::LinkedList> #endif { public: @@ -126,8 +126,9 @@ template class Object: public AbstractObject