add settings for spherical screenshots

0.6.3
Miloslav Číž 7 years ago
parent 8f32114025
commit d763e9fe46

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

@ -627,8 +627,8 @@ namespace MWRender
public: public:
typedef enum typedef enum
{ {
MAPPING_CYLINDRICAL = 0, MAPPING_SPHERICAL = 0,
MAPPING_SPHERICAL, MAPPING_CYLINDRICAL,
MAPPING_SMALL_PLANET MAPPING_SMALL_PLANET
} SphericalScreenshotMapping; } SphericalScreenshotMapping;
@ -762,9 +762,12 @@ namespace MWRender
void RenderingManager::screenshot360(osg::Image* image) void RenderingManager::screenshot360(osg::Image* image)
{ {
int cubeWidth = 1024; int screenshotWidth = Settings::Manager::tryGetInt("s360 width","Video",mViewer->getCamera()->getViewport()->width());
int screenshotWidth = 1600; int screenshotHeight = Settings::Manager::tryGetInt("s360 height","Video",mViewer->getCamera()->getViewport()->height());
int screenshotHeight = 1280; SphericalScreenshot::SphericalScreenshotMapping mapping = static_cast<SphericalScreenshot::SphericalScreenshotMapping>(
Settings::Manager::tryGetInt("s360 mapping","Video",SphericalScreenshot::MAPPING_SPHERICAL));
int cubeWidth = screenshotWidth / 2;
SphericalScreenshot s(cubeWidth); SphericalScreenshot s(cubeWidth);
osg::Vec3 directions[6] = { osg::Vec3 directions[6] = {
@ -791,7 +794,7 @@ namespace MWRender
if (mCamera->isFirstPerson()) if (mCamera->isFirstPerson())
mPlayerAnimation->getObjectRoot()->setNodeMask(1); 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; mFieldOfView = fovBackup;
} }

@ -401,6 +401,18 @@ int Manager::getInt (const std::string& setting, const std::string& category)
return parseInt( getString(setting, 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) bool Manager::getBool (const std::string& setting, const std::string& category)
{ {
return parseBool( getString(setting, category) ); return parseBool( getString(setting, category) );

@ -39,6 +39,7 @@ namespace Settings
///< returns the list of changed settings and then clears it ///< returns the list of changed settings and then clears it
static int getInt (const std::string& setting, const std::string& category); 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 float getFloat (const std::string& setting, const std::string& category);
static std::string getString (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); static bool getBool (const std::string& setting, const std::string& category);

Loading…
Cancel
Save