mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-27 22:05:17 +01:00
Don't use bilinear/trilinear filter on small overlay if large base texture
This commit is contained in:
@@ -53,6 +53,13 @@ core.register_craftitem("testitems:overlay_global", {
|
||||
color = GLOBAL_COLOR_ARG,
|
||||
})
|
||||
|
||||
core.register_craftitem("testitems:overlay_size", {
|
||||
description = S("Texture Overlay Test Item, Big Base Small Overlay") .. "\n" ..
|
||||
S("Wield overlay should not be blurry."),
|
||||
inventory_image = "[fill:1000x1000:#FFFFFF",
|
||||
inventory_overlay = "testitems_overlay_overlay.png",
|
||||
})
|
||||
|
||||
core.register_craftitem("testitems:image_meta", {
|
||||
description = S("Image Override Meta Test Item"),
|
||||
inventory_image = "default_apple.png",
|
||||
|
||||
@@ -350,8 +350,12 @@ void WieldMeshSceneNode::setExtruded(video::ITexture *texture,
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
material.BackfaceCulling = true;
|
||||
// don't filter low-res textures, makes them look blurry
|
||||
bool f_ok = std::min(dim.Width, dim.Height) >= TEXTURE_FILTER_MIN_SIZE;
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
video::ITexture *t = tex.Texture;
|
||||
if (!t)
|
||||
return;
|
||||
core::dimension2d<u32> d = t->getSize();
|
||||
bool f_ok = std::min(d.Width, d.Height) >= TEXTURE_FILTER_MIN_SIZE;
|
||||
setMaterialFilters(tex, m_bilinear_filter && f_ok,
|
||||
m_trilinear_filter && f_ok, m_anisotropic_filter);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user