office-gobmx/slideshow
Stephan Bergmann af908d9f18 Avoid usage of incomplete types in member functions defined in-class
...that started to fail now at least with clang-cl (where the MSVC rules when to
emit inline member function definitions are more aggressive than for other ABIs)
with --with-latest-c++ and --with-visual-studio=2022 (where usage of incomplete
types in std::vector now triggered

> In file included from C:/lo-clang/core/slideshow/source/engine/opengl/TransitionerImpl.cxx:31:
> In file included from C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\memory:11:
> In file included from C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\exception:12:
> C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\type_traits(744,50): error: incomplete type 'Primitive' used in type trait expression
> struct is_trivially_destructible : bool_constant<__is_trivially_destructible(_Ty)> {
>                                                  ^
> C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\type_traits(59,53): note: in instantiation of template class 'std::is_trivially_destructible<Primitive>' requested here
> struct conjunction<_First, _Rest...> : _Conjunction<_First::value, _First, _Rest...>::type {
>                                                     ^
> C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\type_traits(64,44): note: in instantiation of template class 'std::conjunction<std::is_trivially_destructible<Primitive>, std::disjunction<std::_Is_default_allocator<std::allocator<Primitive>>, std::_Has_no_alloc_destroy<std::allocator<Primitive>, Primitive *>>>' requested here
> _INLINE_VAR constexpr bool conjunction_v = conjunction<_Traits...>::value;
>                                            ^
> C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\xmemory(934,20): note: in instantiation of variable template specialization 'std::conjunction_v<std::is_trivially_destructible<Primitive>, std::disjunction<std::_Is_default_allocator<std::allocator<Primitive>>, std::_Has_no_alloc_destroy<std::allocator<Primitive>, Primitive *>>>' requested here
>     if constexpr (!conjunction_v<is_trivially_destructible<_Ty>, _Uses_default_destroy<_Alloc, _Ty*>>) {
>                    ^
> C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\vector(1632,13): note: in instantiation of function template specialization 'std::_Destroy_range<std::allocator<Primitive>>' requested here
>             _Destroy_range(_Myfirst, _Mylast, _Al);
>             ^
> C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\vector(583,9): note: in instantiation of member function 'std::vector<Primitive>::_Tidy' requested here
>         _Tidy();
>         ^
> C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(74,5): note: in instantiation of member function 'std::vector<Primitive>::~vector' requested here
>     TransitionScene(
>     ^
> C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(42,7): note: forward declaration of 'Primitive'
> class Primitive;
>       ^

etc.).

Which in turn required tweaking of loplugin:unnecessaryoverride to avoid false

> In file included from C:/lo-clang/core/slideshow/source/engine/opengl/TransitionerImpl.cxx:67:
> C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(389,18): error: unnecessary user-declared destructor [loplugin:unnecessaryoverride]
> TransitionScene::~TransitionScene() = default;
> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
> C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(81,12): note: declared here [loplugin:unnecessaryoverride]
>     inline ~TransitionScene();
>     ~~~~~~~^~~~~~~~~~~~~~~~~~

Change-Id: Ia72fb44e6e92ff47376d7b7159c0df7cbf883b69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123648
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-15 13:20:21 +02:00
..
inc/pch
opengl
qa
source Avoid usage of incomplete types in member functions defined in-class 2021-10-15 13:20:21 +02:00
test
util
CppunitTest_slideshow.mk
IwyuFilter_slideshow.yaml
Library_OGLTrans.mk
Library_slideshow.mk
Makefile
manifest.txt
Module_slideshow.mk
Package_opengl.mk
README.md

Impress Slideshow Engine

3D Transitions

The 3D transitions are slideshow transition engine using OpenGL and are located in slideshow/source/engine/OGLTrans/. They were initially written by GSOC student Shane.M.Mathews. Radek has later polished the code a bit, added few new 3D transitions, added infrastructure for vertex and fragment shaders. Wrote few transitions with fragment shader too.

Physics Animation Effects

Physics animation effects are simulated by external 2d physics engine library Box2D. They don't directly call Box2D functions but instead use the wrapper in:

  • slideshow/source/inc/box2dtools.hxx
  • slideshow/source/engine/box2dtools.cxx

The wrapper has two corresponding classes to manage the Box2D world and Box2D bodies.

When a physics animation starts, a Box2DWorld is initiated and populated with every shape that is part of the foreground (which are shapes that do not belong to the master slide and not a background shape).

After creation until the end of the slide (not the whole slideshow) the Box2D World isn't destroyed and reused. But the bodies that represent the shapes in the slide get destroyed when there's a point in time that there's no physics animation in progress. And recreated when another physics animation starts.

If there are multiple physics animations in parallel only one of them takes the role of stepping through the simulation.

If there are other animation effects that go in parallel which change the shape position, rotation, or visibility - they also report the change to Box2DWorld. These updates are collected in a queue in Box2DWorld and processed before stepping through the simulation. To achieve convincing results these updates are performed by setting the Box2D body's linear velocity or angular velocity instead of setting directly it's position or rotation.