From efa463af8f1b921cffe96c592095591eeda796bd Mon Sep 17 00:00:00 2001 From: capostrophic Date: Fri, 16 Aug 2019 16:25:17 +0300 Subject: [PATCH] Fix non-tiling textures clamp mode (bug #5137) --- CHANGELOG.md | 1 + components/nifosg/nifloader.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 195f02c56..cfe21ab8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,6 +127,7 @@ Bug #5112: Insufficient magicka for current spell not reflected on HUD icon Bug #5123: Script won't run on respawn Bug #5124: Arrow remains attached to actor if pulling animation was cancelled + Bug #5137: Textures with Clamp Mode set to Clamp instead of Wrap are too dark outside the boundaries Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index d8a3a80fa..f0e41c3ac 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -408,8 +408,8 @@ namespace NifOsg unsigned int clamp = static_cast(textureEffect->clamp); int wrapT = (clamp) & 0x1; int wrapS = (clamp >> 1) & 0x1; - 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_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP_TO_EDGE); + texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP_TO_EDGE); osg::ref_ptr texEnv = new osg::TexEnvCombine; texEnv->setCombine_Alpha(osg::TexEnvCombine::REPLACE); @@ -777,8 +777,8 @@ namespace NifOsg // inherit wrap settings from the target slot osg::Texture2D* inherit = dynamic_cast(stateset->getTextureAttribute(flipctrl->mTexSlot, osg::StateAttribute::TEXTURE)); - osg::Texture2D::WrapMode wrapS = osg::Texture2D::CLAMP; - osg::Texture2D::WrapMode wrapT = osg::Texture2D::CLAMP; + osg::Texture2D::WrapMode wrapS = osg::Texture2D::CLAMP_TO_EDGE; + osg::Texture2D::WrapMode wrapT = osg::Texture2D::CLAMP_TO_EDGE; if (inherit) { wrapS = inherit->getWrap(osg::Texture2D::WRAP_S); @@ -1392,8 +1392,8 @@ namespace NifOsg int wrapT = (clamp) & 0x1; int wrapS = (clamp >> 1) & 0x1; - 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_S, wrapS ? osg::Texture::REPEAT : osg::Texture::CLAMP_TO_EDGE); + texture2d->setWrap(osg::Texture::WRAP_T, wrapT ? osg::Texture::REPEAT : osg::Texture::CLAMP_TO_EDGE); int texUnit = boundTextures.size();