From c3ad4dad7544bd2e0ea1f7931ce8854d87e5d535 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 Feb 2016 05:53:56 -0800 Subject: [PATCH] Fix applying of filter settings on terrain textures --- components/terrain/terraingrid.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index eb085ca426..4f7a0772b7 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -139,15 +139,16 @@ osg::ref_ptr TerrainGrid::buildTerrain (osg::Group* parent, float chu std::vector > layerTextures; for (std::vector::const_iterator it = layerList.begin(); it != layerList.end(); ++it) { - osg::ref_ptr tex = mTextureCache[it->mDiffuseMap]; - if (!tex) + osg::ref_ptr texture = mTextureCache[it->mDiffuseMap]; + if (!texture) { - tex = new osg::Texture2D(mResourceSystem->getImageManager()->getImage(it->mDiffuseMap)); - tex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT); - tex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT); - mTextureCache[it->mDiffuseMap] = tex; + texture = new osg::Texture2D(mResourceSystem->getImageManager()->getImage(it->mDiffuseMap)); + texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT); + texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT); + mResourceSystem->getSceneManager()->applyFilterSettings(texture); + mTextureCache[it->mDiffuseMap] = texture; } - layerTextures.push_back(tex); + layerTextures.push_back(texture); textureCompileDummy->getOrCreateStateSet()->setTextureAttributeAndModes(dummyTextureCounter++, layerTextures.back()); } @@ -161,7 +162,6 @@ osg::ref_ptr TerrainGrid::buildTerrain (osg::Group* parent, float chu texture->setResizeNonPowerOfTwoHint(false); texture->getOrCreateUserDataContainer()->addDescription("dont_override_filter"); blendmapTextures.push_back(texture); - mResourceSystem->getSceneManager()->applyFilterSettings(texture); textureCompileDummy->getOrCreateStateSet()->setTextureAttributeAndModes(dummyTextureCounter++, blendmapTextures.back()); }