From 04ccd8c8838ea1e7b137213398ad1396a384698f Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 20 Apr 2023 18:32:56 -0700 Subject: [PATCH] ImageUtilities.cs: linear texture support --- NewHorizons/Utility/Files/ImageUtilities.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Utility/Files/ImageUtilities.cs b/NewHorizons/Utility/Files/ImageUtilities.cs index bd883f85..260357c4 100644 --- a/NewHorizons/Utility/Files/ImageUtilities.cs +++ b/NewHorizons/Utility/Files/ImageUtilities.cs @@ -28,7 +28,10 @@ namespace NewHorizons.Utility.Files return _loadedTextures.ContainsKey(path); } - public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps = true, bool wrap = false) + // needed for backwards compat :P + public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps, bool wrap) => GetTexture(mod, filename, useMipmaps, wrap, false); + // bug: cache only considers file path, not wrap/mips/linear. oh well + public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps = true, bool wrap = false, bool linear = false) { // Copied from OWML but without the print statement lol var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename); @@ -42,7 +45,7 @@ namespace NewHorizons.Utility.Files try { var data = File.ReadAllBytes(path); - var texture = new Texture2D(2, 2, TextureFormat.RGBA32, useMipmaps); + var texture = new Texture2D(2, 2, TextureFormat.RGBA32, useMipmaps, linear); texture.name = Path.GetFileNameWithoutExtension(path); texture.wrapMode = wrap ? TextureWrapMode.Repeat : TextureWrapMode.Clamp; texture.LoadImage(data);