(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
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.
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.
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.
Before this change LightBuffer copy constructor copied only mData pointer into
a new object. Then memcpy was applied to an overlapping source and destination
that is UB.
Replace configureLayout function by a special constructor. That copies all
mData values and a pointer to a buffer object into a newly allocated object.
When game exit is requests when initial loading screen is active LightManager
can be destructed in the main thread before LightManagerStateAttribute::apply
is completed by different thread. Given that it uses raw pointer at some point
it becomes dangling because object is destructed this leads to UB and eventual
SIGSEGV.
Fixes build errors with older OSG builds and some issues with 'shared' layout.
Bring back ambient in inventory through lightmodel instead of sun ambient, mirrors scene ambient/sunlight relationship.
Forces shaders when certain lighting methods are enabled and finalize settings.
Correctly override sun for localmap.
The docs seem to imply this is automatic when the array contains a
class-type, which osg::ref_ptr is, but I got a crash log that doesn't
make sense if that's true.
Previously, it would edit the odd numbered stateset, then regenerate
shaders for the even-numbered one, then edit the even numbered one, and
regenerate shaders for the odd numbered one (or vice versa if it
finished during an even numbered frame). This would leave one of the
shader programs still trying to use the state that had been removed.
As we don't reconfigure all shaders without shadows when we disable them
indoors (as it'd probably add a hitch to transitioning in and out) we
need to set up dummy state so the shaders don't do anything illegal.
This hadn't had symptoms for most objects as when indoors, nearly
everything would be drawn first in one of the water RTTs, which had
dummy state to disable shadows already. This wasn't true of the water
plane itself, though, yet somehow it took until just now for anyone to
report that.
This resolves vtastek's issue where the water would be invisible indoors
Make sure it copies all relevant drawable parent nodes (e.g. including the node with the environment map effect)
Make sure it doesn't copy nodes multiple times
Properly apply transformations to both switch and LOD nodes
Allow both NiSwitchNode and NiLODNode to be the root node
Properly add CollisionSwitch into the scene graph
Previously we always discarded shadow map fragments if the alpha channel of the output would have been low, but there were some (modded) assets that have non-one alpha but have testing or blending disabled so end up opaque anyway. This lets the shadows of those objects match.
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3127:9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall]
addAnotherShadowMap();
^
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3094:5: note: Loop condition is true. Entering loop body
for (int i = 0; i < 2; ++i)
^
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3094:5: note: Loop condition is true. Entering loop body
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3094:5: note: Loop condition is false. Execution continues on line 3102
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3126:21: note: Assuming 'i' is < 'numberOfShadowMapsPerLight'
for (int i = 0; i < numberOfShadowMapsPerLight; ++i)
^
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3126:5: note: Loop condition is true. Entering loop body
for (int i = 0; i < numberOfShadowMapsPerLight; ++i)
^
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3127:9: note: This constructor of an object of type 'DebugHUD' has not returned when the virtual method was called
addAnotherShadowMap();
^
/home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3127:9: note: Call to virtual function during construction
/home/elsid/dev/openmw/components/sceneutil/shadow.cpp💯9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall]
setupShadowSettings();
^
/home/elsid/dev/openmw/components/sceneutil/shadow.cpp💯9: note: This constructor of an object of type 'ShadowManager' has not returned when the virtual method was called
/home/elsid/dev/openmw/components/sceneutil/shadow.cpp💯9: note: Call to virtual function during construction
/home/elsid/dev/openmw/components/sceneutil/shadow.cpp:104:9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall]
enableOutdoorMode();
^
/home/elsid/dev/openmw/components/sceneutil/shadow.cpp:104:9: note: This constructor of an object of type 'ShadowManager' has not returned when the virtual method was called
/home/elsid/dev/openmw/components/sceneutil/shadow.cpp:104:9: note: Call to virtual function during construction
Fixes compile error encountered on OSX 10.9 with g++
sophie:build pineapple$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
The compilation error:
[ 24%] Building CXX object apps/openmw/CMakeFiles/openmw.dir/mwrender/renderingmanager.cpp.o
In file included from /Users/pineapple/git/openmw/apps/openmw/mwrender/renderingmanager.cpp:1:
In file included from /Users/pineapple/git/openmw/apps/openmw/mwrender/renderingmanager.hpp:4:
/Users/pineapple/git/openmw/openmw-deps/include/osg/ref_ptr:35:36: error: member access into incomplete type 'SceneUtil::UnrefWorkItem'
~ref_ptr() { if (_ptr) _ptr->unref(); _ptr = 0; }
^
/Users/pineapple/git/openmw/./components/sceneutil/unrefqueue.hpp:14:11: note: in instantiation of member function
'osg::ref_ptr<SceneUtil::UnrefWorkItem>::~ref_ptr' requested here
class UnrefQueue : public osg::Referenced
^
/Users/pineapple/git/openmw/./components/sceneutil/unrefqueue.hpp:10:11: note: forward declaration of 'SceneUtil::UnrefWorkItem'
class UnrefWorkItem;
To fix warnings:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/bits/shared_ptr_base.h:588:8: warning: delete called on non-final 'NifOsg::ControllerFunction' that has virtual functions but non-virtual destructor
[-Wdelete-non-virtual-dtor]
delete __p;
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/bits/shared_ptr_base.h:595:4: note: in instantiation of function template specialization
'std::__shared_count<__gnu_cxx::_S_atomic>::__shared_count<NifOsg::ControllerFunction *>' requested here
: __shared_count(__p)
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/bits/shared_ptr_base.h:1079:17: note: in instantiation of function template specialization
'std::__shared_count<__gnu_cxx::_S_atomic>::__shared_count<NifOsg::ControllerFunction *>' requested here
: _M_ptr(__p), _M_refcount(__p, typename is_array<_Tp>::type())
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/bits/shared_ptr.h:129:25: note: in instantiation of function template specialization 'std::__shared_ptr<NifOsg::ControllerFunction,
__gnu_cxx::_S_atomic>::__shared_ptr<NifOsg::ControllerFunction, void>' requested here
shared_ptr(_Yp* __p) : __shared_ptr<_Tp>(__p) { }
^
/home/elsid/dev/openmw/components/nifosg/nifloader.cpp:242:39: note: in instantiation of function template specialization 'std::shared_ptr<NifOsg::ControllerFunction>::shared_ptr<NifOsg::ControllerFunction, void>' requested here
callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key)));
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/bits/unique_ptr.h:78:2: warning: delete called on non-final 'MWGui::ResponseCallback' that has virtual functions but non-virtual destructor
[-Wdelete-non-virtual-dtor]
delete __ptr;
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/bits/unique_ptr.h:268:4: note: in instantiation of member function 'std::default_delete<MWGui::ResponseCallback>::operator()' requested here
get_deleter()(__ptr);
^
/home/elsid/dev/openmw/apps/openmw/mwgui/dialogue.cpp:58:23: note: in instantiation of member function 'std::unique_ptr<MWGui::ResponseCallback, std::default_delete<MWGui::ResponseCallback> >::~unique_ptr' requested here
PersuasionDialog::PersuasionDialog(ResponseCallback* callback)
^