diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index fa4c69337..1247ceda1 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -509,7 +509,7 @@ void OMW::Engine::screenshot() int shotCount = 0; const std::string& screenshotPath = mCfgMgr.getUserDataPath().string(); - + std::string format = Settings::Manager::getString("screenshot format", "General"); // Find the first unused filename with a do-while std::ostringstream stream; do @@ -518,11 +518,11 @@ void OMW::Engine::screenshot() stream.str(""); stream.clear(); - stream << screenshotPath << "screenshot" << std::setw(3) << std::setfill('0') << shotCount++ << ".png"; + stream << screenshotPath << "screenshot" << std::setw(3) << std::setfill('0') << shotCount++ << "." << format; } while (boost::filesystem::exists(stream.str())); - mOgre->screenshot(stream.str()); + mOgre->screenshot(stream.str(), format); } void OMW::Engine::setCompileAll (bool all) diff --git a/files/settings-default.cfg b/files/settings-default.cfg index ab9de47a4..fc651f463 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -60,6 +60,8 @@ num mipmaps = 8 shader mode = +screenshot format = png + [Shadows] # Shadows are only supported when object shaders are on! enabled = false diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index 78eff6aee..fa98433ac 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -44,7 +44,7 @@ void OgreRenderer::update(float dt) { } -void OgreRenderer::screenshot(const std::string &file) +void OgreRenderer::screenshot(const std::string &file, const std::string& imageFormat) { /* Since Ogre uses narrow character interfaces, it does not support Unicode paths on Windows. Therefore we had to implement screenshot @@ -65,7 +65,7 @@ void OgreRenderer::screenshot(const std::string &file) ); mWindow->copyContentsToMemory(image.getPixelBox()); - Ogre::DataStreamPtr stream = image.encode("png"); + Ogre::DataStreamPtr stream = image.encode(imageFormat); Ogre::MemoryDataStream *mem = dynamic_cast(stream.get()); if (mem != 0) { // likely const char *ptr = reinterpret_cast(mem->getCurrentPtr()); diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index c7ec2ec44..5dba15b5a 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -108,7 +108,7 @@ namespace OEngine void update(float dt); /// Write a screenshot to file - void screenshot(const std::string &file); + void screenshot(const std::string &file, const std::string& imageFormat); float getFPS();