From 052bbecc3b784365cb8c8d8872f4a1a86e58818a Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Wed, 20 Feb 2019 19:10:37 +0100 Subject: [PATCH] OSG 3.4.0 compilation fixes and anisotropy Set anisotropy on model textures after loading. --- simgear/scene/model/model.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index 737c7597..d449b711 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -41,7 +41,7 @@ SGLoadTexture2D(bool staticTexture, const std::string& path, const osgDB::Options* options, bool wrapu, bool wrapv, int) { - osg::Image* image; + osg::ref_ptr image; if (options) #if OSG_VERSION_LESS_THAN(3,4,0) image = osgDB::readImageFile(path, options); @@ -57,6 +57,8 @@ SGLoadTexture2D(bool staticTexture, const std::string& path, osg::ref_ptr texture = new osg::Texture2D; texture->setImage(image); + texture->setMaxAnisotropy(SGSceneFeatures::instance()->getTextureFilter()); + if (staticTexture) texture->setDataVariance(osg::Object::STATIC); if (wrapu) @@ -153,7 +155,7 @@ Texture2D* TextureUpdateVisitor::textureReplace(int unit, const StateAttribute* #if OSG_VERSION_LESS_THAN(3,4,0) Image* newImage = readImageFile(fullLiveryFile); #else - Image* newImage = readRefImageFile(fullLiveryFile); + osg::ref_ptr newImage = readRefImageFile(fullLiveryFile); #endif if (!newImage) return 0; @@ -163,6 +165,10 @@ Texture2D* TextureUpdateVisitor::textureReplace(int unit, const StateAttribute* return 0; } else { newTexture->setImage(newImage); + if (newImage.valid()) + { + newTexture->setMaxAnisotropy(SGSceneFeatures::instance()->getTextureFilter()); + } return newTexture; } }