mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 06:36:39 +00:00
Add option to change screenshot image format
This commit is contained in:
parent
7fa3100993
commit
36a90198e2
4 changed files with 8 additions and 6 deletions
|
@ -509,7 +509,7 @@ void OMW::Engine::screenshot()
|
||||||
int shotCount = 0;
|
int shotCount = 0;
|
||||||
|
|
||||||
const std::string& screenshotPath = mCfgMgr.getUserDataPath().string();
|
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
|
// Find the first unused filename with a do-while
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
do
|
do
|
||||||
|
@ -518,11 +518,11 @@ void OMW::Engine::screenshot()
|
||||||
stream.str("");
|
stream.str("");
|
||||||
stream.clear();
|
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()));
|
} while (boost::filesystem::exists(stream.str()));
|
||||||
|
|
||||||
mOgre->screenshot(stream.str());
|
mOgre->screenshot(stream.str(), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMW::Engine::setCompileAll (bool all)
|
void OMW::Engine::setCompileAll (bool all)
|
||||||
|
|
|
@ -60,6 +60,8 @@ num mipmaps = 8
|
||||||
|
|
||||||
shader mode =
|
shader mode =
|
||||||
|
|
||||||
|
screenshot format = png
|
||||||
|
|
||||||
[Shadows]
|
[Shadows]
|
||||||
# Shadows are only supported when object shaders are on!
|
# Shadows are only supported when object shaders are on!
|
||||||
enabled = false
|
enabled = false
|
||||||
|
|
|
@ -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
|
/* Since Ogre uses narrow character interfaces, it does not support
|
||||||
Unicode paths on Windows. Therefore we had to implement screenshot
|
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());
|
mWindow->copyContentsToMemory(image.getPixelBox());
|
||||||
|
|
||||||
Ogre::DataStreamPtr stream = image.encode("png");
|
Ogre::DataStreamPtr stream = image.encode(imageFormat);
|
||||||
Ogre::MemoryDataStream *mem = dynamic_cast<Ogre::MemoryDataStream *>(stream.get());
|
Ogre::MemoryDataStream *mem = dynamic_cast<Ogre::MemoryDataStream *>(stream.get());
|
||||||
if (mem != 0) { // likely
|
if (mem != 0) { // likely
|
||||||
const char *ptr = reinterpret_cast<char *>(mem->getCurrentPtr());
|
const char *ptr = reinterpret_cast<char *>(mem->getCurrentPtr());
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace OEngine
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
/// Write a screenshot to file
|
/// Write a screenshot to file
|
||||||
void screenshot(const std::string &file);
|
void screenshot(const std::string &file, const std::string& imageFormat);
|
||||||
|
|
||||||
float getFPS();
|
float getFPS();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue