Refactor ResourceLoader, use only Texture2d in Renderer.

This commit is contained in:
2023-06-14 23:48:26 +02:00
parent fdbd21f248
commit 06da2c3f7f
20 changed files with 128 additions and 158 deletions

View File

@@ -0,0 +1,22 @@
using StbImageSharp;
namespace DaggerFramework
{
public class Texture2dLoader : ResourceLoader<Texture2d>
{
public override Texture2d Load(string path)
{
ImageResult image;
using (var stream = File.OpenRead(path))
{
image = ImageResult.FromStream(stream, ColorComponents.RedGreenBlueAlpha);
}
Texture2d result = new Texture2d(path, image.Data);
result.Width = image.Width;
result.Height = image.Height;
return result;
}
}
}