mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
be1692f218
2 changed files with 35 additions and 2 deletions
|
@ -41,7 +41,9 @@ add_component_dir (resource
|
|||
)
|
||||
|
||||
add_component_dir (sceneutil
|
||||
clone attach lightmanager visitor util statesetupdater controller skeleton riggeometry lightcontroller workqueue
|
||||
clone attach lightmanager visitor util statesetupdater controller skeleton riggeometry lightcontroller
|
||||
# not used yet
|
||||
#workqueue
|
||||
)
|
||||
|
||||
add_component_dir (nif
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "texturemanager.hpp"
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osg/GLExtensions>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
@ -73,7 +74,7 @@ namespace Resource
|
|||
{
|
||||
osg::ref_ptr<osg::Texture2D> tex = it->second;
|
||||
|
||||
// Keep mip-mapping disabled if the texture creator explicitely requested it.
|
||||
// Keep mip-mapping disabled if the texture creator explicitely requested no mipmapping.
|
||||
osg::Texture::FilterMode oldMin = tex->getFilter(osg::Texture::MIN_FILTER);
|
||||
if (oldMin == osg::Texture::LINEAR || oldMin == osg::Texture::NEAREST)
|
||||
{
|
||||
|
@ -108,6 +109,32 @@ namespace Resource
|
|||
}
|
||||
*/
|
||||
|
||||
bool checkSupported(osg::Image* image, const std::string& filename)
|
||||
{
|
||||
switch(image->getPixelFormat())
|
||||
{
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
{
|
||||
osg::Texture::Extensions* exts = osg::Texture::getExtensions(0, false);
|
||||
if (exts && !exts->isTextureCompressionS3TCSupported()
|
||||
// This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG.
|
||||
&& !osg::isGLExtensionSupported(0, "GL_S3_s3tc"))
|
||||
{
|
||||
std::cerr << "Error loading " << filename << ": no S3TC texture compression support installed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// not bothering with checks for other compression formats right now, we are unlikely to ever use those anyway
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> TextureManager::getTexture2D(const std::string &filename, osg::Texture::WrapMode wrapS, osg::Texture::WrapMode wrapT)
|
||||
{
|
||||
std::string normalized = filename;
|
||||
|
@ -152,6 +179,10 @@ namespace Resource
|
|||
}
|
||||
|
||||
osg::Image* image = result.getImage();
|
||||
if (!checkSupported(image, filename))
|
||||
{
|
||||
return mWarningTexture;
|
||||
}
|
||||
|
||||
// We need to flip images, because the Morrowind texture coordinates use the DirectX convention (top-left image origin),
|
||||
// but OpenGL uses bottom left as the image origin.
|
||||
|
|
Loading…
Reference in a new issue