From 31988ca4cc643e9b1e76597f8574a30216513cc9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 5 Feb 2016 21:07:08 +0100 Subject: [PATCH] Add a dont_override_filter description for textures that should be left alone --- components/resource/scenemanager.cpp | 7 +++++++ components/terrain/terraingrid.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index df103f50c..065187c79 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -189,6 +189,13 @@ namespace Resource osg::Texture* tex = attr->asTexture(); if (tex) { + if (tex->getUserDataContainer()) + { + const std::vector& descriptions = tex->getUserDataContainer()->getDescriptions(); + if (std::find(descriptions.begin(), descriptions.end(), "dont_override_filter") != descriptions.end()) + return; + } + tex->setFilter(osg::Texture::MIN_FILTER, mMinFilter); tex->setFilter(osg::Texture::MAG_FILTER, mMagFilter); tex->setMaxAnisotropy(mMaxAnisotropy); diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index fb037c003..b7d727730 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -151,6 +151,7 @@ osg::ref_ptr TerrainGrid::buildTerrain (osg::Group* parent, float chu texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); texture->setResizeNonPowerOfTwoHint(false); + texture->getOrCreateUserDataContainer()->addDescription("dont_override_filter"); blendmapTextures.push_back(texture); textureCompileDummy->getOrCreateStateSet()->setTextureAttributeAndModes(dummyTextureCounter++, blendmapTextures.back());