From d4fd08a63fc696e415957a15d9d06774654059fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 9 Nov 2017 16:49:46 +0100 Subject: [PATCH] save 360 screenshots in the configured directory --- apps/openmw/mwbase/world.hpp | 2 +- apps/openmw/mwinput/inputmanagerimp.cpp | 11 ++++++----- apps/openmw/mwrender/renderingmanager.cpp | 3 ++- apps/openmw/mwrender/renderingmanager.hpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 4 ++-- apps/openmw/mwworld/worldimp.hpp | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 80a9e11a1..6d39229f0 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -450,7 +450,7 @@ namespace MWBase /// \todo this does not belong here virtual void screenshot (osg::Image* image, int w, int h) = 0; - virtual void screenshot360 (osg::Image* image, int w) = 0; + virtual void screenshot360 (osg::Image* image) = 0; /// Find default position inside exterior cell specified by name /// \return false if exterior with given name not exists, true otherwise diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 5d1c236ca..cd2e8408b 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1020,20 +1020,21 @@ namespace MWInput { mScreenCaptureHandler->setFramesToCapture(1); mScreenCaptureHandler->captureNextFrame(*mViewer); - MWBase::Environment::get().getWindowManager()->messageBox ("Screenshot saved"); + MWBase::Environment::get().getWindowManager()->messageBox("Screenshot saved"); } void InputManager::screenshot360() { - int screenshotW = 1024; osg::ref_ptr screenshot (new osg::Image); - MWBase::Environment::get().getWorld()->screenshot360(screenshot.get(), screenshotW); + MWBase::Environment::get().getWorld()->screenshot360(screenshot.get()); +(*mScreenCaptureHandler->getCaptureOperation()) (*(screenshot.get()),0); +/* osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg"); if (!readerwriter) { - std::cerr << "Error: Unable to write screenshot, can't find a jpg ReaderWriter" << std::endl; + std::cerr << "Error: Unable to write 360 degree screenshot, can't find a jpg ReaderWriter" << std::endl; return; } @@ -1048,7 +1049,7 @@ namespace MWInput return; } - outfile.close(); + outfile.close(); */ } void InputManager::toggleInventory() diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index b1f1888d0..4ea602f3f 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -743,8 +743,9 @@ namespace MWRender int mSize; }; - void RenderingManager::screenshot360(osg::Image* image, int w) + void RenderingManager::screenshot360(osg::Image* image) { + int w = 1024; SphericalScreenshot s(w); osg::Vec3 directions[6] = { diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index add7aae4d..e6e2e1c0a 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -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)); - void screenshot360(osg::Image* image, int w); + void screenshot360(osg::Image* image); struct RayResult { diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index f9a030a80..f51f9af3d 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2281,9 +2281,9 @@ namespace MWWorld mRendering->screenshot(image, w, h); } - void World::screenshot360 (osg::Image* image, int w) + void World::screenshot360 (osg::Image* image) { - mRendering->screenshot360(image, w); + mRendering->screenshot360(image); } void World::activateDoor(const MWWorld::Ptr& door) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 1882b88b9..a68982412 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -560,7 +560,7 @@ namespace MWWorld /// \todo this does not belong here void screenshot (osg::Image* image, int w, int h) override; - void screenshot360 (osg::Image* image, int w) override; + void screenshot360 (osg::Image* image) override; /// Find center of exterior cell above land surface /// \return false if exterior with given name not exists, true otherwise