Avoid filtering low-res textures for animated meshes (incl. players) (#6562)
authorlhofhansl <lhofhansl@yahoo.com>
Sat, 28 Oct 2017 08:33:47 +0000 (01:33 -0700)
committerSmallJoker <mk939@ymail.com>
Sun, 3 Jun 2018 15:32:00 +0000 (17:32 +0200)
src/content_cao.cpp

index e90bb90caeb4d29ba7042fb6a3e7259aa78d3eca..994f0492acdbeba648d1f5145fe1d6f5bb67ed05 100644 (file)
@@ -1355,6 +1355,13 @@ void GenericCAO::updateTextures(std::string mod)
                                material.setFlag(video::EMF_LIGHTING, false);
                                material.setFlag(video::EMF_BILINEAR_FILTER, false);
 
+                               // don't filter low-res textures, makes them look blurry
+                               // player models have a res of 64
+                               const core::dimension2d<u32> &size = texture->getOriginalSize();
+                               const u32 res = std::min(size.Height, size.Width);
+                               use_trilinear_filter &= res > 64;
+                               use_bilinear_filter &= res > 64;
+
                                m_animated_meshnode->getMaterial(i)
                                                .setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
                                m_animated_meshnode->getMaterial(i)