mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 06:44:29 +00:00
Share texture type attributes
This commit is contained in:
parent
1349fdb4f2
commit
964dafd42c
@ -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…
x
Reference in New Issue
Block a user