mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-31 11:41:31 +00:00
skip flipping of 3D textures which is unsupported in OSG
This commit is contained in:
parent
0cb63ca4e6
commit
ac6089a430
3 changed files with 6 additions and 4 deletions
|
@ -470,7 +470,7 @@ namespace fx
|
|||
else if (key == "source")
|
||||
{
|
||||
expect<Lexer::String>();
|
||||
auto image = mImageManager.getImage(std::string{std::get<Lexer::String>(mToken).value});
|
||||
auto image = mImageManager.getImage(std::string{std::get<Lexer::String>(mToken).value}, is3D);
|
||||
if constexpr (is1D)
|
||||
{
|
||||
type = Types::SamplerType::Texture_1D;
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace Resource
|
|||
: ResourceManager(vfs)
|
||||
, mWarningImage(createWarningImage())
|
||||
, mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba ignoreTga2Fields"))
|
||||
, mOptionsNoFlip(new osgDB::Options("dds_dxt1_detect_rgba ignoreTga2Fields"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ namespace Resource
|
|||
return true;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Image> ImageManager::getImage(const std::string &filename)
|
||||
osg::ref_ptr<osg::Image> ImageManager::getImage(const std::string &filename, bool disableFlip)
|
||||
{
|
||||
const std::string normalized = mVFS->normalizeFilename(filename);
|
||||
|
||||
|
@ -135,7 +136,7 @@ namespace Resource
|
|||
stream->seekg(0);
|
||||
}
|
||||
|
||||
osgDB::ReaderWriter::ReadResult result = reader->readImage(*stream, mOptions);
|
||||
osgDB::ReaderWriter::ReadResult result = reader->readImage(*stream, disableFlip ? mOptionsNoFlip : mOptions);
|
||||
if (!result.success())
|
||||
{
|
||||
Log(Debug::Error) << "Error loading " << filename << ": " << result.message() << " code " << result.status();
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Resource
|
|||
|
||||
/// Create or retrieve an Image
|
||||
/// Returns the dummy image if the given image is not found.
|
||||
osg::ref_ptr<osg::Image> getImage(const std::string& filename);
|
||||
osg::ref_ptr<osg::Image> getImage(const std::string& filename, bool disableFlip = false);
|
||||
|
||||
osg::Image* getWarningImage();
|
||||
|
||||
|
@ -37,6 +37,7 @@ namespace Resource
|
|||
private:
|
||||
osg::ref_ptr<osg::Image> mWarningImage;
|
||||
osg::ref_ptr<osgDB::Options> mOptions;
|
||||
osg::ref_ptr<osgDB::Options> mOptionsNoFlip;
|
||||
|
||||
ImageManager(const ImageManager&);
|
||||
void operator = (const ImageManager&);
|
||||
|
|
Loading…
Reference in a new issue