diff --git a/project/code/TMV/TextureLoader.Gif.cs b/project/code/TMV/TextureLoader.Gif.cs index 6cacf04..90c6666 100644 --- a/project/code/TMV/TextureLoader.Gif.cs +++ b/project/code/TMV/TextureLoader.Gif.cs @@ -7,12 +7,12 @@ public partial class TextureLoader { // References: // - https://www.w3.org/Graphics/GIF/spec-gif89a.txt - private static ImageTexture LoadGif(string path) + private static Image LoadGif(string path) { var gif = new GifDecoder(path); var gifImage = gif.GetImage(0); var bytes = gifImage.GetRgbaBytes(); var image = Image.CreateFromData(gifImage.Width, gifImage.Height, false, Image.Format.Rgba8, bytes); - return ImageTexture.CreateFromImage(image); + return image; } } \ No newline at end of file diff --git a/project/code/TMV/TextureLoader.Pcx.cs b/project/code/TMV/TextureLoader.Pcx.cs index abcc84f..a256399 100644 --- a/project/code/TMV/TextureLoader.Pcx.cs +++ b/project/code/TMV/TextureLoader.Pcx.cs @@ -12,7 +12,7 @@ public partial class TextureLoader // References: // - https://www.fileformat.info/format/pcx/egff.htm // - http://www.fysnet.net/pcxfile.htm - private static ImageTexture LoadPcx(string path) + private static Image LoadPcx(string path) { static Color[] LoadFamilyPalette(string famPath) { @@ -119,6 +119,6 @@ public partial class TextureLoader } } - return ImageTexture.CreateFromImage(image); + return image; } } \ No newline at end of file diff --git a/project/code/TMV/TextureLoader.cs b/project/code/TMV/TextureLoader.cs index 080b299..7327060 100644 --- a/project/code/TMV/TextureLoader.cs +++ b/project/code/TMV/TextureLoader.cs @@ -60,13 +60,14 @@ public partial class TextureLoader string[] validExtensions = { "png", "tga", "pcx", "gif" }; if (validExtensions.Contains(ext)) { - var texture = ext switch + var image = ext switch { "pcx" => LoadPcx(path), "gif" => LoadGif(path), - _ => ImageTexture.CreateFromImage(Image.LoadFromFile(path)), + _ => Image.LoadFromFile(path), }; - return texture; + image.GenerateMipmaps(); + return ImageTexture.CreateFromImage(image); } return null; }