diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index e1c85744e..9ea1f8e16 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1029,6 +1029,8 @@ namespace MWInput { osg::ref_ptr screenshot (new osg::Image); MWBase::Environment::get().getWorld()->screenshot360(screenshot.get()); + + // calling mScreenCaptureHandler->getCaptureOperation() here caused segfault for some reason (*mScreenCaptureOperation) (*(screenshot.get()),0); } diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index a08e7a0a2..bac150459 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -627,8 +627,8 @@ namespace MWRender public: typedef enum { - MAPPING_CYLINDRICAL = 0, - MAPPING_SPHERICAL, + MAPPING_SPHERICAL = 0, + MAPPING_CYLINDRICAL, MAPPING_SMALL_PLANET } SphericalScreenshotMapping; @@ -762,9 +762,12 @@ namespace MWRender void RenderingManager::screenshot360(osg::Image* image) { - int cubeWidth = 1024; - int screenshotWidth = 1600; - int screenshotHeight = 1280; + int screenshotWidth = Settings::Manager::tryGetInt("s360 width","Video",mViewer->getCamera()->getViewport()->width()); + int screenshotHeight = Settings::Manager::tryGetInt("s360 height","Video",mViewer->getCamera()->getViewport()->height()); + SphericalScreenshot::SphericalScreenshotMapping mapping = static_cast( + Settings::Manager::tryGetInt("s360 mapping","Video",SphericalScreenshot::MAPPING_SPHERICAL)); + + int cubeWidth = screenshotWidth / 2; SphericalScreenshot s(cubeWidth); osg::Vec3 directions[6] = { @@ -791,7 +794,7 @@ namespace MWRender if (mCamera->isFirstPerson()) mPlayerAnimation->getObjectRoot()->setNodeMask(1); - s.create(image,screenshotWidth,screenshotHeight,SphericalScreenshot::MAPPING_SPHERICAL); + s.create(image,screenshotWidth,mapping != SphericalScreenshot::MAPPING_SMALL_PLANET ? screenshotHeight : screenshotWidth,mapping); mFieldOfView = fovBackup; } diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index e93642ee2..4e250974a 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -401,6 +401,18 @@ int Manager::getInt (const std::string& setting, const std::string& category) return parseInt( getString(setting, category) ); } +int Manager::tryGetInt (const std::string &setting, const std::string& category, int defaultValue) +{ + try + { + return getInt(setting,category); + } + catch (std::runtime_error) + { + return defaultValue; + } +} + bool Manager::getBool (const std::string& setting, const std::string& category) { return parseBool( getString(setting, category) ); diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index 7adcb9b39..9e80c21a6 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -39,6 +39,7 @@ namespace Settings ///< returns the list of changed settings and then clears it static int getInt (const std::string& setting, const std::string& category); + static int tryGetInt (const std::string &setting, const std::string& category, int defaultValue); static float getFloat (const std::string& setting, const std::string& category); static std::string getString (const std::string& setting, const std::string& category); static bool getBool (const std::string& setting, const std::string& category);