mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
nifloader: handle textures with no image that are later assigned in a FlipController
As found in vurt's trees (Bug #2100)
This commit is contained in:
parent
792f505b2a
commit
bccfd6cef8
@ -1438,20 +1438,27 @@ namespace NifOsg
|
||||
}
|
||||
|
||||
const Nif::NiTexturingProperty::Texture& tex = texprop->textures[i];
|
||||
if(tex.texture.empty())
|
||||
if(tex.texture.empty() && texprop->controller.empty())
|
||||
{
|
||||
std::cerr << "Warning: texture layer " << i << " is in use but empty in " << mFilename << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// create a new texture, will later attempt to share using the SharedStateManager
|
||||
osg::ref_ptr<osg::Texture2D> texture2d;
|
||||
if (!tex.texture.empty())
|
||||
{
|
||||
const Nif::NiSourceTexture *st = tex.texture.getPtr();
|
||||
osg::ref_ptr<osg::Image> image = handleSourceTexture(st, imageManager);
|
||||
texture2d = new osg::Texture2D(image);
|
||||
}
|
||||
else
|
||||
texture2d = new osg::Texture2D;
|
||||
|
||||
unsigned int clamp = static_cast<unsigned int>(tex.clamp);
|
||||
int wrapT = (clamp) & 0x1;
|
||||
int wrapS = (clamp >> 1) & 0x1;
|
||||
|
||||
// create a new texture, will later attempt to share using the SharedStateManager
|
||||
osg::ref_ptr<osg::Texture2D> texture2d (new osg::Texture2D(image));
|
||||
texture2d->setWrap(osg::Texture::WRAP_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
||||
texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user