diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index a21bc549a..2f5f0ef5d 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -805,7 +805,9 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) // Stereo shader technique can be set up now. mStereoView->setStereoTechnique(Misc::getStereoTechnique()); mStereoView->initializeScene(); - mStereoView->setCullMask(mViewer->getCamera()->getCullMask() & ~MWRender::VisMask::Mask_GUI); + + if (mEnvironment.getVrMode()) + mStereoView->setCullMask(mStereoView->getCullMask() & ~MWRender::VisMask::Mask_GUI); } window->setStore(mEnvironment.getWorld()->getStore()); diff --git a/components/misc/stereo.cpp b/components/misc/stereo.cpp index 8fabed8ea..e688ca8cc 100644 --- a/components/misc/stereo.cpp +++ b/components/misc/stereo.cpp @@ -266,6 +266,7 @@ namespace Misc , mMasterConfig(new SharedShadowMapConfig) , mSlaveConfig(new SharedShadowMapConfig) , mSharedShadowMaps(Settings::Manager::getBool("shared shadow maps", "Stereo")) + , mUpdateViewCallback(new DefaultUpdateViewCallback) { mMasterConfig->_id = "STEREO"; mMasterConfig->_master = true; @@ -485,13 +486,12 @@ namespace Misc View right{}; double near_ = 1.f; double far_ = 10000.f; - auto updateViewCallback = mUpdateViewCallback.lock(); - if (!updateViewCallback) + if (!mUpdateViewCallback) { Log(Debug::Error) << "StereoView: No update view callback. Stereo rendering will not work."; return; } - updateViewCallback->updateView(left, right); + mUpdateViewCallback->updateView(left, right); near_ = Settings::Manager::getFloat("near clip", "Camera"); far_ = Settings::Manager::getFloat("viewing distance", "Camera"); @@ -683,8 +683,8 @@ namespace Misc { left.pose.position = osg::Vec3(-2.2, 0, 0); right.pose.position = osg::Vec3(2.2, 0, 0); - left.fov = { -0.767549932, 0.620896876, -0.837898076, 0.726982594 }; - right.fov = { -0.620896876, 0.767549932, -0.837898076, 0.726982594 }; + left.fov = { -0.767549932, 0.620896876, 0.726982594, -0.837898076 }; + right.fov = { -0.620896876, 0.767549932, 0.726982594, -0.837898076 }; } void StereoView::setInitialDrawCallback(osg::ref_ptr cb) diff --git a/components/misc/stereo.hpp b/components/misc/stereo.hpp index ef821c0f3..e658f3c60 100644 --- a/components/misc/stereo.hpp +++ b/components/misc/stereo.hpp @@ -173,7 +173,7 @@ namespace Misc bool flipViewOrder{ true }; // Updates stereo configuration during the update pass - std::weak_ptr mUpdateViewCallback{}; + std::shared_ptr mUpdateViewCallback; // OSG camera callbacks set using set*callback. StereoView manages that these are always set on the appropriate camera(s); osg::ref_ptr mCullCallback{ nullptr };