diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp index d626b48ca..8a412b2dd 100644 --- a/src/client/clientmap.cpp +++ b/src/client/clientmap.cpp @@ -843,9 +843,8 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) // Apply filter settings material.forEachTexture([this] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = m_cache_trilinear_filter; - tex.BilinearFilter = m_cache_trilinear_filter; - tex.AnisotropicFilter = m_cache_anistropic_filter ? 0xFF : 0; + tex.setFiltersMinetest(m_cache_bilinear_filter, m_cache_trilinear_filter, + m_cache_anistropic_filter); }); material.Wireframe = m_control.show_wireframe; @@ -859,9 +858,9 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) // Do not enable filter on shadow texture to avoid visual artifacts // with colored shadows. // Filtering is done in shader code anyway - layer.BilinearFilter = false; - layer.AnisotropicFilter = false; - layer.TrilinearFilter = false; + layer.MinFilter = video::ETMINF_NEAREST; + layer.MagFilter = video::ETMAGF_NEAREST; + layer.AnisotropicFilter = 0; } driver->setMaterial(material); ++material_swaps; diff --git a/src/client/clouds.cpp b/src/client/clouds.cpp index 038331360..c4a9cd8a8 100644 --- a/src/client/clouds.cpp +++ b/src/client/clouds.cpp @@ -53,7 +53,8 @@ Clouds::Clouds(scene::ISceneManager* mgr, m_material.AntiAliasing = video::EAAM_SIMPLE; m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; m_material.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); m_params.height = 120; diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 1087dfd48..f09f0624b 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -255,7 +255,8 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) buf->getMaterial().Lighting = false; buf->getMaterial().BackfaceCulling = false; buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png")); - buf->getMaterial().TextureLayer[0].BilinearFilter = false; + buf->getMaterial().TextureLayer[0].MinFilter = video::ETMINF_NEAREST; + buf->getMaterial().TextureLayer[0].MagFilter = video::ETMAGF_NEAREST; buf->getMaterial().FogEnable = true; buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; // Add to mesh @@ -652,7 +653,8 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr) mat.NormalizeNormals = true; } mat.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); }; @@ -1353,9 +1355,8 @@ void GenericCAO::updateTextures(std::string mod) } material.forEachTexture([=] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = use_trilinear_filter; - tex.BilinearFilter = use_bilinear_filter; - tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0; + tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter, + use_anisotropic_filter); }); } } @@ -1390,9 +1391,8 @@ void GenericCAO::updateTextures(std::string mod) use_bilinear_filter &= res > 64; material.forEachTexture([=] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = use_trilinear_filter; - tex.BilinearFilter = use_bilinear_filter; - tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0; + tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter, + use_anisotropic_filter); }); } for (u32 i = 0; i < m_prop.colors.size() && @@ -1438,9 +1438,8 @@ void GenericCAO::updateTextures(std::string mod) } material.forEachTexture([=] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = use_trilinear_filter; - tex.BilinearFilter = use_bilinear_filter; - tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0; + tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter, + use_anisotropic_filter); }); } } else if (m_prop.visual == "upright_sprite") { @@ -1464,9 +1463,8 @@ void GenericCAO::updateTextures(std::string mod) } material.forEachTexture([=] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = use_trilinear_filter; - tex.BilinearFilter = use_bilinear_filter; - tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0; + tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter, + use_anisotropic_filter); }); } { @@ -1494,9 +1492,8 @@ void GenericCAO::updateTextures(std::string mod) } material.forEachTexture([=] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = use_trilinear_filter; - tex.BilinearFilter = use_bilinear_filter; - tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0; + tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter, + use_anisotropic_filter); }); } // Set mesh color (only if lighting is disabled) diff --git a/src/client/content_cso.cpp b/src/client/content_cso.cpp index 8f1650624..397dd1fce 100644 --- a/src/client/content_cso.cpp +++ b/src/client/content_cso.cpp @@ -43,7 +43,8 @@ public: mat.Lighting = false; mat.FogEnable = true; mat.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); }); m_spritenode->setColor(video::SColor(255,0,0,0)); diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index 21e4f0d5c..fd4d1ad03 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -768,7 +768,8 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset): material.FogEnable = true; material.setTexture(0, p.layer.texture); material.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); if (m_enable_shaders) { diff --git a/src/client/mesh.cpp b/src/client/mesh.cpp index f0f95b1ab..3a844dad3 100644 --- a/src/client/mesh.cpp +++ b/src/client/mesh.cpp @@ -101,7 +101,8 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale) buf->getMaterial().Lighting = false; buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); // Add mesh buffer to mesh mesh->addMeshBuffer(buf); @@ -410,7 +411,8 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector &boxes, scene::IMeshBuffer *buf = new scene::SMeshBuffer(); buf->getMaterial().Lighting = false; buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); dst_mesh->addMeshBuffer(buf); buf->drop(); diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index a46845a33..d652b69c4 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -609,7 +609,8 @@ void Minimap::drawMinimap(core::rect rect) { video::SMaterial &material = m_meshbuffer->getMaterial(); material.forEachTexture([] (video::SMaterialLayer &tex) { - tex.TrilinearFilter = true; + tex.MinFilter = video::ETMINF_TRILINEAR; + tex.MagFilter = video::ETMAGF_BILINEAR; }); material.Lighting = false; material.TextureLayer[0].Texture = minimap_texture; diff --git a/src/client/particles.cpp b/src/client/particles.cpp index 046c6401a..4945b39bd 100644 --- a/src/client/particles.cpp +++ b/src/client/particles.cpp @@ -93,7 +93,8 @@ Particle::Particle( m_material.BackfaceCulling = false; m_material.FogEnable = true; m_material.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); // correctly render layered transparent particles -- see #10398 diff --git a/src/client/render/secondstage.cpp b/src/client/render/secondstage.cpp index 096dfd15c..6d9cd2f0c 100644 --- a/src/client/render/secondstage.cpp +++ b/src/client/render/secondstage.cpp @@ -38,9 +38,9 @@ void PostProcessingStep::configureMaterial() material.ZBuffer = true; material.ZWriteEnable = video::EZW_ON; for (u32 k = 0; k < texture_map.size(); ++k) { - material.TextureLayer[k].AnisotropicFilter = false; - material.TextureLayer[k].BilinearFilter = false; - material.TextureLayer[k].TrilinearFilter = false; + material.TextureLayer[k].AnisotropicFilter = 0; + material.TextureLayer[k].MinFilter = video::ETMINF_NEAREST; + material.TextureLayer[k].MagFilter = video::ETMAGF_NEAREST; material.TextureLayer[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayer[k].TextureWrapV = video::ETC_CLAMP_TO_EDGE; } @@ -92,7 +92,8 @@ void PostProcessingStep::run(PipelineContext &context) void PostProcessingStep::setBilinearFilter(u8 index, bool value) { assert(index < video::MATERIAL_MAX_TEXTURES); - material.TextureLayer[index].BilinearFilter = value; + material.TextureLayer[index].MinFilter = value ? video::ETMINF_BILINEAR : video::ETMINF_NEAREST; + material.TextureLayer[index].MagFilter = value ? video::ETMAGF_BILINEAR : video::ETMAGF_NEAREST; } RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep, v2f scale, Client *client) diff --git a/src/client/sky.cpp b/src/client/sky.cpp index 1cfe44de5..e28e10ee3 100644 --- a/src/client/sky.cpp +++ b/src/client/sky.cpp @@ -51,8 +51,8 @@ static video::SMaterial baseMaterial() static inline void disableTextureFiltering(video::SMaterial &mat) { mat.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; - tex.TrilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; tex.AnisotropicFilter = 0; }); } diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index 37122cd04..4948d725c 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -298,10 +298,11 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename, material.MaterialTypeParam = 0.5f; material.BackfaceCulling = true; // Enable bi/trilinear filtering only for high resolution textures - material.forEachTexture([this, &dim] (video::SMaterialLayer &tex) { - tex.BilinearFilter = dim.Width > 32 && m_bilinear_filter; - tex.TrilinearFilter = dim.Width > 32 && m_trilinear_filter; - tex.AnisotropicFilter = m_anisotropic_filter ? 0xFF : 0; + bool bilinear_filter = dim.Width > 32 && m_bilinear_filter; + bool trilinear_filter = dim.Width > 32 && m_trilinear_filter; + material.forEachTexture([=] (video::SMaterialLayer &tex) { + tex.setFiltersMinetest(bilinear_filter, trilinear_filter, + m_anisotropic_filter); }); // mipmaps cause "thin black line" artifacts material.UseMipMaps = false; @@ -464,8 +465,8 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che material.MaterialTypeParam = 0.5f; material.BackfaceCulling = cull_backface; material.forEachTexture([this] (video::SMaterialLayer &tex) { - tex.BilinearFilter = m_bilinear_filter; - tex.TrilinearFilter = m_trilinear_filter; + tex.setFiltersMinetest(m_bilinear_filter, m_trilinear_filter, + m_anisotropic_filter); }); } @@ -655,8 +656,8 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result) material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; material.MaterialTypeParam = 0.5f; material.forEachTexture([] (video::SMaterialLayer &tex) { - tex.BilinearFilter = false; - tex.TrilinearFilter = false; + tex.MinFilter = video::ETMINF_NEAREST; + tex.MagFilter = video::ETMAGF_NEAREST; }); material.BackfaceCulling = cull_backface; material.Lighting = false; @@ -701,8 +702,8 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc, video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial(); material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; - material.TextureLayer[0].BilinearFilter = false; - material.TextureLayer[0].TrilinearFilter = false; + material.TextureLayer[0].MinFilter = video::ETMINF_NEAREST; + material.TextureLayer[0].MagFilter = video::ETMAGF_NEAREST; material.BackfaceCulling = true; material.Lighting = false; material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; diff --git a/src/gui/guiScene.cpp b/src/gui/guiScene.cpp index 0a6ce30e1..d6bf3aeb9 100644 --- a/src/gui/guiScene.cpp +++ b/src/gui/guiScene.cpp @@ -68,7 +68,8 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture) material.TextureLayer[0].Texture = texture; material.Lighting = false; material.FogEnable = true; - material.TextureLayer[0].BilinearFilter = false; + material.TextureLayer[0].MinFilter = video::ETMINF_NEAREST; + material.TextureLayer[0].MagFilter = video::ETMAGF_NEAREST; material.BackfaceCulling = false; material.ZWriteEnable = video::EZW_AUTO; }