1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00

small revert, "It is copying a texture, it is not a default initialized one. The source texture may or may not want GL_CLAMP_TO_EDGE."

This commit is contained in:
Bret Curtis 2023-06-14 22:35:53 +02:00
parent 0b1a0ad1a8
commit 73c5909387

View File

@ -600,18 +600,13 @@ namespace MWRender
// user-defined samplers
for (const osg::Texture* texture : technique->getTextures())
{
osg::ref_ptr<osg::Texture> sample;
if (const auto* tex1D = dynamic_cast<const osg::Texture1D*>(texture))
sample = new osg::Texture1D(*tex1D);
node.mRootStateSet->setTextureAttribute(texUnit, new osg::Texture1D(*tex1D));
else if (const auto* tex2D = dynamic_cast<const osg::Texture2D*>(texture))
sample = new osg::Texture2D(*tex2D);
node.mRootStateSet->setTextureAttribute(texUnit, new osg::Texture2D(*tex2D));
else if (const auto* tex3D = dynamic_cast<const osg::Texture3D*>(texture))
sample= new osg::Texture3D(*tex3D);
node.mRootStateSet->setTextureAttribute(texUnit, new osg::Texture3D(*tex3D));
sample->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
sample->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
node.mRootStateSet->setTextureAttribute(texUnit, sample);
node.mRootStateSet->addUniform(new osg::Uniform(texture->getName().c_str(), texUnit++));
}
@ -644,8 +639,6 @@ namespace MWRender
const auto [w, h] = rt.mSize.get(renderWidth(), renderHeight());
subPass.mRenderTexture = new osg::Texture2D(*rt.mTarget);
subPass.mRenderTexture ->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
subPass.mRenderTexture ->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
renderTargetCache[rt.mTarget] = subPass.mRenderTexture;
subPass.mRenderTexture->setTextureSize(w, h);
subPass.mRenderTexture->setName(std::string(pass->getTarget()));