Merge pull request #40 from Calinou/small-textures-disable-filtering

Disable filtering for small textures in the material preview
This commit is contained in:
Rodz Labs 2019-10-20 23:00:24 +02:00 committed by GitHub
commit 93dd1ca1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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):