1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-07-21 09:14:05 +00:00

reference screenshot settings only from one place

This commit is contained in:
Miloslav Číž 2017-11-11 14:32:28 +01:00
parent d71d984cfa
commit 4fc532d873
7 changed files with 36 additions and 45 deletions

View file

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

View file

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

View file

@ -773,16 +773,13 @@ namespace MWRender
int mSize; int mSize;
}; };
bool RenderingManager::screenshot360(osg::Image* image) bool RenderingManager::screenshot360(osg::Image* image, std::string settingStr)
{ {
int screenshotW = mViewer->getCamera()->getViewport()->width(); int screenshotW = mViewer->getCamera()->getViewport()->width();
int screenshotH = mViewer->getCamera()->getViewport()->height(); int screenshotH = mViewer->getCamera()->getViewport()->height();
SphericalScreenshot::SphericalScreenshotMapping screenshotMapping = SphericalScreenshot::MAPPING_SPHERICAL; SphericalScreenshot::SphericalScreenshotMapping screenshotMapping = SphericalScreenshot::MAPPING_SPHERICAL;
int cubeSize = screenshotW / 2; int cubeSize = screenshotW / 2;
try
{
std::string settingStr = Settings::Manager::getString("screenshot type","Video");
std::vector<std::string> settingArgs; std::vector<std::string> settingArgs;
boost::algorithm::split(settingArgs,settingStr,boost::is_any_of(" ")); boost::algorithm::split(settingArgs,settingStr,boost::is_any_of(" "));
@ -814,12 +811,6 @@ namespace MWRender
if (settingArgs.size() > 3) if (settingArgs.size() > 3)
cubeSize = std::min(5000,std::atoi(settingArgs[3].c_str())); 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 (mCamera->isVanityOrPreviewModeEnabled()) if (mCamera->isVanityOrPreviewModeEnabled())
{ {

View file

@ -126,7 +126,7 @@ namespace MWRender
/// Take a screenshot of w*h onto the given image, not including the GUI. /// 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)); 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 struct RayResult
{ {

View file

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

View file

@ -2281,9 +2281,9 @@ namespace MWWorld
mRendering->screenshot(image, w, h); 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) void World::activateDoor(const MWWorld::Ptr& door)

View file

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