1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Clean up texture filtering settings (#13683)

This commit is contained in:
Gregor Parzefall 2023-08-24 10:50:47 +02:00 committed by GitHub
parent d0ee63c766
commit 72ef90885d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 94 deletions

View file

@ -503,3 +503,18 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
}
return dst_mesh;
}
void setMaterialFilters(video::SMaterialLayer &tex, bool bilinear, bool trilinear, bool anisotropic) {
if (trilinear)
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
else if (bilinear)
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_NEAREST;
else
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
// "We don't want blurriness after all." ~ Desour, #13108
// (because of pixel art)
tex.MagFilter = video::ETMAGF_NEAREST;
tex.AnisotropicFilter = anisotropic ? 0xFF : 0;
}