mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 16:19:54 +00:00
40 lines
893 B
C++
40 lines
893 B
C++
#include "converter.hpp"
|
|
|
|
#include <OgreImage.h>
|
|
|
|
namespace
|
|
{
|
|
|
|
void convertImage(char* data, int size, int width, int height, Ogre::PixelFormat pf, const std::string& out)
|
|
{
|
|
Ogre::Image screenshot;
|
|
Ogre::DataStreamPtr stream (new Ogre::MemoryDataStream(data, size));
|
|
screenshot.loadRawData(stream, width, height, 1, pf);
|
|
screenshot.save(out);
|
|
}
|
|
|
|
}
|
|
|
|
namespace ESSImport
|
|
{
|
|
|
|
|
|
struct MAPH
|
|
{
|
|
unsigned int size;
|
|
unsigned int value;
|
|
};
|
|
|
|
void ConvertFMAP::read(ESM::ESMReader &esm)
|
|
{
|
|
MAPH maph;
|
|
esm.getHNT(maph, "MAPH");
|
|
std::vector<char> data;
|
|
esm.getSubNameIs("MAPD");
|
|
esm.getSubHeader();
|
|
data.resize(esm.getSubSize());
|
|
esm.getExact(&data[0], data.size());
|
|
convertImage(&data[0], data.size(), maph.size, maph.size, Ogre::PF_BYTE_RGB, "map.tga");
|
|
}
|
|
|
|
}
|