forked from teamnwah/openmw-tes3coop
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
1 changed files with 12 additions and 5 deletions
|
@ -1438,20 +1438,27 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
|
|
||||||
const Nif::NiTexturingProperty::Texture& tex = texprop->textures[i];
|
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;
|
std::cerr << "Warning: texture layer " << i << " is in use but empty in " << mFilename << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const Nif::NiSourceTexture *st = tex.texture.getPtr();
|
|
||||||
osg::ref_ptr<osg::Image> image = handleSourceTexture(st, imageManager);
|
// 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);
|
unsigned int clamp = static_cast<unsigned int>(tex.clamp);
|
||||||
int wrapT = (clamp) & 0x1;
|
int wrapT = (clamp) & 0x1;
|
||||||
int wrapS = (clamp >> 1) & 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_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
||||||
texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue