reference screenshot settings only from one place

0.6.3
Miloslav Číž 7 years ago
parent d71d984cfa
commit 4fc532d873

@ -450,7 +450,7 @@ namespace MWBase
/// \todo this does not belong here
virtual void screenshot (osg::Image* image, int w, int h) = 0;
virtual bool screenshot360 (osg::Image* image) = 0;
virtual bool screenshot360 (osg::Image* image, std::string settingStr) = 0;
/// Find default position inside exterior cell specified by name
/// \return false if exterior with given name not exists, true otherwise

@ -1019,11 +1019,12 @@ namespace MWInput
{
bool regularScreenshot = true;
std::string settingStr;
try
{
// FIXME: the same string "screenshot type" is queried here AND in renderingmanager.cpp
std::string s = Settings::Manager::getString("screenshot type","Video");
regularScreenshot = s.size() == 0;
settingStr = Settings::Manager::getString("screenshot type","Video");
regularScreenshot = settingStr.size() == 0;
}
catch (std::runtime_error)
{
@ -1039,7 +1040,7 @@ namespace MWInput
{
osg::ref_ptr<osg::Image> screenshot (new osg::Image);
if (MWBase::Environment::get().getWorld()->screenshot360(screenshot.get()))
if (MWBase::Environment::get().getWorld()->screenshot360(screenshot.get(),settingStr))
(*mScreenCaptureOperation) (*(screenshot.get()),0);
}
}

@ -773,53 +773,44 @@ namespace MWRender
int mSize;
};
bool RenderingManager::screenshot360(osg::Image* image)
bool RenderingManager::screenshot360(osg::Image* image, std::string settingStr)
{
int screenshotW = mViewer->getCamera()->getViewport()->width();
int screenshotH = mViewer->getCamera()->getViewport()->height();
SphericalScreenshot::SphericalScreenshotMapping screenshotMapping = SphericalScreenshot::MAPPING_SPHERICAL;
int cubeSize = screenshotW / 2;
try
{
std::string settingStr = Settings::Manager::getString("screenshot type","Video");
std::vector<std::string> settingArgs;
boost::algorithm::split(settingArgs,settingStr,boost::is_any_of(" "));
if (settingArgs.size() > 0)
{
std::string typeStrings[4] = {"spherical","cylindrical","planet","cubemap"};
bool found = false;
std::vector<std::string> settingArgs;
boost::algorithm::split(settingArgs,settingStr,boost::is_any_of(" "));
for (int i = 0; i < 4; ++i)
if (settingArgs[0].compare(typeStrings[i]) == 0)
{
screenshotMapping = (SphericalScreenshot::SphericalScreenshotMapping) i;
found = true;
break;
}
if (settingArgs.size() > 0)
{
std::string typeStrings[4] = {"spherical","cylindrical","planet","cubemap"};
bool found = false;
if (!found)
for (int i = 0; i < 4; ++i)
if (settingArgs[0].compare(typeStrings[i]) == 0)
{
std::cerr << "Wrong screenshot type: " << settingArgs[0] << "." << std::endl;
return false;
screenshotMapping = (SphericalScreenshot::SphericalScreenshotMapping) i;
found = true;
break;
}
if (!found)
{
std::cerr << "Wrong screenshot type: " << settingArgs[0] << "." << std::endl;
return false;
}
if (settingArgs.size() > 1)
screenshotW = std::min(10000,std::atoi(settingArgs[1].c_str()));
}
if (settingArgs.size() > 1)
screenshotW = std::min(10000,std::atoi(settingArgs[1].c_str()));
if (settingArgs.size() > 2)
screenshotH = std::min(10000,std::atoi(settingArgs[2].c_str()));
if (settingArgs.size() > 2)
screenshotH = std::min(10000,std::atoi(settingArgs[2].c_str()));
if (settingArgs.size() > 3)
cubeSize = std::min(5000,std::atoi(settingArgs[3].c_str()));
}
catch (std::runtime_error)
{
std::cerr << "Wrong parameters for screenshot type." << std::endl;
return false;
}
if (settingArgs.size() > 3)
cubeSize = std::min(5000,std::atoi(settingArgs[3].c_str()));
if (mCamera->isVanityOrPreviewModeEnabled())
{

@ -126,7 +126,7 @@ namespace MWRender
/// Take a screenshot of w*h onto the given image, not including the GUI.
void screenshot(osg::Image* image, int w, int h, osg::Vec3 direction=osg::Vec3(0,0,-1));
bool screenshot360(osg::Image* image);
bool screenshot360(osg::Image* image, std::string settingStr);
struct RayResult
{

@ -357,7 +357,6 @@ private:
osg::ref_ptr<osg::Texture2D> mReflectionTexture;
osg::ref_ptr<ClipCullNode> mClipCullNode;
osg::ref_ptr<osg::Node> mScene;
bool mReflectActors;
};
/// DepthClampCallback enables GL_DEPTH_CLAMP for the current draw, if supported.

@ -2281,9 +2281,9 @@ namespace MWWorld
mRendering->screenshot(image, w, h);
}
bool World::screenshot360(osg::Image* image)
bool World::screenshot360(osg::Image* image, std::string settingStr)
{
return mRendering->screenshot360(image);
return mRendering->screenshot360(image,settingStr);
}
void World::activateDoor(const MWWorld::Ptr& door)

@ -560,7 +560,7 @@ namespace MWWorld
/// \todo this does not belong here
void screenshot (osg::Image* image, int w, int h) override;
bool screenshot360 (osg::Image* image) override;
bool screenshot360 (osg::Image* image, std::string settingStr) override;
/// Find center of exterior cell above land surface
/// \return false if exterior with given name not exists, true otherwise

Loading…
Cancel
Save