add settings for spherical screenshots

pull/456/head
Miloslav Číž 7 years ago
parent 8f32114025
commit d763e9fe46

@ -1029,6 +1029,8 @@ namespace MWInput
{
osg::ref_ptr<osg::Image> screenshot (new osg::Image);
MWBase::Environment::get().getWorld()->screenshot360(screenshot.get());
// calling mScreenCaptureHandler->getCaptureOperation() here caused segfault for some reason
(*mScreenCaptureOperation) (*(screenshot.get()),0);
}

@ -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<SphericalScreenshot::SphericalScreenshotMapping>(
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;
}

@ -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) );

@ -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);

Loading…
Cancel
Save