mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-07 09:06:41 +00:00
Merge branch 'sharetexturetype' into 'master'
Share texture type attributes See merge request OpenMW/openmw!4431
This commit is contained in:
commit
27f52d27b9
1 changed files with 6 additions and 5 deletions
|
@ -1027,7 +1027,7 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> attachTexture(const std::string& name, osg::ref_ptr<osg::Image> image, bool wrapS,
|
osg::ref_ptr<osg::Texture2D> attachTexture(const std::string& name, osg::ref_ptr<osg::Image> image, bool wrapS,
|
||||||
bool wrapT, unsigned int uvSet, osg::StateSet* stateset, std::vector<unsigned int>& boundTextures) const
|
bool wrapT, unsigned int uvSet, osg::StateSet* stateset, std::vector<unsigned int>& boundTextures)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Texture2D> texture2d = new osg::Texture2D(image);
|
osg::ref_ptr<osg::Texture2D> texture2d = new osg::Texture2D(image);
|
||||||
if (image)
|
if (image)
|
||||||
|
@ -1038,22 +1038,23 @@ namespace NifOsg
|
||||||
if (stateset)
|
if (stateset)
|
||||||
{
|
{
|
||||||
stateset->setTextureAttributeAndModes(texUnit, texture2d, osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(texUnit, texture2d, osg::StateAttribute::ON);
|
||||||
stateset->setTextureAttributeAndModes(
|
osg::ref_ptr<SceneUtil::TextureType> textureType = new SceneUtil::TextureType(name);
|
||||||
texUnit, new SceneUtil::TextureType(name), osg::StateAttribute::ON);
|
textureType = shareAttribute(textureType);
|
||||||
|
stateset->setTextureAttributeAndModes(texUnit, textureType, osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
boundTextures.emplace_back(uvSet);
|
boundTextures.emplace_back(uvSet);
|
||||||
return texture2d;
|
return texture2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> attachExternalTexture(const std::string& name, const std::string& path, bool wrapS,
|
osg::ref_ptr<osg::Texture2D> attachExternalTexture(const std::string& name, const std::string& path, bool wrapS,
|
||||||
bool wrapT, unsigned int uvSet, osg::StateSet* stateset, std::vector<unsigned int>& boundTextures) const
|
bool wrapT, unsigned int uvSet, osg::StateSet* stateset, std::vector<unsigned int>& boundTextures)
|
||||||
{
|
{
|
||||||
return attachTexture(name, getTextureImage(path), wrapS, wrapT, uvSet, stateset, boundTextures);
|
return attachTexture(name, getTextureImage(path), wrapS, wrapT, uvSet, stateset, boundTextures);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> attachNiSourceTexture(const std::string& name, const Nif::NiSourceTexture* st,
|
osg::ref_ptr<osg::Texture2D> attachNiSourceTexture(const std::string& name, const Nif::NiSourceTexture* st,
|
||||||
bool wrapS, bool wrapT, unsigned int uvSet, osg::StateSet* stateset,
|
bool wrapS, bool wrapT, unsigned int uvSet, osg::StateSet* stateset,
|
||||||
std::vector<unsigned int>& boundTextures) const
|
std::vector<unsigned int>& boundTextures)
|
||||||
{
|
{
|
||||||
return attachTexture(name, handleSourceTexture(st), wrapS, wrapT, uvSet, stateset, boundTextures);
|
return attachTexture(name, handleSourceTexture(st), wrapS, wrapT, uvSet, stateset, boundTextures);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue