1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00
Commit graph

5666 commits

Author SHA1 Message Date
elsid
a3b6bc7263
Fix logic expression for not found value 2021-10-20 17:48:10 +02:00
elsid
562590720b
Remove ShadowsBin prototype on MWShadowTechnique destruction
To prevent crash:
==7733==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040000ca1b0 at pc 0x55fcfa8d1ee3 bp 0x7ffd1c464e00 sp 0x7ffd1c464df0
READ of size 4 at 0x6040000ca1b0 thread T0
    #0 0x55fcfa8d1ee2 in std::less<unsigned int>::operator()(unsigned int const&, unsigned int const&) const /usr/include/c++/11.1.0/bits/stl_function.h:386
    #1 0x55fcfa8d1ee2 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_lower_bound(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*, std::_Rb_tree_node_base*, unsigned int const&) /usr/include/c++/11.1.0/bits/stl_tree.h:1903
    #2 0x55fcfa8ca76e in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::lower_bound(unsigned int const&) /usr/include/c++/11.1.0/bits/stl_tree.h:1270
    #3 0x55fcfa8ca76e in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::lower_bound(unsigned int const&) /usr/include/c++/11.1.0/bits/stl_map.h:1259
    #4 0x55fcfa8ca76e in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::operator[](unsigned int const&) /usr/include/c++/11.1.0/bits/stl_map.h:497
    #5 0x55fcfa8ca76e in osg::getOrCreateContextData(unsigned int) /home/elsid/dev/OpenSceneGraph/src/osg/ContextData.cpp:142
    #6 0x55fcfab6848a in GLShaderManager* osg::get<GLShaderManager>(unsigned int) /home/elsid/dev/OpenSceneGraph/include/osg/ContextData:154
    #7 0x55fcfab6848a in osg::Shader::PerContextShader::~PerContextShader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:540
    #8 0x55fcfab68dc6 in osg::Shader::PerContextShader::~PerContextShader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:541
    #9 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #10 0x55fcfab6d0ce in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    #11 0x55fcfab6d0ce in osg::ref_ptr<osg::Shader::PerContextShader>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    #12 0x55fcfab6d0ce in void std::_Destroy<osg::ref_ptr<osg::Shader::PerContextShader> >(osg::ref_ptr<osg::Shader::PerContextShader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:140
    #13 0x55fcfab6d0ce in void std::_Destroy_aux<false>::__destroy<osg::ref_ptr<osg::Shader::PerContextShader>*>(osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:152
    #14 0x55fcfab6d0ce in void std::_Destroy<osg::ref_ptr<osg::Shader::PerContextShader>*>(osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:185
    #15 0x55fcfab6d0ce in void std::_Destroy<osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader> >(osg::ref_ptr<osg::Shader::PerContextShader>*, osg::ref_ptr<osg::Shader::PerContextShader>*, std::allocator<osg::ref_ptr<osg::Shader::PerContextShader> >&) /usr/include/c++/11.1.0/bits/alloc_traits.h:746
    #16 0x55fcfab6d0ce in std::vector<osg::ref_ptr<osg::Shader::PerContextShader>, std::allocator<osg::ref_ptr<osg::Shader::PerContextShader> > >::~vector() /usr/include/c++/11.1.0/bits/stl_vector.h:680
    #17 0x55fcfab6d0ce in osg::Shader::ShaderObjects::~ShaderObjects() /home/elsid/dev/OpenSceneGraph/include/osg/Shader:264
    #18 0x55fcfab6d0ce in osg::Shader::ShaderObjects::~ShaderObjects() /home/elsid/dev/OpenSceneGraph/include/osg/Shader:264
    #19 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #20 0x55fcfab6c532 in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    #21 0x55fcfab6c532 in osg::ref_ptr<osg::Shader::ShaderObjects>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    #22 0x55fcfab6c532 in void std::_Destroy<osg::ref_ptr<osg::Shader::ShaderObjects> >(osg::ref_ptr<osg::Shader::ShaderObjects>*) /usr/include/c++/11.1.0/bits/stl_construct.h:140
    #23 0x55fcfab6c532 in void std::_Destroy_aux<false>::__destroy<osg::ref_ptr<osg::Shader::ShaderObjects>*>(osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects>*) /usr/include/c++/11.1.0/bits/stl_construct.h:152
    #24 0x55fcfab6c532 in void std::_Destroy<osg::ref_ptr<osg::Shader::ShaderObjects>*>(osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects>*) /usr/include/c++/11.1.0/bits/stl_construct.h:185
    #25 0x55fcfab6c532 in void std::_Destroy<osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects> >(osg::ref_ptr<osg::Shader::ShaderObjects>*, osg::ref_ptr<osg::Shader::ShaderObjects>*, std::allocator<osg::ref_ptr<osg::Shader::ShaderObjects> >&) /usr/include/c++/11.1.0/bits/alloc_traits.h:746
    #26 0x55fcfab6c532 in std::vector<osg::ref_ptr<osg::Shader::ShaderObjects>, std::allocator<osg::ref_ptr<osg::Shader::ShaderObjects> > >::~vector() /usr/include/c++/11.1.0/bits/stl_vector.h:680
    #27 0x55fcfab6c532 in osg::buffered_value<osg::ref_ptr<osg::Shader::ShaderObjects> >::~buffered_value() /home/elsid/dev/OpenSceneGraph/include/osg/buffered_value:26
    #28 0x55fcfab6c532 in osg::Shader::~Shader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:271
    #29 0x55fcfab6c80a in osg::Shader::~Shader() /home/elsid/dev/OpenSceneGraph/src/osg/Shader.cpp:271
    #30 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #31 0x55fcfab185bd in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    #32 0x55fcfab185bd in osg::ref_ptr<osg::Shader>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    #33 0x55fcfab185bd in void std::_Destroy<osg::ref_ptr<osg::Shader> >(osg::ref_ptr<osg::Shader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:140
    #34 0x55fcfab185bd in void std::_Destroy_aux<false>::__destroy<osg::ref_ptr<osg::Shader>*>(osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:152
    #35 0x55fcfab185bd in void std::_Destroy<osg::ref_ptr<osg::Shader>*>(osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader>*) /usr/include/c++/11.1.0/bits/stl_construct.h:185
    #36 0x55fcfab185bd in void std::_Destroy<osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader> >(osg::ref_ptr<osg::Shader>*, osg::ref_ptr<osg::Shader>*, std::allocator<osg::ref_ptr<osg::Shader> >&) /usr/include/c++/11.1.0/bits/alloc_traits.h:746
    #37 0x55fcfab185bd in std::vector<osg::ref_ptr<osg::Shader>, std::allocator<osg::ref_ptr<osg::Shader> > >::~vector() /usr/include/c++/11.1.0/bits/stl_vector.h:680
    #38 0x55fcfab185bd in osg::Program::~Program() /home/elsid/dev/OpenSceneGraph/src/osg/Program.cpp:147
    #39 0x55fcfab18ae0 in osg::Program::~Program() /home/elsid/dev/OpenSceneGraph/src/osg/Program.cpp:147
    #40 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #41 0x55fcf8582cfa in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/Referenced:201
    #42 0x55fcf8582cfa in osg::ref_ptr<osg::StateAttribute>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/ref_ptr:44
    #43 0x55fcf8582cfa in std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int>::~pair() /usr/include/c++/11.1.0/bits/stl_pair.h:211
    #44 0x55fcf8582cfa in std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >::~pair() /usr/include/c++/11.1.0/bits/stl_pair.h:211
    #45 0x55fcf8582cfa in void __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::destroy<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >(std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >*) /usr/include/c++/11.1.0/ext/new_allocator.h:162
    #46 0x55fcf8582cfa in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > > >::destroy<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >(std::allocator<std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >&, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >*) /usr/include/c++/11.1.0/bits/alloc_traits.h:531
    #47 0x55fcf8582cfa in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::_M_destroy_node(std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:623
    #48 0x55fcf8582cfa in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:631
    #49 0x55fcf8582cfa in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    #50 0x55fcfac1f281 in std::_Rb_tree<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> >, std::_Select1st<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > >, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::clear() /usr/include/c++/11.1.0/bits/stl_tree.h:1254
    #51 0x55fcfac1f281 in std::map<std::pair<osg::StateAttribute::Type, unsigned int>, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int>, std::less<std::pair<osg::StateAttribute::Type, unsigned int> >, std::allocator<std::pair<std::pair<osg::StateAttribute::Type, unsigned int> const, std::pair<osg::ref_ptr<osg::StateAttribute>, unsigned int> > > >::clear() /usr/include/c++/11.1.0/bits/stl_map.h:1134
    #52 0x55fcfac1f281 in osg::StateSet::clear() /home/elsid/dev/OpenSceneGraph/src/osg/StateSet.cpp:738
    #53 0x55fcfac2079e in osg::StateSet::~StateSet() /home/elsid/dev/OpenSceneGraph/src/osg/StateSet.cpp:285
    #54 0x55fcfac20d3e in osg::StateSet::~StateSet() /home/elsid/dev/OpenSceneGraph/src/osg/StateSet.cpp:286
    #55 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #56 0x55fcfb20dcac in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/Referenced:201
    #57 0x55fcfb20dcac in osg::ref_ptr<osg::StateSet>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/build/gcc/asan/install/include/osg/ref_ptr:44
    #58 0x55fcfb20dcac in std::array<osg::ref_ptr<osg::StateSet>, 8ul>::~array() /usr/include/c++/11.1.0/array:95
    #59 0x55fcfb20dcac in SceneUtil::ShadowsBin::~ShadowsBin() /home/elsid/dev/openmw/components/sceneutil/shadowsbin.hpp:16
    #60 0x55fcfb20dcac in SceneUtil::ShadowsBin::~ShadowsBin() /home/elsid/dev/openmw/components/sceneutil/shadowsbin.hpp:16
    #61 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #62 0x55fcfa6cc17f in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    #63 0x55fcfa6cc17f in osg::ref_ptr<osgUtil::RenderBin>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    #64 0x55fcfa6cc17f in std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >::~pair() /usr/include/c++/11.1.0/bits/stl_pair.h:211
    #65 0x55fcfa6cc17f in void __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::destroy<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >*) /usr/include/c++/11.1.0/ext/new_allocator.h:162
    #66 0x55fcfa6cc17f in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > > >::destroy<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >&, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >*) /usr/include/c++/11.1.0/bits/alloc_traits.h:531
    #67 0x55fcfa6cc17f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_destroy_node(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:623
    #68 0x55fcfa6cc17f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:631
    #69 0x55fcfa6cc17f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    #70 0x55fcfa6cc122 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1887
    #71 0x55fcfa6cc122 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1887
    #72 0x55fcfa6cc245 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::~_Rb_tree() /usr/include/c++/11.1.0/bits/stl_tree.h:984
    #73 0x55fcfa6cc245 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, osg::ref_ptr<osgUtil::RenderBin>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, osg::ref_ptr<osgUtil::RenderBin> > > >::~map() /usr/include/c++/11.1.0/bits/stl_map.h:302
    #74 0x55fcfa6cc245 in RenderBinPrototypeList::~RenderBinPrototypeList() /home/elsid/dev/OpenSceneGraph/src/osgUtil/RenderBin.cpp:48
    #75 0x55fcfa6cc245 in RenderBinPrototypeList::~RenderBinPrototypeList() /home/elsid/dev/OpenSceneGraph/src/osgUtil/RenderBin.cpp:48
    #76 0x55fcfab4a3f3 in osg::Referenced::signalObserversAndDelete(bool, bool) const /home/elsid/dev/OpenSceneGraph/src/osg/Referenced.cpp:292
    #77 0x55fcfa6cbcc1 in osg::Referenced::unref() const /home/elsid/dev/OpenSceneGraph/include/osg/Referenced:201
    #78 0x55fcfa6cbcc1 in osg::ref_ptr<RenderBinPrototypeList>::~ref_ptr() /home/elsid/dev/OpenSceneGraph/include/osg/ref_ptr:44
    #79 0x7f3977bd04a6 in __run_exit_handlers (/usr/lib/libc.so.6+0x3f4a6)
    #80 0x7f3977bd064d in exit (/usr/lib/libc.so.6+0x3f64d)
    #81 0x7f3977bb8b2b in __libc_start_main (/usr/lib/libc.so.6+0x27b2b)
    #82 0x55fcf81ea12d in _start (/home/elsid/dev/openmw/build/gcc/asan/openmw+0xa4412d)

0x6040000ca1b0 is located 32 bytes inside of 48-byte region [0x6040000ca190,0x6040000ca1c0)
freed by thread T0 here:
    #0 0x7f397a633d69 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172
    #1 0x55fcfa8d1824 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::deallocate(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*, unsigned long) /usr/include/c++/11.1.0/ext/new_allocator.h:139
    #2 0x55fcfa8d1824 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > > >::deallocate(std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >&, std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:492
    #3 0x55fcfa8d1824 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_put_node(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:565
    #4 0x55fcfa8d1824 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_drop_node(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:632
    #5 0x55fcfa8d1824 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    #6 0x55fcfa8d18da in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::~_Rb_tree() /usr/include/c++/11.1.0/bits/stl_tree.h:984
    #7 0x55fcfa8d18da in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::~map() /usr/include/c++/11.1.0/bits/stl_map.h:302
    #8 0x7f3977bd04a6 in __run_exit_handlers (/usr/lib/libc.so.6+0x3f4a6)

previously allocated by thread T0 here:
    #0 0x7f397a632ca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55fcfa8d3aa1 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::allocate(unsigned long, void const*) /usr/include/c++/11.1.0/ext/new_allocator.h:121
    #2 0x55fcfa8d3aa1 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >&, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:460
    #3 0x55fcfa8d3aa1 in std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_get_node() /usr/include/c++/11.1.0/bits/stl_tree.h:561
    #4 0x55fcfa8d3aa1 in std::_Rb_tree_node<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >* std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<unsigned int const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<unsigned int const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:611
    #5 0x55fcfa8d3aa1 in std::_Rb_tree_iterator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > std::_Rb_tree<unsigned int, std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> >, std::_Select1st<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<unsigned int const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > >, std::piecewise_construct_t const&, std::tuple<unsigned int const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:2429
    #6 0x55fcfa8cfd91 in std::map<unsigned int, osg::ref_ptr<osg::ContextData>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, osg::ref_ptr<osg::ContextData> > > >::operator[](unsigned int const&) /usr/include/c++/11.1.0/bits/stl_map.h:501
    #7 0x55fcfa8cfd91 in osg::ContextData::createNewContextID() /home/elsid/dev/OpenSceneGraph/src/osg/ContextData.cpp:171
    #8 0x55fcfa9be218 in osg::GraphicsContext::createNewContextID() /home/elsid/dev/OpenSceneGraph/src/osg/GraphicsContext.cpp:320
    #9 0x55fcfb68d1ef in SDLUtil::GraphicsWindowSDL2::GraphicsWindowSDL2(osg::GraphicsContext::Traits*) /home/elsid/dev/openmw/components/sdlutil/sdlgraphicswindow.cpp:39
    #10 0x55fcfa17f93a in OMW::Engine::createWindow(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:611
    #11 0x55fcfa18398f in OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:679
    #12 0x55fcfa18c4f2 in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949
    #13 0x55fcfa13c9ff in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316
    #14 0x55fcfb49f562 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    #15 0x55fcfa133114 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    #16 0x7f3977bb8b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/11.1.0/bits/stl_function.h:386 in std::less<unsigned int>::operator()(unsigned int const&, unsigned int const&) const
Shadow bytes around the buggy address:
  0x0c08800113e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c08800113f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011410: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011420: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c0880011430: fa fa fd fd fd fd[fd]fd fa fa fa fa fa fa fa fa
  0x0c0880011440: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011450: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011460: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011470: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0880011480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==7733==ABORTING
2021-10-20 13:26:25 +02:00
elsid
590a340e6e
Remove redundant ShadowsBin::sCastingPrograms
This variable is only used in ShadowsBin constructor and it's initialized each
time before constructor call so required value can be just passed into
ShadowsBin ctor.

Make ShadowsBin default constructor private because it is required by osg even
it's not actually called.
2021-10-20 13:25:21 +02:00
elsid
9d1b7c4a30
Use type alias to avoid long type names and length redefinition for array 2021-10-20 13:25:21 +02:00
elsid
6cfabe252d
Remove redundant ShadowsBinAdder 2021-10-20 13:25:21 +02:00
elsid
06ea47f74b
Fix crash in DetourNavigator::fixupCorridor
Handle situation when resulting path does not fit into destination vector.
2021-10-19 22:54:46 +02:00
elsid
e5413c0664
Add functions to compress/decompress vector of bytes 2021-10-18 20:46:22 +02:00
elsid
bb26ba30b6
Add progress reporter type
To log/report progress of long duration operations using given time period.
2021-10-18 01:26:10 +02:00
AnyOldName3
9be606a40d Finish removing old Escape classes 2021-10-17 23:40:34 +01:00
psi29a
d8d16a52e1 Merge branch 'esm_loader' into 'master'
Add ESM data loader

See merge request OpenMW/openmw!1301
2021-10-17 19:21:32 +00:00
elsid
046b5f83ee
Add ESM data loader
A component to load ESM content files with limited support for record types and
selection which of them to load. Supported record types are:
ACTI, CELL, CONT, DOOR, GMST, LAND, STAT.
2021-10-17 19:55:29 +02:00
elsid
18d3102148
Do not use union to access FIXED_STRING<4> as int
https://en.cppreference.com/w/cpp/language/union:
> It's undefined behavior to read from the member of the union that wasn't most recently written.
2021-10-17 17:16:21 +02:00
psi29a
62dfbb33d9 Merge branch 'fix_find_path_crash' into 'master'
Fix crash in finding path over navmesh (#6338)

Closes #6338

See merge request OpenMW/openmw!1296
2021-10-17 12:15:14 +00:00
Bo Svensson
01605433cb
quadtreeworld.cpp (#3174)
Currently, we disable a paging root node that we only need in exterior cells by setting its node mask to 0 when transitioning into an interior cell. Node masks are not ideal for this usage case because Node::getBound is unaware of masks. With this PR we just detach the unused node from the scene graph. _shadowedScene->getBound() in the MWShadowTechnique should return a much better value in interior cells with these changes.
2021-10-16 21:48:13 +02:00
elsid
c88367b6a6
Add sqlite3 helpers 2021-10-16 17:43:08 +02:00
elsid
f6d1689bb9
Avoid redundant polygon path reallocations
Use separate variable to store size and make all operations in-place.
2021-10-14 23:48:14 +02:00
elsid
79665cea66
Avoid access to the path vector element out of range
polygonPath.front() in some cases might reference to a first element of empty
vector. Copy the value into a local variable to be able to access later.
2021-10-14 23:46:50 +02:00
Bo Svensson
db3d938ee9
cleans up BSAFile (#3177)
We currently build a large map of a BSAFile's contents unused by Open MW. We already map archive contents in VFS. With this PR we remove the map from BSAFile and reimplement its only current use in BSATool.
2021-10-14 14:46:44 +02:00
Dan Church
42bd10f356
Fix FTBFS against older versions of osg
Bring back osg version guard.

Drawable::dirtyGLObjects wasn't available until OpenSceneGraph-3.5.10.
2021-10-13 13:55:16 -05:00
Evil Eye
ec6451e93a Merge branch 'recordtype' into 'master'
Avoid copying std::string in MWWorld::Ptr::getTypeDescription()

See merge request OpenMW/openmw!1290
2021-10-13 17:04:32 +00:00
Bo Svensson
617eec338a
removes version guard (#3173)
We currently use a version guard to adapt to a change in the number of parameters supplied to osg::TriangleFunctor's operator() template functor. The differing parameter is unused in our code. Crucially, operator() is not an override, so we can just add a default value for the differing parameter. Such a default allows us to apply identical code to both versions of the library without regressing functionality.
2021-10-13 16:12:47 +02:00
Bo Svensson
b0132be53f
do not dirty unchanged arrays (#3164)
This PR proposes a simple change to `RigGeometry` `dirtyGLObjects` logic.

1. We will avoid dirtying unmodified arrays.
2. We can drop an osg version guard since `Drawable::dirtyGLObjects` is not nearly as harmful as `Geometry::dirtyGLObjects`.
3. We will avoid crashes in an as yet unfinished future PR concerning `Array` sharing improvements.
2021-10-12 13:47:42 +02:00
psi29a
67fa8413f3 Merge branch 'physics_heightfield' into 'master'
Replace float type for arguments to create heightfield with int

See merge request OpenMW/openmw!1285
2021-10-12 07:58:34 +00:00
psi29a
207a7245bc Merge branch 'navigator_settings' into 'master'
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager

See merge request OpenMW/openmw!1283
2021-10-12 07:02:08 +00:00
Petr Mikheev
a8acc19988 Avoid copying std::string in MWWorld::Ptr::getTypeDescription() 2021-10-12 00:18:23 +02:00
elsid
405e814190
Move btCollisionObject creation for MWPhysics::Object into components 2021-10-11 23:14:02 +02:00
elsid
7c5a590890
Replace float type for arguments to create heightfield with int
To reduce amount of computations on the caller side and restrict possible
values.

* verts can't be non-int because it's a number of things.
* worldsize is initially defined as int by ESM::Land::REAL_SIZE.
* Put function to calculate heightfied shift into components to be able to
  reuse by other binaries.
2021-10-11 19:28:08 +02:00
elsid
6986feb81b
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager
To avoid having multiple places to initialize them when they will be required
by multiple binaries.
2021-10-11 18:50:26 +02:00
Bo Svensson
93848ef01c
avoids virtual function calls in ComputeLightSpaceBounds (#3167)
osg::NodeVisitor is designed to recursively call virtual apply signatures until we find an implemented signature. Encountered nodes that we do not explicitely handle will trigger additional virtual function calls. With this PR we avoid these additional virtual function calls in the particularly costly ComputeLightSpaceBounds by adding some explicit signatures.
2021-10-11 15:11:59 +02:00
Bo Svensson
98f8295765
allows to skip ComputeLightSpaceBounds traversal (#3152)
Currently, we always traverse the scene graph an additional time with a ComputeLightSpaceBounds visitor during shadow casting. ComputeLightSpaceBounds is only useful when the shadow casting mask allows us to shrink the bounds of the rendered scene, so we guard its traversal with a check against getCastsShadowTraversalMask. In practice, this guard never works because we build the traversal mask inclusively.

With this PR we limit the getCastsShadowTraversalMask check to relevant masks. This new check allows us to skip a superfluous ComputeLightSpaceBounds traversal with most settings.
2021-10-11 11:27:50 +02:00
psi29a
f9124ccea6 Merge branch 'recast_mesh_slope' into 'master'
Use different colors for walkable and non-walkable recast mesh triangles

See merge request OpenMW/openmw!1277
2021-10-11 08:56:04 +00:00
psi29a
f014edd27c Merge branch 'fix_write_recast_mesh' into 'master'
Fix writing to file for RecastMesh

See merge request OpenMW/openmw!1278
2021-10-11 08:20:33 +00:00
Bo Svensson
7c50f823d8
devirtualises BSAFile (#3161)
Currently, Open MW's basic file access speed is limited by a peculiar layer of virtualisation in BSAFile's interface. This PR removes such virtualisation by properly separating BSAFile from CompressedBSAFile in low level contexts.
2021-10-11 10:09:48 +02:00
AnyOldName3
1b83b08d80 Merge remote-tracking branch 'upstream/master' into detain-hash
Tests which no longer work are commented out.
Some of these don't work because they're effectively testing for the
presence of bugs in the old implementation.
Others don't work because we're no longer accidentally disabling the
boost::program_options feature where it generates an error if only part
of a token gets consumed.
These will be fixed by later commits.
2021-10-10 23:50:50 +01:00
Bo Svensson
c2d836c6c4
optimises riggeometry.cpp (#3165)
We skip this during node path iterations. this is not a node we are interested in.
We avoid allocating a new mGeomToSkelMatrix per frame and avoid a ref_ptr associated with its update.
We speed up a search for the Skeleton node by adding a continue; condition prior to an expensive dynamic_cast.
2021-10-10 18:37:34 +02:00
Bo Svensson
031871cd48
speeds up optimizer (#3162)
We can expect marginally improved loading times with this PR. Drawable, Transform and Node counts in stats panels are expected to remain unchanged - this PR does not add new scene graph optimisations, it just increases the speed with which we apply existing ones.

1. We add explicit `NodeVisitor::apply` overrides for commonly encountered node types to avoid additional virtual function calls per node associated with the default `apply` implementation.
2. We skip pushing `StateSet`s when  `_mergeAlphaBlending` is enabled or the `StateSet` contains no relevant state.
3. We add a specialised variant of `CollectLowestTransformsVisitor::addTransform` accepting `MatrixTransform` to avoid matrix copies and multiplications.
2021-10-10 18:09:15 +02:00
elsid
0c8a811ad5
Render only cached recast mesh
To avoid waiting while recast mesh is generating.

Remove redundant continue.
2021-10-10 13:13:57 +02:00
elsid
daff7aba01
Use different colors for walkable and non-walkable triangles 2021-10-09 17:44:25 +02:00
elsid
88ac77df1f
Fix writing to file for RecastMesh
Add missing scaling and y, z coordinates swap.
2021-10-09 17:30:37 +02:00
Bo Svensson
b61140b8ba
optimises skeleton.cpp (#3158)
With this PR we optimise a function that is called quite often when loading new cells.

We remove avoidable dynamic_casts.
We remove an unused pair.second element.
We convert a map to an unordered_map because its ordering is irrelevant in this case.
We avoid adding the root Skeleton node to the bones' node path.
2021-10-09 11:14:22 +02:00
AnyOldName3
af0d399103 Purge all uses of Escape Hash types 2021-10-09 01:49:08 +01:00
psi29a
7af245d205 Merge branch 'sync_sync_with_async' into 'master'
Merge logic of sync and async physics simulation

See merge request OpenMW/openmw!1250
2021-10-08 09:35:32 +00:00
psi29a
ae31138686 Merge branch 'options_tests' into 'master'
Add tests for openmw options

See merge request OpenMW/openmw!1253
2021-10-08 08:02:40 +00:00
Bo Svensson
5242e2695c
avoids memory allocations within ComputeLightSpaceBounds (#3156)
Currently, we create a new ComputeLightSpaceBounds visitor per frame. Within this visitor, we require excessive memory allocations, mainly a new osg::RefMatrix per encountered Transform node.

With this PR we reuse a single ComputeLightSpaceBounds visitor across frames and enable the createOrReuseMatrix functionality to avoid allocating new matrices every frame. osgUtil::CullVisitor internally uses the same approach.
2021-10-08 09:56:55 +02:00
psi29a
88d5b4a90b Merge branch 'variable_function' into 'master'
Parse local variables sharing a name with a function as variables

Closes #6291

See merge request OpenMW/openmw!1269
2021-10-08 06:45:02 +00:00
psi29a
fc7e13d76a Merge branch 'omwaddon_dep' into 'master'
Allow creating omwaddons without a dependency on an omwgame

See merge request OpenMW/openmw!1243
2021-10-08 06:40:43 +00:00
Bret Curtis
8d37d79d6c
Merge pull request #3154 from bosvensson1/patch-29
improves RemoveRedundantNodesVisitor performance for large children vectors
2021-10-07 15:00:38 +02:00
Bo Svensson
08608da62c
optimizer.cpp 2021-10-07 08:29:38 +00:00
AnyOldName3
cf3596fbb4 Add copyright preamble 2021-10-07 00:44:50 +01:00
AnyOldName3
e382f71aea Add implementation of config file parser lifted from Boost 2021-10-07 00:39:23 +01:00
Evil Eye
5037def3b3 Parse local variables sharing a name with a function as variables 2021-10-06 21:27:08 +02:00
Bo Svensson
87d52dc1fd
fixes coverity-ci warning 2021-10-06 10:04:03 +00:00
Bo Svensson
cd4d76f8c5
discard off-screen lights (#3120)
Currently, we run culling tests against all lights in the scene during LightListCallback::pushLightState. We can avoid most of these tests by removing off-screen lights at an earlier stage. We should benchmark the cumulative time spent within LightListCallback::pushLightState before and after this PR.
2021-10-06 11:53:24 +02:00
Bo Svensson
787f91211d resets state updater to apply light settings (#3141)
resets state updater to apply light settings

With this PR we achieve the same effect with fewer lines of code.
2021-10-06 11:21:30 +02:00
psi29a
c3f5e8f968 Merge branch 'lua_transform' into 'master'
3D transforms in Lua

See merge request OpenMW/openmw!1235
2021-10-06 09:21:21 +00:00
elsid
035307b012
Add tests for openmw options
In attempt to document current behaviour. Add commented out checks as desired
behaviour.
2021-10-05 22:51:12 +02:00
fredzio
21dbe314bf Use common function for sync and async case. Now both cases follow the
same flow, synchronous simulation is just a special case.
2021-10-05 15:44:20 +02:00
Bo Svensson
4b1c009ffd
use StateSet define for translucentFramebuffer (#3138)
With this PR we test out osg's shader define system for a somewhat harmless feature. As we can see, our code becomes more concise and efficient in this case. Most importantly, we no longer create unneeded vertex shader objects.
2021-10-05 14:37:08 +02:00
Bo Svensson
b2af81bc18
converts remaining osg::NodeCallback (#3147)
With this PR we convert remaining instantiations of the deprecated osg::NodeCallback in Open MW to SceneUtil::NodeCallback.
2021-10-05 14:21:12 +02:00
Bo Svensson
3f731cd102
attempts to fix spellcasting freezes (#3146)
Firstly, this PR reintroduces commit "Recreate a special case for IntersectionVisitor on QuadTreeWorld" we forgot to reapply while reverting a revert commit. Secondly, in cases we still need to build a view for an intersection visitor, we now use the available `osgUtil::IntersectionVisitor::getReferenceEyePoint` instead of falling back to the origin position that was previously causing long rebuild times.
2021-10-04 22:00:31 +02:00
Bo Svensson
14d15dcfac
cleans up osgacontroller.cpp (#3142)
`handle_stateset` is not needed because `UpdateMatrixTransform` is a `NodeCallback` only allowed to be set on a `Node`. `Geode` and `Drawable` do not need explicit logic because they are both derived from `Node`.
2021-10-04 12:20:33 +02:00
Bo Svensson
aaf7b423d6
adds a replacement for osg::NodeCallback (#3144)
* nodecallback.hpp

* lightmanager.hpp

* lightmanager.cpp

* lightmanager.hpp

* nodecallback.hpp

* nodecallback.hpp

* [ci skip]

* lightmanager.hpp

* nodecallback.hpp

* nodecallback.hpp

* lightmanager.cpp

* lightmanager.cpp

* nodecallback.hpp

* [ci skip]

* [ci skip]

* controller.cpp

* [ci skip]

* osgacontroller.cpp

* keyframe.hpp

* controller.hpp

* keyframe.hpp

* [ci skip]

* keyframe.hpp

* animation.hpp

* [ci skip]

* weaponanimation.cpp

* nodecallback.hpp
2021-10-04 10:56:55 +02:00
psi29a
2c8c36fe5d Merge branch 'master' into 'effective_magic'
# Conflicts:
#   CHANGELOG.md
2021-10-01 21:20:08 +00:00
Bo Svensson
2568f119a4
reapplies PR without npe (#3137)
* avoids creating empty statesets on drawables

Currently, we attempt to skip creating state on drawable nodes when this state matches the default state. This attempt is incomplete because we still create an avoidable empty stateset in the default case.

* renderingmanager.cpp

* nifloader.cpp

* nifloader.cpp

* shadervisitor.cpp
2021-10-01 10:11:00 +02:00
Petr Mikheev
24ecdc37a7 Fix crash in LuaUtil::ScriptsContainer::~ScriptsContainer() 2021-09-30 03:01:38 +02:00
Evil Eye
dc1fe62dde Overhaul magic effects to work with onApply and onEnd events 2021-09-29 19:25:10 +02:00
Andrei Kortunov
e109d86489 Revert "avoids creating empty statesets on drawables (#3132)"
This reverts commit 957c25a491.
2021-09-29 21:01:22 +04:00
Bret Curtis
b7c1d9edb0 remove unnecessary includes 2021-09-29 17:13:40 +02:00
Bo Svensson
d8707a763f
fixes build (#3134)
* quadtreeworld.cpp

* renderingmanager.cpp [ci skip]

* quadtreeworld.hpp

* cellborder.hpp

* cellborder.cpp
2021-09-29 17:10:58 +02:00
Bret Curtis
803195a05f add back some explicit includes 2021-09-29 16:29:10 +02:00
Bo Svensson
8358418555
set the correct program link parameters (#3110)
* shadermanager.hpp setProgramTemplate

* shadermanager.hpp

* shadermanager.cpp setProgramTemplate

* shadervisitor.hpp setProgramTemplate

* shadervisitor.cpp setProgramTemplate

* scenemanager.cpp setProgramTemplate

* scenemanager.hpp setProgramTemplate

* renderingmanager.cpp

* groundcover.cpp setProgramTemplate

* groundcover.hpp

* groundcover.cpp

* shadervisitor.cpp

* util.cpp

* lightmanager.cpp

* scenemanager.cpp

* scenemanager.hpp

* lightmanager.cpp

* lightmanager.cpp

* lightmanager.cpp

* scenemanager.hpp [ci skip]

* water.cpp

* groundcover.cpp

* shadermanager.hpp
2021-09-29 15:40:37 +02:00
Bo Svensson
957c25a491
avoids creating empty statesets on drawables (#3132)
* avoids creating empty statesets on drawables

Currently, we attempt to skip creating state on drawable nodes when this state matches the default state. This attempt is incomplete because we still create an avoidable empty stateset in the default case.

* renderingmanager.cpp

* nifloader.cpp
2021-09-29 09:58:19 +02:00
Andrei Kortunov
fc2076db1a
Fix MSVC warnings about local variables redeclaration (#3130) 2021-09-29 09:36:05 +02:00
Petr Mikheev
48538d5cef 3D transforms in Lua 2021-09-28 20:37:47 +02:00
psi29a
5794a3b346 Merge branch 'lua_raycasting' into 'master'
Lua raycasting

Closes #6098

See merge request OpenMW/openmw!1175
2021-09-28 08:50:40 +00:00
Bo Svensson
e41fe7573a
avoids creating empty statesets for collada nodes (#3128)
* avoids creating empty statesets for collada nodes

With this PR we avoid creating empty statesets for collada nodes which will be detrimental to osg's draw performance.

* scenemanager.cpp
2021-09-28 10:17:12 +02:00
Petr Mikheev
fb3917fc1a Lua callbacks 2021-09-28 09:36:23 +02:00
Bo Svensson
5fde6867a2
removes unused code (#3129)
* scenemanager.cpp

* scenemanager.hpp

* scenemanager.cpp

* stats.cpp

* renderingmanager.cpp
2021-09-28 09:07:49 +02:00
Bret Curtis
9fabf99250 remove mDebugChunks from chunkManager 2021-09-27 21:38:12 +02:00
Bo Svensson
01cc61087b
improves paging preloader (#3126)
* Return check for distance when we try to reuse data

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* cellpreloader.cpp

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* quadtreeworld.cpp

* chunkmanager.cpp

* chunkmanager.cpp

* cellpreloader.cpp

* jvoisin

* whitespace

* whitespace
2021-09-27 21:32:18 +02:00
Bo Svensson
3f68ddd8f4
alternate debug chunks (#3127)
* quadtreeworld.cpp

* chunkmanager.cpp

* chunkmanager.hpp

* quadtreeworld.hpp

* chunkmanager.cpp

* quadtreeworld.cpp

* quadtreeworld.cpp

* quadtreeworld.cpp [ci skip]

* quadtreeworld.hpp

* quadtreeworld.cpp

* quadtreeworld.cpp

* quadtreeworld.cpp

* chunkmanager.cpp

* chunkmanager.cpp
2021-09-27 21:25:39 +02:00
psi29a
782e0710af Merge branch 'OpenCS-preserve-blocked' into 'master'
OpenCS - Preserve "blocked" record flags when saving. #6288

Closes #6288

See merge request OpenMW/openmw!1052
2021-09-27 19:21:20 +00:00
psi29a
47eda85b9f Merge branch 'master' into 'the_goal_is_elevation'
# Conflicts:
#   CHANGELOG.md
2021-09-27 19:10:33 +00:00
Bo Svensson
c6f7137ee1
fixes bugs with share state (#3111)
* optimizer.cpp merge fix

* objectpaging.cpp

* optimizer.hpp setSharedStateManager

* optimizer.cpp shareState

* scenemanager.cpp shareState

* scenemanager.cpp

* optimizer.cpp

* optimizer.cpp

* scenemanager.cpp

* optimizer.cpp
2021-09-27 20:41:24 +02:00
Evil Eye
c679565893 Make names starting with digits use normal name parsing code 2021-09-26 22:13:53 +02:00
Petr Mikheev
413ac067ec Allow creating omwaddons without a dependency on an omwgame 2021-09-26 17:44:28 +02:00
psi29a
aa11238be1 Merge branch 'colladaalphatest' into 'master'
Collada alpha testing

See merge request OpenMW/openmw!1177
2021-09-26 15:26:02 +00:00
elsid
98a7d90ee2
Assume SIGSTKSZ is not a constant
SIGSTKSZ is not defined as constant since glibc 2.34:
https://sourceware.org/git/?p=glibc.git;a=commit;h=6c57d320484988e87e446e2e60ce42816bf51d53
2021-09-24 19:45:43 +02:00
Cédric Mocquillon
b676d93e03 Use a pair of iterator to represents a range for directory listing 2021-09-24 14:17:34 +02:00
Bo Svensson
d38c8c6dcb
optimise chunk drawing order (#3116)
* material.cpp

* material.cpp
2021-09-21 22:41:07 +02:00
Evil Eye
786b6b7c9a Merge branch 'lua_util' into 'master'
Move LuaState::makeReadOnly(sol::table) out of the class

See merge request OpenMW/openmw!1229
2021-09-21 15:14:09 +00:00
unelsson
67894349a9 Add a check for OPAQUE_BIN 2021-09-19 22:38:07 +03:00
unelsson
f2a894024a Change debug levels 2021-09-19 22:38:07 +03:00
unelsson
ec0b36d21d Don't make a new osg::depth to alpha tested node 2021-09-19 22:38:07 +03:00
unelsson
96f02ab32c Per-material alpha testing for collada 2021-09-19 22:38:07 +03:00
unelsson
40497d6fe5 Set depth testing for alpha blend & test, depth writes off for blend. 2021-09-19 22:38:07 +03:00
unelsson
b3d1d106af Collada alpha testing and uniforms 2021-09-19 22:38:07 +03:00
Evil Eye
6d7cb38834 Remove duplicate GetSquareRoot implementation 2021-09-19 19:53:38 +02:00
Petr Mikheev
2f25257a3e Move LuaState::makeReadOnly(sol::table) out of the class because it doesn't need to access LuaState internals. 2021-09-19 14:38:27 +02:00
Bo Svensson
095f4b2ed5
material.cpp (#3117) 2021-09-19 13:13:28 +02:00
Bret Curtis
8d86d90782 remove whitespace 2021-09-18 22:00:26 +02:00
Bo Svensson
179f91276a
lightmanager.cpp (#3121) 2021-09-18 18:21:11 +02:00
psi29a
68db9869f5 Merge branch 'DistantTerrainDebugChunks' into 'master'
Debug terrain chunks

See merge request OpenMW/openmw!1169
2021-09-18 15:21:26 +00:00
psi29a
18f5762a76 Merge branch 'master' into 'OpenCS-preserve-blocked'
# Conflicts:
#   CHANGELOG.md
2021-09-18 15:20:26 +00:00
elsid
b9825afb8a
Fix build with system static OpenSceneGraph
* Add dependency to libraries required by OSG but missing when linking with OSG
  system library.
* Use find_package for already defined dependencies.
2021-09-17 19:59:11 +02:00
Bo Svensson
f62adab43a
Avoid the terrain sync completely in most cases (#3103)
We can take elsid's commit 605cb8d further by avoiding the terrain sync completely in most cases. Currently in changeCellGrid we wait for a new preloading task to ensure the getPagedRefnums for the new active cells have been filled in by object paging. This is usually not necessary because we have already completed a preload in the past containing these active cells. With this PR we remember what we preloaded and skip the terrain sync if it is not needed.
2021-09-16 22:11:19 +02:00
psi29a
24d1c2b5fa Merge branch 'recurse_directory_iterator' into 'master'
VFS manager refactoring

See merge request OpenMW/openmw!1218
2021-09-15 07:20:52 +00:00
psi29a
7e3ed9605b Merge branch 'qt_moc_notes' into 'master'
Remove 'no relevant classes' moc warning. Fix: #6201

Closes #6201

See merge request OpenMW/openmw!1206
2021-09-15 07:08:25 +00:00
Cédric Mocquillon
6817282097 Move getFileExtension to common header and use instead of repeating same code 2021-09-14 18:09:55 +02:00
Cédric Mocquillon
c2df0949e2 Change normalizeFilename signature 2021-09-14 18:09:55 +02:00
Cédric Mocquillon
d4e26746a3 Use recurse subdirectory iterator to iterate over the VFS without exposing internal details 2021-09-14 18:09:54 +02:00
Bo Svensson
2cebd19432
shadervisitor.cpp 2021-09-14 11:37:23 +00:00
Bo Svensson
3415f12e12
shadervisitor.cpp 2021-09-14 11:30:07 +00:00
pi03k
e4eeb9cce9 Remove 'no relevant classes' moc warning 2021-09-14 11:20:18 +02:00
Bo Svensson
6d12a240a3
shadervisitor.cpp uniform 2021-09-12 09:23:36 +00:00
Bo Svensson
52a9b4d989
shadowsbin.cpp uniform 2021-09-12 09:21:10 +00:00
Cédric Mocquillon
d7352ded36 Add configurable color and offset 2021-09-11 21:53:05 +02:00
Cédric Mocquillon
4b7d0bba53 Avoid adding redundant osg;;Group in non debug mode 2021-09-11 21:53:04 +02:00
Cédric Mocquillon
98a0819d52 Debug terrain chunks 2021-09-11 21:53:04 +02:00
Bo Svensson
ac72f3d636
reduces virtual function calls in a hotspot of cache retrieval (#3100)
* chunkmanager.cpp static_cast [ci skip]

* groundcover.cpp static_cast [ci skip]

* Update objectpaging.cpp

objectpaging.cpp static_cast [ci skip]
2021-09-10 17:58:57 +02:00
psi29a
01a8998e3b return if source is null in mergeUserData 2021-09-10 14:04:11 +00:00
Bo Svensson
9d661359a1
Groundcover consolidation (#3096)
* chunkmanager.hpp viewdistance

* chunkmanager.cpp viewdistance

* chunkmanager.hpp viewdistance

* quadtreeworld.cpp viewdistance

* quadtreeworld.cpp consolidate

* quadtreeworld.hpp consolidate

* renderingmanager.cpp groundcover consolidate

* renderingmanager.hpp groundcover consolidate

* renderingmanager.cpp updater move

* renderingmanager.hpp updater move

* groundcover.hpp activegrid consolidation

* groundcover.cpp activegrid consolidation

* settings-default.cfg dead settings remove

* viewdata.cpp revert

* wrong file paste mistake

* wrong file paste mistake

* wrong file paste mistake

* renderingmanager.cpp updatecallback fix

* renderingmanager.cpp namespace fix

* groundcover.hpp redefinition fix

* groundcover.cpp redefinition fix

* renderingmanager.cpp crash fix

* renderingmanager.cpp euclidean groundcover distance

* viewdata.hpp getreusedistance

* quadtreeworld.cpp reusedistance

* groundcover.rst [ci skip]
2021-09-09 23:10:22 +02:00
Bo Svensson
afba1884ab
clone.cpp remove dynamic_cast (#3097) 2021-09-09 23:04:11 +02:00
Bo Svensson
147ed39900
This PR solves a crash with Robert's bodies logged on your bugtracker. (#3095)
* attach.cpp [ci skip]

* attach.cpp [ci skip]

* attach.cpp [ci skip]

* npcanimation.cpp [ci skip]

* attach.hpp [ci skip]

* attach.cpp [ci skip]

* creatureanimation.cpp [ci skip]

* creatureanimation.cpp [ci skip]

* cellpreloader.cpp

* npcanimation.cpp

* attach.cpp

* make android adk happy

* make android adk happy

* changelog.md [ci skip]

* authors.md [ci skip]
2021-09-09 22:56:57 +02:00
psi29a
ac3fda0b3d Merge branch 'string_view' into 'master'
Pass std::string_view instead of const std::string&

See merge request OpenMW/openmw!1209
2021-09-09 20:41:16 +00:00
elsid
6b7434ca69
Pass std::string_view instead of const std::string&
* Starting with Actor::getBodyPartMesh and ending with
  Misc::StringUtils::ciEqual.
* Add tests for Misc::StringUtils::ciEqual.
2021-09-09 18:39:50 +02:00
Bret Curtis
0eb753767f
Merge pull request #3098 from bosvensson1/findbynamevisitor
visitor.cpp early out
2021-09-09 11:52:09 +02:00
Bo Svensson
d36c373cc7
visitor.cpp early out 2021-09-08 17:23:35 +00:00
elsid
605cb8db7c
Make sync terrain preloading sleep free
This reduces average time spent on in. 5 milliseconds as a base precision is
quite a lot considering that for 60 FPS frame time is 1000/16 = ~16.67 ms
when it's a cell loading frame and there is more important work to do rather
than sleeping.
2021-09-07 14:52:42 +02:00
elsid
b0f772af40
Define dependency to OSG plugins in one place
Each binary depending on components library requires OSG plugins to be linked.
Duplicating dependecies for each binary does not give benefits and brings
problems when new binary is added.
2021-09-06 22:44:52 +02:00
jvoisin
cb08f490d7 Sprinkle some const-ref in loop
This was done on the good advices of clang-tidy
2021-09-04 20:50:59 +02:00
Petr Mikheev
76320aae45 Merge branch 'const_ret_val' into 'master'
Don't use `const` for objects returned by value.

See merge request OpenMW/openmw!1183
2021-09-04 12:41:52 +00:00
jvoisin
d4e3575f1d Don't use const for objects returned by value.
This prevents the usage of std::move semantics,
and makes clang-tidy sad.
2021-09-01 22:23:50 +02:00
Petr Mikheev
33d4d88447 Function LuaUtil::toString 2021-08-31 09:41:58 +02:00
jvoisin
deb2af6acc Dont copy-construct from a const-ref when used only as a const-ref
This also makes clang-tiny a bit happier
2021-08-29 20:22:34 +02:00
cc9cii
7227a83e60 Preserve "blocked" record flags when saving with OpenCS. This will help outputs of OpenCS to be used with vanilla Morrowind.
Sample use case: users are using the Morrowind Code Patch feature that allows modders to enable this flag to differentiate editor-made potions from player crafted potions for tooltips.
2021-08-28 09:42:54 +10:00
psi29a
e8057d9fd1 Merge branch 'aipursue_path' into 'master'
Make AiPursue path destination to be as close as possible to target (#6211)

Closes #6211

See merge request OpenMW/openmw!1154
2021-08-26 07:55:12 +00:00
elsid
ee63ee9d93
Fix coverity warning
CID 332936 (#1 of 1): Result is not floating-point (UNINTENDED_INTEGER_DIVISION)
integer_division: Dividing integer expressions size and 2, and then converting
the integer quotient to type float. Any remainder, or fractional part of the
quotient, is ignored.
2021-08-25 18:34:45 +02:00
psi29a
7cc58fa20d Merge branch 'navmesh_fix_remove_tiles' into 'master'
Fix removing navmesh tiles at high player speed

See merge request OpenMW/openmw!1151
2021-08-25 13:27:14 +00:00
Alexei Dobrohotov
0922d0b105 Clean up text key extraction 2021-08-22 05:56:30 +03:00
psi29a
9751717b35 Merge branch 'components_qt' into 'master'
Do no link binaries with Qt where it's not used

See merge request OpenMW/openmw!1157
2021-08-20 19:29:42 +00:00
elsid
0066c446f8
Remove navmesh tiles outside allowed range first
* Change job change type to remove when tile is outside allowed range.
* Swap try number and change type in job priority. To make sure remove jobs
  always processed before any other.
2021-08-20 20:16:59 +02:00
elsid
0f11acf709
Report more stats from AsyncNavMeshUpdater 2021-08-20 20:16:59 +02:00
elsid
431501e23a
Remove redundant job distribution between threads
Instead don't take jobs from queue until job for the same tile is processing.
2021-08-20 20:16:56 +02:00
elsid
e9b8933b2f
Do no link binaries with Qt where it's not used
Define components_qt static library with all qt dependent components that also
depends on other components. Link only cs, wizard and launcher with qt
dependent components.
2021-08-20 19:02:09 +02:00
psi29a
f3b634807f Merge branch 'fix_asan_warning' into 'master'
Fix ASAN warning

See merge request OpenMW/openmw!1159
2021-08-20 07:23:37 +00:00
elsid
277a1268c0
Avoid access to removed map item
To fix ASAN warning:
=11799==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000436058 at pc 0x55c90acccaa8 bp 0x7f787eeac830 sp 0x7f787eeac820
READ of size 8 at 0x60c000436058 thread T18
    #0 0x55c90acccaa7 in std::operator==(std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&, std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&) /usr/include/c++/11.1.0/bits/stl_deque.h:269
    #1 0x55c90acccaa7 in std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >::empty() const /usr/include/c++/11.1.0/bits/stl_deque.h:1311
    #2 0x55c90acccaa7 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:350
    #3 0x55c90acccaa7 in wait_until<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> >, DetourNavigator::AsyncNavMeshUpdater::getNextJob()::<lambda()> > /usr/include/c++/11.1.0/condition_variable:151
    #4 0x55c90acccaa7 in wait_for<long int, std::ratio<1, 1000>, DetourNavigator::AsyncNavMeshUpdater::getNextJob()::<lambda()> > /usr/include/c++/11.1.0/condition_variable:175
    #5 0x55c90acccaa7 in DetourNavigator::AsyncNavMeshUpdater::getNextJob() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:353
    #6 0x55c90accdb2d in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:257
    #7 0x55c90acce464 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:98
    #8 0x55c90acce464 in __invoke_impl<void, DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61
    #9 0x55c90acce464 in __invoke<DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96
    #10 0x55c90acce464 in _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253
    #11 0x55c90acce464 in operator() /usr/include/c++/11.1.0/bits/std_thread.h:260
    #12 0x55c90acce464 in _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211
    #13 0x7f78c38fd3c3 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82
    #14 0x7f78c36b1258 in start_thread (/usr/lib/libpthread.so.0+0x9258)
    #15 0x7f78c35da5e2 in __GI___clone (/usr/lib/libc.so.6+0xfe5e2)

0x60c000436058 is located 88 bytes inside of 120-byte region [0x60c000436000,0x60c000436078)
freed by thread T0 here:
    #0 0x7f78c688cd69 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172
    #1 0x55c90acdbe20 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::deallocate(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*, unsigned long) /usr/include/c++/11.1.0/ext/new_allocator.h:139
    #2 0x55c90acdbe20 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > > >::deallocate(std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >&, std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:492
    #3 0x55c90acdbe20 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_put_node(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:565
    #4 0x55c90acdbe20 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_drop_node(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:632
    #5 0x55c90acdbe20 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_erase(std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >*) /usr/include/c++/11.1.0/bits/stl_tree.h:1889
    #6 0x55c90acc0569 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::clear() /usr/include/c++/11.1.0/bits/stl_tree.h:1254
    #7 0x55c90acc0569 in std::map<std:🧵:id, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::clear() /usr/include/c++/11.1.0/bits/stl_map.h:1134
    #8 0x55c90acc0569 in DetourNavigator::AsyncNavMeshUpdater::~AsyncNavMeshUpdater() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:105
    #9 0x55c90acab2dc in DetourNavigator::NavigatorImpl::~NavigatorImpl() (/home/elsid/dev/openmw/build/gcc/asan/openmw+0x2d152dc)
    #10 0x55c9097db4b5 in std::default_delete<DetourNavigator::Navigator>::operator()(DetourNavigator::Navigator*) const /usr/include/c++/11.1.0/bits/unique_ptr.h:85
    #11 0x55c9097db4b5 in std::unique_ptr<DetourNavigator::Navigator, std::default_delete<DetourNavigator::Navigator> >::~unique_ptr() /usr/include/c++/11.1.0/bits/unique_ptr.h:361
    #12 0x55c9097db4b5 in MWWorld::World::~World() /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:534
    #13 0x55c9097dc3a4 in MWWorld::World::~World() /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:534
    #14 0x55c90a1925e4 in MWBase::Environment::cleanup() /home/elsid/dev/openmw/apps/openmw/mwbase/environment.cpp:192
    #15 0x55c90a1f544d in OMW::Engine::~Engine() /home/elsid/dev/openmw/apps/openmw/engine.cpp:434
    #16 0x55c90a1f6700 in OMW::Engine::~Engine() /home/elsid/dev/openmw/apps/openmw/engine.cpp:455
    #17 0x55c90a19d523 in std::default_delete<OMW::Engine>::operator()(OMW::Engine*) const /usr/include/c++/11.1.0/bits/unique_ptr.h:85
    #18 0x55c90a19d523 in std::unique_ptr<OMW::Engine, std::default_delete<OMW::Engine> >::~unique_ptr() /usr/include/c++/11.1.0/bits/unique_ptr.h:361
    #19 0x55c90a19d523 in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:320
    #20 0x55c90a955634 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    #21 0x55c90a193be0 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    #22 0x7f78c3503b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

previously allocated by thread T18 here:
    #0 0x7f78c688bca1 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55c90ace8c73 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::allocate(unsigned long, void const*) /usr/include/c++/11.1.0/ext/new_allocator.h:121
    #2 0x55c90ace8c73 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >&, unsigned long) /usr/include/c++/11.1.0/bits/alloc_traits.h:460
    #3 0x55c90ace8c73 in std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_get_node() /usr/include/c++/11.1.0/bits/stl_tree.h:561
    #4 0x55c90ace8c73 in std::_Rb_tree_node<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >* std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:611
    #5 0x55c90ace8c73 in std::_Rb_tree_iterator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > std::_Rb_tree<std:🧵:id, std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > >, std::_Select1st<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > >, std::piecewise_construct_t const&, std::tuple<std:🧵:id const&>&&, std::tuple<>&&) /usr/include/c++/11.1.0/bits/stl_tree.h:2429
    #6 0x55c90accc5fb in std::map<std:🧵:id, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > >, std::less<std:🧵:id>, std::allocator<std::pair<std:🧵:id const, std::deque<std::_List_iterator<DetourNavigator::Job>, std::allocator<std::_List_iterator<DetourNavigator::Job> > > > > >::operator[](std:🧵:id const&) /usr/include/c++/11.1.0/bits/stl_map.h:501
    #7 0x55c90accc5fb in DetourNavigator::AsyncNavMeshUpdater::getNextJob() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:344
    #8 0x55c90accdb2d in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:257
    #9 0x55c90acce464 in operator() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:98
    #10 0x55c90acce464 in __invoke_impl<void, DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61
    #11 0x55c90acce464 in __invoke<DetourNavigator::AsyncNavMeshUpdater::AsyncNavMeshUpdater(const DetourNavigator::Settings&, DetourNavigator::TileCachedRecastMeshManager&, DetourNavigator::OffMeshConnectionsManager&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96
    #12 0x55c90acce464 in _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253
    #13 0x55c90acce464 in operator() /usr/include/c++/11.1.0/bits/std_thread.h:260
    #14 0x55c90acce464 in _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211
    #15 0x7f78c38fd3c3 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82

Thread T18 created by T0 here:
    #0 0x7f78c682bfa7 in __interceptor_pthread_create /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x7f78c38fd6aa in std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State> >, void (*)()) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663
    #2 0x55c90ae008d1 in DetourNavigator::NavMeshManager::NavMeshManager(DetourNavigator::Settings const&) /home/elsid/dev/openmw/components/detournavigator/navmeshmanager.cpp:47
    #3 0x55c90aca3bfe in DetourNavigator::NavigatorImpl::NavigatorImpl(DetourNavigator::Settings const&) /home/elsid/dev/openmw/components/detournavigator/navigatorimpl.cpp:13
    #4 0x55c9097d9e6f in MWWorld::World::World(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, Files::Collections const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ToUTF8::Utf8Encoder*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/apps/openmw/mwworld/worldimp.cpp:196
    #5 0x55c90a1e9992 in OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:789
    #6 0x55c90a1ed138 in OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949
    #7 0x55c90a19d4cb in runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316
    #8 0x55c90a955634 in wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205
    #9 0x55c90a193be0 in main /home/elsid/dev/openmw/apps/openmw/main.cpp:328
    #10 0x7f78c3503b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)

SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/c++/11.1.0/bits/stl_deque.h:269 in std::operator==(std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&, std::_Deque_iterator<std::_List_iterator<DetourNavigator::Job>, std::_List_iterator<DetourNavigator::Job>&, std::_List_iterator<DetourNavigator::Job>*> const&)
Shadow bytes around the buggy address:
  0x0c188007ebb0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c188007ebc0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c188007ebd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c188007ebe0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ebf0: 00 00 00 00 00 00 07 fa fa fa fa fa fa fa fa fa
=>0x0c188007ec00: fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fa
  0x0c188007ec10: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ec20: 00 00 00 00 00 00 02 fa fa fa fa fa fa fa fa fa
  0x0c188007ec30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c188007ec40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c188007ec50: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==11799==ABORTING
2021-08-19 23:24:47 +02:00
elsid
fea4fb6e69
Make AiPursue path destination to be as close as possible to target
Even when target is not reachable actor will try to run there either because
target navmesh polygon is selected within extended area or because partial path
is built to the closest possible polygon.
2021-08-18 23:44:36 +02:00
glassmancody.info
d63eb3325f fix coverity warning and build on some osg 2021-08-17 17:45:50 -07:00
psi29a
6360bdc859 Merge branch 'navmesh_job' into 'master'
Store async navmesh jobs in the same container until they are processed

See merge request OpenMW/openmw!1131
2021-08-17 09:20:54 +00:00
psi29a
6595c731f7 Merge branch 'fix_rc_poly_mesh_flags_length' into 'master'
Fix flags length for rcPolyMesh

See merge request OpenMW/openmw!1134
2021-08-17 09:19:32 +00:00
psi29a
faa3e04494 Merge branch 'const_reff' into 'master'
Sprinkle some const-ref

See merge request OpenMW/openmw!1145
2021-08-17 08:20:13 +00:00
jvoisin
5793f5cf18 Sprinkle a couple of std::move and a const 2021-08-16 13:11:22 +02:00
jvoisin
7a015d24c6 Sprinkle some const-ref 2021-08-15 19:50:28 +02:00
jvoisin
b01ef2629c Fix two Wreorder clang warnings 2021-08-13 13:59:57 +02:00
psi29a
508682cda7 Merge branch 'serialize' into 'master'
Serialize NifOsg::MatrixTransform children properly

See merge request OpenMW/openmw!1127
2021-08-13 08:18:03 +00:00
Alexei Dobrohotov
839cf36bdd Merge branch 'hidden_markers' into 'master'
Use common implementation to filter hidden markers

See merge request OpenMW/openmw!1132
2021-08-12 22:29:20 +00:00
elsid
46fa3ce083
Fix flags length for rcPolyMesh
recastnavigation documentation of rcPolyMesh is misleading. It says flags field
length is maxpolys when actually it's allocated as npolys.
2021-08-12 22:43:06 +02:00
elsid
54a676f2e3
Add functions to get length of recast type arrays
To avoid duplicating same formulas in multiple places.
2021-08-12 22:43:01 +02:00
elsid
05258ed644
Remove redundant TileCachedRecastMeshManager::hasTile function
It's used only for tests. getMesh is a valid replacement.
2021-08-12 22:40:06 +02:00
elsid
8ac8d56e8c
Mark TileCachedRecastMeshManager member functions as const where possible 2021-08-12 22:39:25 +02:00
elsid
3caf45807f
Use common implementation to filter hidden markers 2021-08-12 22:35:16 +02:00
elsid
09b1a2e3c6
Make unchanging Job fields const 2021-08-12 22:25:25 +02:00
elsid
21ce4fe637
Use structured binding 2021-08-12 22:25:25 +02:00
elsid
8bca9eec80
Use single set to store pushed tiles 2021-08-12 22:25:24 +02:00
elsid
a97b2ced27
Use single map to store last updates 2021-08-12 22:25:24 +02:00
elsid
bfcc430822
Use single map to store processing tiles 2021-08-12 22:25:24 +02:00
elsid
902b0f9f84
Store jobs in the same container until they are processed
Push to queue and reorder only iterators.
2021-08-12 22:24:02 +02:00
elsid
8db640289c
Use single set to store pushed jobs for tiles 2021-08-12 22:05:44 +02:00
elsid
a99266a60e
Do not measure total navmesh generation duration
This is not a useful thing anymore.
2021-08-12 21:44:10 +02:00
elsid
9460a8760e
Move operator<< for UpdateNavMeshStatus to header 2021-08-12 20:23:57 +02:00
Alexei Dobrohotov
b49f51cbfc Serialize NifOsg::MatrixTransform children properly 2021-08-12 18:33:06 +03:00
psi29a
ee1ec53cd9 Merge branch 'fix_op_bzzt_whoopsie_2' into 'master'
Fixing another bzzt whoopsie

See merge request OpenMW/openmw!1118
2021-08-10 15:51:12 +00:00
Bret Curtis
436c640da2 the old switch-a-roo because we shoudl only StopTraversal when the node size is larger than 1 and not the other way around 2021-08-09 22:56:04 +02:00
Bret Curtis
c99bddc8dc Revert "Move reference to the right cell according to its geographical position"
This reverts commit d0677c3f07.
2021-08-09 22:11:00 +02:00
Alexei Dobrohotov
956edca524 Don't re-enable specularity w/ material controller for MW models 2021-08-09 21:17:13 +03:00
elsid
94e71d9b14
Avoid division by zero 2021-08-09 17:58:33 +02:00
elsid
0985d8e03d
Handle failed NavMesh allocation 2021-08-09 17:54:19 +02:00
elsid
a6260453ea
Add missing initialization 2021-08-09 17:54:19 +02:00
jvoisin
586d8684d0 Fix two coverity issues about uninitialised variables 2021-08-09 12:43:30 +02:00
psi29a
8ad3d3d792 Merge branch 'freezeandcool' into 'master'
Don't use FreezeOnCull for any particle system (#4744)

Closes #4744

See merge request OpenMW/openmw!1103
2021-08-08 12:35:26 +00:00
psi29a
d939916369 Merge branch 'navmesh_save_cache_capacity' into 'master'
Do not cache navmesh when only object transformation is changed

See merge request OpenMW/openmw!1101
2021-08-08 12:31:58 +00:00
elsid
86e6d3dac8
Do not cache navmesh when only object transformation is changed
This saves cache capacity when a scene contains objects contantly transforming
by scripts and causing changes in navmesh. The probability to get cache hit for
such states is almost zero because even a constant change in a single float
value may give up to 2^32 different states.
2021-08-08 02:38:20 +02:00
Alexei Dobrohotov
1fc7cb8191 Don't use FreezeOnCull for any particle system (#4744) 2021-08-08 03:36:35 +03:00
elsid
3cbe93358a
Move dtNavMeshParams initialization to where it's required 2021-08-08 02:30:48 +02:00
elsid
fa1fb2a6b5
Reset mIsReleased before starting threads
To fix TSAN warning:

WARNING: ThreadSanitizer: data race (pid=68597)
  Write of size 1 at 0x7b3800079234 by main thread:
    #0 SceneUtil::WorkQueue::start(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:51 (openmw+0x10daa10)
    #1 SceneUtil::WorkQueue::WorkQueue(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:39 (openmw+0x10dad97)
    #2 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb5a)
    #3 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    #4 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    #5 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    #6 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)

  Previous read of size 1 at 0x7b3800079234 by thread T10 (mutexes: write M19275778865205896):
    #0 SceneUtil::WorkQueue::removeWorkItem() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:86 (openmw+0x10d9e51)
    #1 SceneUtil::WorkThread::run() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:127 (openmw+0x10da52a)
    #2 operator() /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:114 (openmw+0x10da664)
    #3 __invoke_impl<void, SceneUtil::WorkThread::WorkThread(SceneUtil::WorkQueue&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:61 (openmw+0x10da664)
    #4 __invoke<SceneUtil::WorkThread::WorkThread(SceneUtil::WorkQueue&)::<lambda()> > /usr/include/c++/11.1.0/bits/invoke.h:96 (openmw+0x10da664)
    #5 _M_invoke<0> /usr/include/c++/11.1.0/bits/std_thread.h:253 (openmw+0x10da664)
    #6 operator() /usr/include/c++/11.1.0/bits/std_thread.h:260 (openmw+0x10da664)
    #7 _M_run /usr/include/c++/11.1.0/bits/std_thread.h:211 (openmw+0x10da664)
    #8 execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:82 (libstdc++.so.6+0xd33c3)

  Location is heap block of size 216 at 0x7b3800079220 allocated by main thread:
    #0 operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x91824)
    #1 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb4c)
    #2 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    #3 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    #4 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    #5 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)

  Mutex M19275778865205896 is already destroyed.

  Thread T10 (tid=68609, running) created by main thread at:
    #0 pthread_create /build/gcc/src/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x61c3a)
    #1 std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State> >, void (*)()) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xd36aa)
    #2 std::_MakeUniq<SceneUtil::WorkThread>::__single_object std::make_unique<SceneUtil::WorkThread, SceneUtil::WorkQueue&>(SceneUtil::WorkQueue&) /usr/include/c++/11.1.0/bits/unique_ptr.h:962 (openmw+0x10da987)
    #3 SceneUtil::WorkQueue::start(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:50 (openmw+0x10da987)
    #4 SceneUtil::WorkQueue::WorkQueue(unsigned long) /home/elsid/dev/openmw/components/sceneutil/workqueue.cpp:39 (openmw+0x10dad97)
    #5 OMW::Engine::prepareEngine(Settings::Manager&) /home/elsid/dev/openmw/apps/openmw/engine.cpp:700 (openmw+0xf7cb5a)
    #6 OMW::Engine::go() /home/elsid/dev/openmw/apps/openmw/engine.cpp:949 (openmw+0xf82688)
    #7 runApplication(int, char**) /home/elsid/dev/openmw/apps/openmw/main.cpp:316 (openmw+0xf62611)
    #8 wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/elsid/dev/openmw/components/debug/debugging.cpp:205 (openmw+0x125df1c)
    #9 main /home/elsid/dev/openmw/apps/openmw/main.cpp:328 (openmw+0x596323)
2021-08-08 02:28:59 +02:00
elsid
41b02ff1aa
Copy only required RecastMeshObject fields 2021-08-07 12:38:01 +02:00
elsid
c91ef34a70
Avoid using a specific type for stored ref_ptr to extend lifetime 2021-08-07 12:20:55 +02:00
glassmancody.info
cdf5b315c3 fix mac runner undefined macro 2021-08-05 16:52:40 -07:00
glassmancody.info
09e03fde2e refactor and fix wobbly shores 2021-08-04 17:49:57 -07:00
glassmancody.info
cad0b151cb enable shaders path and dehardcode depth formats 2021-08-04 17:39:11 -07:00
glassmancody.info
b457dfd8b8 fix water RTTs and minor math error in non-infinite projection matrix 2021-08-04 17:39:11 -07:00
glassmancody.info
70fac33940 initial reverse-z depth implementation 2021-08-04 17:39:11 -07:00
Petr Mikheev
a94072243b Lua command core.quit 2021-08-04 19:14:24 +03:00
psi29a
9b7e14ec00 Merge branch 'OpenCS-moved-reference' into 'master'
OpenCS - Fix moved reference - Issues #3514 and #4752

See merge request OpenMW/openmw!1051

(cherry picked from commit 2bee171c7990522da33c2667f7d079fa35f4ede0)

36c30f7f Fix for Issue #3514 where moving a reference to another cell is not handled properly.
40327681 Update the changelog.
2021-08-03 23:29:05 +00:00
psi29a
e10e9c0005 Merge branch 'navmesh_reduce_lock_wait' into 'master'
Reduce waiting duration on locks when updating navmesh object in the main thread (#6193)

Closes #6193

See merge request OpenMW/openmw!1079
2021-08-03 23:05:39 +00:00
Petr Mikheev
3ce5e9e680 Improve error messages in components/lua/serialization.cpp 2021-08-03 16:42:26 +03:00
elsid
050b7d31aa
Create RecastMesh outside critical section
To not lock main thread when it tries to update objects.
2021-08-03 12:21:56 +02:00
elsid
c8987bda2f
Store reference to BulletShapeInstance for btCollisionShape
To keep btCollisionShape lifetime.
2021-08-03 12:21:56 +02:00
elsid
4574e5f565
Remove redundant Navigator API functions 2021-08-03 12:21:55 +02:00
glassmancody.info
1e52ca2b64 properly initialize light settings 2021-08-01 23:46:45 -07:00
AnyOldName3
4727ae4b3b Make it possible to opt out of composing variables 2021-08-01 02:47:10 +01:00
fredzio
c76387162b Add projectiles number to the resources stats 2021-07-31 23:08:50 +02:00
Cédric Mocquillon
d0677c3f07 Move reference to the right cell according to its geographical position 2021-07-30 18:28:29 +02:00
psi29a
8c36eb56cf Merge branch 'stereo_friendly_water' into 'master'
Stereo friendly water and statesetupdater

See merge request OpenMW/openmw!563
2021-07-30 11:00:49 +00:00
Alexei Dobrohotov
11694ba87f Correct dark map and detail map alpha handling
Comment texenv usage in NIF loader
2021-07-29 04:48:59 +03:00
Alexei Dobrohotov
66a1adc31e Handle NiExtraData *properly* 2021-07-27 07:58:57 +03:00
madsbuvi
41c08b1c3b Stereo friendly StateSetUpdater
(cherry picked from commit 496b3aef88b8fd867dcdd23a6ca43144573b1b2f)

Stereo friendly water

(cherry picked from commit 0e22c55e48a7f965367d3d430c1bef5357b22748)

Option to disable per view mapping.

Include memory header

De-hardcode settings and buffers.

formatting error

Update water.cpp (whitespace)

Update water.cpp (more whitespace)

include render order

c array -> c++ array
2021-07-26 14:01:02 +02:00
psi29a
44ceb9572a Merge branch 'recast_mesh_heightfield' into 'master'
Reduce navmesh cache size by special handling for heightfields

See merge request OpenMW/openmw!1032
2021-07-26 11:49:30 +00:00
Alexei Dobrohotov
d5ab6e40ab Handle NiExtraData 2021-07-26 04:46:03 +03:00
elsid
9a5ec5fd03
Store heightfields as array of heights instead of triangles
To reduce size of RecastMesh and therefore cache size.
2021-07-26 00:22:21 +02:00
elsid
fdee9db20c
Consider RecastMeshManager not empty when there is water 2021-07-26 00:22:21 +02:00
elsid
24b802b3d8
Simplify adding water to recast mesh
Remove redundant computations and conversions.
2021-07-26 00:22:21 +02:00
elsid
5d6c93566d
Rename DetourNavigator::Water -> Cell 2021-07-26 00:22:21 +02:00
elsid
753767d6d9
Store only water shift
Rotation is not used.
2021-07-26 00:22:20 +02:00
elsid
da4ec31cd8
Remove redundant RecastMeshManager::Water 2021-07-26 00:22:20 +02:00
elsid
a1549321d7
Move Water struct out of RecastMesh class 2021-07-26 00:22:20 +02:00
elsid
d60edb36aa
Make RecastMesh independent from recast scale factor
To avoid scaling until it's required by delaying coordinates conversion until
navmesh generation.
2021-07-26 00:22:20 +02:00
elsid
af7059373c
Make RecastMesh independent from the order of RecastMeshBuilder calls
To make sure RecastMesh objects are equal if built with the same data but in
different order. Will be used later when there will be more than one place
building RecasMesh objects.
2021-07-26 00:22:20 +02:00
elsid
07c70dfb73
Remove unused local variables 2021-07-26 00:22:20 +02:00
psi29a
6949dd89c2 Merge branch 'gui_shaders' into 'master'
Add shader path for mygui (#6162)

See merge request OpenMW/openmw!1019
2021-07-25 21:37:39 +00:00
psi29a
56939b478e Merge branch 'windowing-system-cleanup' into 'master'
sdlcursormanager: Clarify ANDROID check

See merge request OpenMW/openmw!556
2021-07-25 21:01:06 +00:00
glassmancody.info
e8c6f31e0c add shader path for mygui (#6162) 2021-07-22 15:55:30 -07:00
Evil Eye
5f84494046 Fail on invalid water levels 2021-07-21 16:00:25 +00:00
jvoisin
7b32458aec Improve a bit two esmreader logging call 2021-07-21 15:38:41 +02:00
elsid
d2b935684d
Add missing include 2021-07-21 11:37:50 +02:00
AnyOldName3
5ec2ddb4a0 Actually increment iterators to be erased. 2021-07-17 20:47:55 +01:00
psi29a
22068eed6b Merge branch 'navmesh_cache_without_off_mesh' into 'master'
Do not use off mesh connections as a part of navmesh cache key

See merge request OpenMW/openmw!1016
2021-07-16 08:40:56 +00:00
elsid
beeb882ea8
Do not use off mesh connections as a part of navmesh cache key
To reduce cache size and make it more flexible.

Adding off mesh connections to the navmesh is the last step of navmesh
generation and it's very fast comparing to other steps (microseconds vs
milliseconds). Having less cache size makes get and set operations almost 2x
times faster that also have an order of microseconds. So in total there is
no performance impact.
2021-07-14 12:19:17 +02:00
elsid
aec4e02417
Ignore only CellRefs with preceding MVRF subrecord
MVRF subrecord means that only single following FRMR subrecord is moved not the
rest of subrecords.
2021-07-12 18:56:45 +02:00
elsid
cfdbd0d471
Indicate moved cell refs explicitly
This is less error prone approach than use of MovedCellRef fields.

Also make separate functions for skipping and reading moved cell refs to avoid
passing special flags  logic and null pointers for unused arguments.
2021-07-12 18:56:42 +02:00
psi29a
223216733d Merge branch 'coverity_fix' into 'master'
Fix some coverity issues

See merge request OpenMW/openmw!1013
2021-07-12 14:06:44 +00:00
psi29a
1da644668f Merge branch 'fix_work_queue' into 'master'
Fix hang on exit (#6145)

Closes #6145

See merge request OpenMW/openmw!1004
2021-07-12 13:33:16 +00:00
Petr Mikheev
8ff8ec4abd Fix coverity issues 2021-07-12 12:51:25 +02:00
elsid
d4a2dab9d9
Remove redundant else 2021-07-12 11:41:21 +02:00
elsid
eece47f70e
Avoid copying osg::ref_ptr when adding or removing item from work queue
Copy constructor does refcounting, and move constructor doesn't.
2021-07-12 11:41:21 +02:00
elsid
b8fcd6d3ba
Manage work item lifetime on the client side
Instead of explicit work queue stop before any possibly used engine manager
is destructed. Based on an assumption that any engine manager can be destructed
independently from the work queue destruction. This model is already used in
CellPreloader that conflicts with explicit work queue stop.

After the work queue is requested to be stopped, any client waiting for a not
started work item to be done will wait forever because the work item is dropped
from the queue. Therefore either clients should not wait for own work items to
be completed in destructor or the work queue should not drop items before
clients are destructed. Other approaches are possible but are not considered
due to increasing complexity.

CellPreloader already tries to wait for all created work items to be done so
keep it that way and extend the model to AsyncScreenCaptureOperation and Scene.
Additionally abort all scheduled work items when owner is destructed. This
prevents a long exit when multiple screenshots are scheduled right before
exiting the game.
2021-07-12 11:41:14 +02:00
jvoisin
5aaac8e47e Reduce a bit the size of getHT
Factoring common code parts outside of a template
is apparently a good practise to reduce code duplication
(and the size of openmw by around 0.5%),
and should improve a bit the performances,
since the whole `std::to_string` * 2 + string concatenation
dance results in quite a lot of code, preventing inlining on my machine.
2021-07-11 21:43:40 +02:00
elsid
36ec877a8e
Add missing include from sol/sol.hpp 2021-07-10 01:01:50 +02:00
Petr Mikheev
702eb19271 Fixes and refactoring 2021-07-09 20:48:54 +02:00
Petr Mikheev
cc7dbabd19 Change argument of onKeyPress 2021-07-09 20:48:54 +02:00
Petr Mikheev
d5cda61855 Console command "reload lua" 2021-07-09 20:24:56 +02:00
Petr Mikheev
8c6d303730 Saving/loading for Lua scripts (saves format is changed) 2021-07-09 20:24:56 +02:00
Petr Mikheev
6db2450c90 Initial support of generated RefNums with negative mContentFile. 2021-07-09 20:03:27 +02:00
Petr Mikheev
b53667d555 Queries. Data structures and lua bindings. 2021-07-09 20:03:27 +02:00
Petr Mikheev
479856f812 Add components/lua/scriptscontainer and components/esm/luascripts 2021-07-09 20:03:27 +02:00
Petr Mikheev
8dbaf6022c Add components/lua/serilalization 2021-07-09 20:03:27 +02:00
Petr Mikheev
4b068b27ca Add components/lua/luastate and components/lua/utilpackage 2021-07-09 20:03:27 +02:00
elsid
5103120eef
Notify about saved screenshot
Show message about saved screenshot via schedule message box. Since screenshot
saving happens not in the main thread calling messageBox directly is unsafe.
WindowManager::scheduleMessageBox delays message box showing until next update
in the main thread.
2021-07-08 21:14:01 +02:00
elsid
f7a6be053d
Stop engine work queue before destructing environment
To avoid access to null and dangling pointers from active work items on
quitting.
2021-07-08 21:14:01 +02:00
elsid
f8e02000ec
Write screenshots to file asynchronously 2021-07-08 21:13:57 +02:00
elsid
33aa4d0822
Move WriteScreenshotToFileOperation to components 2021-07-08 20:27:19 +02:00
Evil Eye
eced6f2126 Implement the help command 2021-07-07 18:48:25 +02:00
psi29a
c372c239a6 Merge branch 'master' into 'OpenCS_Bug6017'
# Conflicts:
#   CHANGELOG.md
2021-07-06 07:52:49 +00:00
cc9cii
a47ebf5c9e For consistency with TES CS, force DELE record writes to be 4 bytes (currently writes 1 byte). 2021-07-06 14:57:58 +10:00
cc9cii
fea1ac2c0f Remove dead code from commit 024ad3276b. 2021-07-06 14:21:17 +10:00
cc9cii
f68c81e631 Merge branch 'master' into 'OpenCS_Bug6017' 2021-07-06 03:10:46 +00:00
cc9cii
4b3de46bfa Use enums in place of magic numbers. Ensure Creature and NPC cell references are always saved as persistent. 2021-07-06 12:37:02 +10:00
Simon Meulenbeek
625744298b change setValue to replace value instead of insert 2021-07-05 13:22:46 +00:00
psi29a
94be4eba18 Merge branch 'even-fixier-alpha' into 'master'
Correctly track added and removed state to fix various alpha testing issues

Closes #6119

See merge request OpenMW/openmw!989
2021-07-05 08:15:17 +00:00
psi29a
f2aeabed72 Merge branch 'navmesh_memory' into 'master'
Reduce memory usage by navmesh

See merge request OpenMW/openmw!994
2021-07-05 06:16:11 +00:00
AnyOldName3
84a9facedf Disable coverage adjustment for blended objects 2021-07-04 23:29:22 +01:00
AnyOldName3
e42b3bf960 Adapt destination alpha factor for AMD
As discussed in the comment, it's unclear to me whether this is a driver
bug or mandatory behaviour only AMD implement.

Some more context is here:
https://gitlab.com/OpenMW/openmw/-/issues/6119#note_618245903
2021-07-04 23:00:33 +01:00
elsid
09f9075842
Use RecastMeshBuilder once to create RecastMesh
This allows to move all data out of the object instead of copying.
2021-07-04 22:18:05 +02:00
elsid
0193c95b26
Shrink to fit recast mesh data 2021-07-04 22:18:05 +02:00
elsid
91cece5cc4
Define ESM::Land static constants as constexpr
To avoid linking issues.
2021-07-04 22:17:44 +02:00
AnyOldName3
0e57622bbe Correctly track added and removed state 2021-07-03 21:04:17 +01:00
elsid
94e460ba1e
Use proper check for distance
To avoid invalid results for r < 1.
2021-06-30 20:11:41 +02:00
elsid
a54c4bc2e9
Check dtNavMeshQuery::findStraightPath status 2021-06-30 20:10:57 +02:00
elsid
793c30ab8d
Check dtNavMeshQuery::getPolyHeight status
Otherwise when it fails a node with zero height will be added to a path.
2021-06-30 20:06:48 +02:00
elsid
7e1630a7ad
Remove redundant getPolyHeight wrapper 2021-06-30 20:04:16 +02:00
elsid
cc08a45c31
Move include where it is needed 2021-06-30 20:02:08 +02:00
elsid
a3942a1e0a
Remove redundant check for y coordinate in inRange function 2021-06-30 20:00:43 +02:00
cc9cii
f2a301653c Remove redundant mPersistent member from ESM::NPC and ESM::Creature, replaced by mRecordFlags. Fixed the editing of the persistence flag value. 2021-06-30 08:20:29 +10:00
jvoisin
5c02e4dddc Delete an outdated/irrelevant comment 2021-06-29 22:52:40 +02:00
Evil Eye
48f915f1fe Merge branch 'fontloader' into 'master'
Clean the fontloader's hack for polish font up

See merge request OpenMW/openmw!895
2021-06-29 19:15:06 +00:00
Petr Mikheev
890eaabd4f Merge branch 'clamp' into 'master'
Minor refactor making use of std::clamp

See merge request OpenMW/openmw!972
2021-06-29 18:14:12 +00:00
Petr Mikheev
4b98d460da Merge branch 'const_moar' into 'master'
Sprinkle some const ref

See merge request OpenMW/openmw!963
2021-06-29 17:28:51 +00:00
jvoisin
8561245fda Minor refactor making use of std::clamp 2021-06-29 18:43:47 +02:00
jvoisin
5470b3168b Use a switch-case instead of a map, on elsid@' advice
elsid@ said:

> From my measurements static map + exceptions is slower than original code
when loading polish morrowind localization by 25% with GCC 10.2.0. Switch-based
solution is about 25x times faster than the original and static map with find
only is ~20x faster.
2021-06-29 18:24:40 +02:00
jvoisin
770f91de77 Clean the fontloader's hack for polish font up
- The map can be static and const
- The map can be initialized inline
- No need to do a `find` + `[]` instead of `at`
2021-06-29 18:24:40 +02:00
cc9cii
2a76634f5f Moved persistence flag from references to the header flags of referenceables (e.g. Static, Weapon, etc). Editing widget is not fully working. 2021-06-29 23:25:26 +10:00
cc9cii
024ad3276b Partial fix for #6017. The persistence flag of the references are saved but it is not yet possible to modify it via OpenCS. 2021-06-29 19:20:01 +10:00
Evil Eye
4f264af5a9 Merge branch 'staticsload' into 'master'
Loads statics before actors II (#5379)

See merge request OpenMW/openmw!588
2021-06-28 20:25:51 +00:00
psi29a
67f32263b2 Merge branch 'fix_malexa_escape' into 'master'
Inscribe physical bounding box into navmesh agent cylinder (#6114)

Closes #6114

See merge request OpenMW/openmw!967
2021-06-28 14:26:08 +00:00
psi29a
07a7a903a7 Merge branch 'alpha-test-override' into 'master'
Ensure original (removed) state overrides replacement state when recreating shaders

Closes #6108

See merge request OpenMW/openmw!966
2021-06-28 13:54:28 +00:00
fredzio
c795e0bce6 Some actors are supposed to spawn on an object that belongs to an adjacent cell.
Since actors can be active in 3x3 grid around the player, we need to
first load all objects in a 5x5 grid around the player.

Split load and unloading in 2 phases. Add an mInactiveCells set into the
scene, which contains all cells inside the aforementioned 5x5 grid.
These cells contains only heightfields and non-animated physics objects.

Animated objects are tied to the scene graph, which doesn't exists yet
in these cells, so we skip them.
2021-06-28 09:36:04 +02:00
AnyOldName3
2147c18cf5 Do not overwrite old removed state with old dummy state 2021-06-28 00:11:31 +01:00
elsid
1552e7e3e3
Add pathgrid edges as one direction off mesh connection 2021-06-27 17:48:44 +02:00
elsid
ff1af5e8ec
Use only off mesh connections starting or ending in a given tile 2021-06-27 17:48:41 +02:00
elsid
a8ba9a0e2a
Cleanup unused tile positions from OffMeshConnectionsManager 2021-06-27 17:48:07 +02:00
elsid
81e569c3d9
Move OffMeshConnectionsManager implementation into cpp 2021-06-27 17:48:07 +02:00
elsid
7f65a2c4c2
Remove unused code 2021-06-27 17:48:07 +02:00
elsid
3e98db8d60
Fix styleguide 2021-06-27 17:48:06 +02:00
elsid
84d6dea277
Inscribe physical bounding box into navmesh agent cylinder
To disallow too narrow navmesh for a bounding box.
2021-06-27 13:44:38 +02:00
AnyOldName3
0e122b1e3d Avoid copy and deep equality check 2021-06-27 01:48:06 +01:00
AnyOldName3
8a1b4bde8a Ensure original (removed) state overrides replacement state when recreating shaders
When the shader visitor replaces state (e.g. changes the deprecated
alpha test to a shader-based one) it backs up the original state. If
shaders are recreated, we need to know what the canonical state was and
create shaders to implement that instead of creating shaders to
implement dummy replacement state.

This was actually usually working as the removed state got checked after
the active state, so overwrote anything derived from it. However, if the
active state had the override bit set, that would make it override the
removed state.

Skipping any active state that duplicates removed state fixes this case.

Resolves #6108
2021-06-27 00:12:07 +01:00
jvoisin
9db7d0278a Sprinkle some const ref 2021-06-25 21:54:35 +02:00
jvoisin
2c8f328ac2 Use make_unique instead of unique_ptr+new 2021-06-25 20:55:38 +02:00
Evil Eye
080106e802 Merge branch 'inline' into 'master'
Inline a couple of methods in esmreader.cpp

See merge request OpenMW/openmw!945
2021-06-24 19:56:18 +00:00
jvoisin
b4cfa4328e Merge branch 'keyword_soup' into 'master'
Strip quotes when treating keywords as strings

Closes #6066

See merge request OpenMW/openmw!921
2021-06-24 19:51:58 +00:00
Evil Eye
0998929608 Merge branch 'noreturn' into 'master'
Sprinkle some [[noreturn]] where possible

See merge request OpenMW/openmw!793
2021-06-24 19:21:29 +00:00
Evil Eye
822e331f64 Merge branch 'list_resources' into 'master'
Minor optimisation in VFS::FileSystemArchive::listResources

See merge request OpenMW/openmw!932
2021-06-24 19:11:46 +00:00
Evil Eye
2be27da791 Merge branch 'const_refs' into 'master'
Add a ton of const refs

See merge request OpenMW/openmw!954
2021-06-24 18:57:41 +00:00
Evil Eye
9f7980ecd7 Merge branch 'refenreces' into 'master'
Sprinkle some references where it makes sense

See merge request OpenMW/openmw!952
2021-06-24 17:40:36 +00:00
Evil Eye
1a421c3b2e Merge branch 'multicast' into 'master'
Fix two excessive type casting instances

See merge request OpenMW/openmw!953
2021-06-24 17:32:25 +00:00
Evil Eye
7e9785941c Merge branch 'default' into 'master'
Use `default` instead of empty constructors/destructors

See merge request OpenMW/openmw!957
2021-06-24 17:19:02 +00:00
Evil Eye
87c46fb3de Merge branch 'useless_check' into 'master'
Simplify NodeMapVisitor::apply

See merge request OpenMW/openmw!955
2021-06-24 17:12:40 +00:00
jvoisin
cf11870b1c Sprinkle some references where it makes sense 2021-06-24 00:28:09 +02:00
jvoisin
5840279f16 Use default instead of empty constructors/destructors
See https://pvs-studio.com/en/docs/warnings/v832/ for details
2021-06-24 00:26:15 +02:00
jvoisin
b2c170efa0 Use initialization lists where possible 2021-06-23 23:36:43 +02:00
jvoisin
895864099c Simplify NodeMapVisitor::apply
No need to run a find() before a std::replace
2021-06-23 23:29:14 +02:00
jvoisin
1123dc46ee Add a ton of const refs 2021-06-23 23:13:59 +02:00
jvoisin
33e035cc95 Fix two excessive type casting instances
No need to to a string -> char* -> string dance.
2021-06-23 22:19:08 +02:00
jvoisin
5375b8e71b Minor optimisation in VFS::FileSystemArchive::listResources
When there is no cache, we can fill the `out`
variable as we create it, instead of creating the
cache, and then iterating it to fill `out`.

Thanks to @cemoc for the help!
2021-06-23 12:46:44 +02:00
Evil Eye
df3a47187b Merge branch 'more_constexpr' into 'master'
Some more constexpr in esm/variant.cpp

See merge request OpenMW/openmw!850
2021-06-22 18:40:06 +00:00
Evil Eye
22f7d4eee2 Strip quotes when treating keywords as strings 2021-06-22 16:54:35 +02:00
jvoisin
4dca2c0466 Replace a handrolled memcpy with an actual call to memcpy 2021-06-22 12:52:29 +02:00
jvoisin
2c3c603be2 Sprinkle some const in components/to_utf8 2021-06-22 12:52:29 +02:00
jvoisin
aec3c74fa5 Sprinkle some [[noreturn]] where possible 2021-06-22 12:51:08 +02:00
jvoisin
17e0c75d30 Some more constexpr in esm/variant.cpp 2021-06-22 12:49:09 +02:00
jvoisin
6140c9c3fd Don't catch exceptions in EsmReader::getExact 2021-06-21 20:06:45 +00:00
jvoisin
cff11fbca9 Inline a couple of methods in esmreader.cpp 2021-06-21 14:22:26 +02:00
Evil Eye
67c8d73fe0 Allow scripts to fail per target 2021-06-19 19:26:55 +02:00
Evil Eye
c1177d7ffe Allow unquoted string arguments to start with . and - 2021-06-19 11:21:37 +02:00
psi29a
afda721d4b Merge branch 'race_floats' into 'master'
Display Race record height/weight as a float

See merge request OpenMW/openmw!880
2021-06-19 00:29:21 +00:00
psi29a
a6b695e15b Merge branch 'esmcleanup' into 'master'
More ESM cleanup

See merge request OpenMW/openmw!903
2021-06-19 00:23:52 +00:00
psi29a
f66196588c Merge branch 'object_paging_min_size_combo_box' into 'master'
Adding Object Paging Min Size combo box to Advanced -> Visuals

See merge request OpenMW/openmw!917
2021-06-19 00:20:29 +00:00
psi29a
7b6fc1a1f1 Merge branch 'name_shaders' into 'master'
Append filename to shader names

See merge request OpenMW/openmw!930
2021-06-19 00:16:36 +00:00
jvoisin
22153cca7b Reduce a bit the code bloat in hot paths/small functions
There is no need to bloat hot/small functions with
a ton of function calls and involving locales
for simple error messages.
2021-06-15 17:57:14 +02:00
Bret Curtis
868a5b35e3 workaround shadow issue on macOS, https://gitlab.com/OpenMW/openmw/-/issues/6057 2021-06-12 00:10:55 +02:00
glassmancody.info
bb834fb44e append filename to shader names 2021-06-05 18:21:03 -07:00
jvoisin
7f4f2c042e Use sizeof(GLfloat) instead of sizeof(GL_FLOAT)
GL_FLOAT is an enum, with the value 0x1406, while GLFloat is the actual type.
Source: https://www.khronos.org/opengl/wiki/OpenGL_Type
2021-06-04 23:21:26 +02:00
Thunderforge
89950e5528 Preventing type conversion of double to float for objectPagingMinSize 2021-05-29 16:27:23 -05:00
elsid
d4f28ac979
Avoid resetting buffer object when configuring light buffer layout
Otherwise this casues RaceSelectionPreview to have no light until first change.
2021-05-28 10:46:42 +02:00
psi29a
9dfba37ce9 Merge branch 'fix_big_object_navmesh_update' into 'master'
Fix overwhelming recast mesh and navmesh updates for big rotating objects (#6060)

Closes #6060

See merge request OpenMW/openmw!911
2021-05-27 21:08:33 +00:00
elsid
4a6961b365
Trigger navmesh update on moved player only when player tile has been changed 2021-05-27 16:52:42 +02:00
elsid
ed91cf9397
Replace unordered_map by map for storing objects
For small amount of items it gives better performance for find by key
for update.
2021-05-27 16:38:40 +02:00
elsid
22c2f106b7
Store object tiles position as sorted vector instead of set 2021-05-27 16:00:31 +02:00
elsid
f4f9fa4701
Limit oscillating recast mesh object AABB by tile bounds
AABB change outside recast mesh tile should not affect navmesh for this tile.
2021-05-27 12:40:29 +02:00
elsid
d122e184cc
Report navmesh change for not posted tiles
Corresponding recast mesh tiles can be updated but navmesh tiles may never
appear for them. Report back zero navmesh version to allow oscillating recast
objects detection to work. This version is always less than any generated
navmesh tile version so any report for generated navmesh will override it.
If zero navmesh version is reported after recast mesh tile got report about
generated navmesh tile it is a no-op since generated version is always greater
than zero.
2021-05-27 12:40:00 +02:00
elsid
3915e5d2cc
Always center loading screen progress bar by height when there is active message box
To fix all possible situations when active message box overlaps with loading
screen progress.

The only used condition to center loading screen progress by height is
number of message boxes > 0. No need to pass it through interface.
LoadingScreen can check it inside setLabel function.
2021-05-26 23:29:37 +02:00
Alexei Dobrohotov
6a7bc208de Merge branch 'dont_assign' into 'master'
Don't assign a variable passed by value

See merge request OpenMW/openmw!897
2021-05-23 22:51:42 +00:00
Dobrohotov Alexei
e68a454fd8 More ESM cleanup 2021-05-23 16:02:05 +03:00
jvoisin
e51669c05d Don't assign a variable passed by value 2021-05-21 18:15:31 +02:00
CedricMocquillon
86d137363e Check if the archive is opened before adding a file to it and clear state on close 2021-05-20 21:28:52 +02:00
CedricMocquillon
b61249841e Update lookup only after sorting files 2021-05-19 18:38:42 +02:00
psi29a
c4fde03542 Merge branch 'ObjectPagingMergeIssue' into 'master'
Share state

See merge request OpenMW/openmw!879
2021-05-19 05:08:12 +00:00
Alexei Dobrohotov
fea5c0ac1a Merge branch 'armour_error_fix' into 'master'
Fixed data subrecord name for Armour record used in error

See merge request OpenMW/openmw!882
2021-05-18 22:02:30 +00:00
CedricMocquillon
d11a6bd92c Share state 2021-05-18 17:57:47 +02:00