aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/main/java/dev/isxander/yacl3/debug/DebugProperties.java13
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/image/impl/AnimatedDynamicTextureImage.java9
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/image/impl/DynamicTextureImage.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/image/impl/ResourceTextureImage.java10
4 files changed, 42 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/debug/DebugProperties.java b/common/src/main/java/dev/isxander/yacl3/debug/DebugProperties.java
new file mode 100644
index 0000000..8d93bcd
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/debug/DebugProperties.java
@@ -0,0 +1,13 @@
+package dev.isxander.yacl3.debug;
+
+import dev.isxander.yacl3.platform.YACLPlatform;
+
+public final class DebugProperties {
+ /** Applies GL filtering to rendering images. */
+ public static final boolean IMAGE_FILTERING = boolProp("imageFiltering", false, false);
+
+ private static boolean boolProp(String name, boolean defProd, boolean defDebug) {
+ boolean defaultValue = YACLPlatform.isDevelopmentEnv() ? defDebug : defProd;
+ return Boolean.parseBoolean(System.getProperty("yacl3.debug." + name, Boolean.toString(defaultValue)));
+ }
+}
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/image/impl/AnimatedDynamicTextureImage.java b/common/src/main/java/dev/isxander/yacl3/gui/image/impl/AnimatedDynamicTextureImage.java
index 7a58461..cc5a2c3 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/image/impl/AnimatedDynamicTextureImage.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/image/impl/AnimatedDynamicTextureImage.java
@@ -1,8 +1,11 @@
package dev.isxander.yacl3.gui.image.impl;
import com.mojang.blaze3d.Blaze3D;
+import com.mojang.blaze3d.platform.GlConst;
+import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.NativeImage;
import com.twelvemonkeys.imageio.plugins.webp.WebPImageReaderSpi;
+import dev.isxander.yacl3.debug.DebugProperties;
import dev.isxander.yacl3.gui.image.ImageRendererFactory;
import dev.isxander.yacl3.impl.utils.YACLConstants;
import net.minecraft.CrashReport;
@@ -62,6 +65,12 @@ public class AnimatedDynamicTextureImage extends DynamicTextureImage {
graphics.pose().pushPose();
graphics.pose().translate(x, y, 0);
graphics.pose().scale(ratio, ratio, 1);
+
+ if (DebugProperties.IMAGE_FILTERING) {
+ GlStateManager._texParameter(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MAG_FILTER, GlConst.GL_LINEAR);
+ GlStateManager._texParameter(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MIN_FILTER, GlConst.GL_LINEAR);
+ }
+
graphics.blit(
uniqueLocation,
0, 0,
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/image/impl/DynamicTextureImage.java b/common/src/main/java/dev/isxander/yacl3/gui/image/impl/DynamicTextureImage.java
index e0449e9..86dc833 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/image/impl/DynamicTextureImage.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/image/impl/DynamicTextureImage.java
@@ -1,7 +1,10 @@
package dev.isxander.yacl3.gui.image.impl;
+import com.mojang.blaze3d.platform.GlConst;
+import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.systems.RenderSystem;
+import dev.isxander.yacl3.debug.DebugProperties;
import dev.isxander.yacl3.gui.image.ImageRenderer;
import dev.isxander.yacl3.gui.image.ImageRendererFactory;
import net.minecraft.client.Minecraft;
@@ -42,7 +45,14 @@ public class DynamicTextureImage implements ImageRenderer {
graphics.pose().pushPose();
graphics.pose().translate(x, y, 0);
graphics.pose().scale(ratio, ratio, 1);
+
+ if (DebugProperties.IMAGE_FILTERING) {
+ GlStateManager._texParameter(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MAG_FILTER, GlConst.GL_LINEAR);
+ GlStateManager._texParameter(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MIN_FILTER, GlConst.GL_LINEAR);
+ }
+
graphics.blit(uniqueLocation, 0, 0, 0, 0, this.width, this.height, this.width, this.height);
+
graphics.pose().popPose();
return targetHeight;
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/image/impl/ResourceTextureImage.java b/common/src/main/java/dev/isxander/yacl3/gui/image/impl/ResourceTextureImage.java
index 8c2b3b5..6805611 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/image/impl/ResourceTextureImage.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/image/impl/ResourceTextureImage.java
@@ -1,5 +1,8 @@
package dev.isxander.yacl3.gui.image.impl;
+import com.mojang.blaze3d.platform.GlConst;
+import com.mojang.blaze3d.platform.GlStateManager;
+import dev.isxander.yacl3.debug.DebugProperties;
import dev.isxander.yacl3.gui.image.ImageRenderer;
import dev.isxander.yacl3.gui.image.ImageRendererFactory;
import net.minecraft.client.gui.GuiGraphics;
@@ -29,7 +32,14 @@ public class ResourceTextureImage implements ImageRenderer {
graphics.pose().pushPose();
graphics.pose().translate(x, y, 0);
graphics.pose().scale(ratio, ratio, 1);
+
+ if (DebugProperties.IMAGE_FILTERING) {
+ GlStateManager._texParameter(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MAG_FILTER, GlConst.GL_LINEAR);
+ GlStateManager._texParameter(GlConst.GL_TEXTURE_2D, GlConst.GL_TEXTURE_MIN_FILTER, GlConst.GL_LINEAR);
+ }
+
graphics.blit(location, 0, 0, this.u, this.v, this.width, this.height, this.textureWidth, this.textureHeight);
+
graphics.pose().popPose();
return targetHeight;