mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Mobile: Adjust texture filtering and add optional anisotropic support (commented out for now)
This commit is contained in:
@@ -2,9 +2,13 @@ package forge.assets;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.utils.BufferUtils;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.ImageKeys;
|
||||
@@ -18,7 +22,18 @@ final class ImageLoader extends CacheLoader<String, Texture> {
|
||||
try {
|
||||
if (Forge.isTextureFilteringEnabled()) {
|
||||
Texture t = new Texture(fh, true);
|
||||
t.setFilter(Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.MipMapNearestNearest);
|
||||
t.setFilter(Texture.TextureFilter.MipMapLinearLinear, Texture.TextureFilter.Linear);
|
||||
|
||||
/* // Optional experimental feature: Anisotropic filtering
|
||||
GL20 gl = Gdx.gl20;
|
||||
if (gl != null && Gdx.graphics.supportsExtension("GL_EXT_texture_filter_anisotropic")) {
|
||||
FloatBuffer buffer = BufferUtils.newFloatBuffer(16);
|
||||
gl.glGetFloatv(GL20.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, buffer);
|
||||
float maxAniso = buffer.get(0);
|
||||
|
||||
t.bind();
|
||||
gl.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAniso);
|
||||
} */
|
||||
return t;
|
||||
} else {
|
||||
return new Texture(fh);
|
||||
|
||||
Reference in New Issue
Block a user