mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
ImageUtilities.cs: linear texture support
This commit is contained in:
parent
e9aebd9924
commit
04ccd8c883
@ -28,7 +28,10 @@ namespace NewHorizons.Utility.Files
|
|||||||
return _loadedTextures.ContainsKey(path);
|
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
|
// Copied from OWML but without the print statement lol
|
||||||
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename);
|
var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename);
|
||||||
@ -42,7 +45,7 @@ namespace NewHorizons.Utility.Files
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = File.ReadAllBytes(path);
|
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.name = Path.GetFileNameWithoutExtension(path);
|
||||||
texture.wrapMode = wrap ? TextureWrapMode.Repeat : TextureWrapMode.Clamp;
|
texture.wrapMode = wrap ? TextureWrapMode.Repeat : TextureWrapMode.Clamp;
|
||||||
texture.LoadImage(data);
|
texture.LoadImage(data);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user