Disable filtering for small textures in the material preview

This makes previewing materials with a pixel art style
closer to the intended result.
This commit is contained in:
Hugo Locurcio 2019-10-20 21:16:20 +02:00
parent 80f8071d7b
commit c00a77eaa4
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C

View File

@ -89,6 +89,11 @@ func render_textures(renderer : MMGenRenderer):
result.release()
# To work, this must be set after calling `copy_to_texture()`
texture.flags |= ImageTexture.FLAG_ANISOTROPIC_FILTER
# Disable filtering for small textures, as they're considered to be used
# for a pixel art style
if texture.get_size().x <= 128:
texture.flags ^= ImageTexture.FLAG_FILTER
elif t.has("ports"):
var context : MMGenContext = MMGenContext.new(renderer)
var code = []
@ -114,6 +119,11 @@ func render_textures(renderer : MMGenRenderer):
# To work, this must be set after calling `copy_to_texture()`
texture.flags |= ImageTexture.FLAG_ANISOTROPIC_FILTER
# Disable filtering for small textures, as they're considered to be used
# for a pixel art style
if texture.get_size().x <= 128:
texture.flags ^= ImageTexture.FLAG_FILTER
generated_textures[t.texture] = texture
func update_materials(material_list):