save 360 screenshots in the configured directory

0.6.3
Miloslav Číž 7 years ago
parent 1b97a541f4
commit d4fd08a63f

@ -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 void screenshot360 (osg::Image* image, int w) = 0; virtual void screenshot360 (osg::Image* image) = 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

@ -1020,20 +1020,21 @@ namespace MWInput
{ {
mScreenCaptureHandler->setFramesToCapture(1); mScreenCaptureHandler->setFramesToCapture(1);
mScreenCaptureHandler->captureNextFrame(*mViewer); mScreenCaptureHandler->captureNextFrame(*mViewer);
MWBase::Environment::get().getWindowManager()->messageBox ("Screenshot saved"); MWBase::Environment::get().getWindowManager()->messageBox("Screenshot saved");
} }
void InputManager::screenshot360() void InputManager::screenshot360()
{ {
int screenshotW = 1024;
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(), screenshotW); MWBase::Environment::get().getWorld()->screenshot360(screenshot.get());
(*mScreenCaptureHandler->getCaptureOperation()) (*(screenshot.get()),0);
/*
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg"); osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg");
if (!readerwriter) 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; return;
} }
@ -1048,7 +1049,7 @@ namespace MWInput
return; return;
} }
outfile.close(); outfile.close(); */
} }
void InputManager::toggleInventory() void InputManager::toggleInventory()

@ -743,8 +743,9 @@ namespace MWRender
int mSize; int mSize;
}; };
void RenderingManager::screenshot360(osg::Image* image, int w) void RenderingManager::screenshot360(osg::Image* image)
{ {
int w = 1024;
SphericalScreenshot s(w); SphericalScreenshot s(w);
osg::Vec3 directions[6] = { osg::Vec3 directions[6] = {

@ -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));
void screenshot360(osg::Image* image, int w); void screenshot360(osg::Image* image);
struct RayResult struct RayResult
{ {

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

@ -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;
void screenshot360 (osg::Image* image, int w) override; void screenshot360 (osg::Image* image) 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

Loading…
Cancel
Save