This commit is contained in:
2024-12-09 13:56:18 +03:00
parent bd156ad028
commit ddc91e0bfa
22 changed files with 235 additions and 58 deletions

View File

@@ -3,20 +3,21 @@ using Engine.Renderer.Pixel;
namespace Engine.Renderer.Texture;
public interface ITexture<T> : IConstTexture<T> where T : struct, IPixel
public interface ITexture : IConstTexture
{
public void UploadPixels(int x, int y, int width, int height, T[,] pixels);
public void UploadPixels<T>(int x, int y, int width, int height, T[,] pixels)
where T : struct, IPixel;
}
public static class TextureExtensions
{
public static void UploadPixels<T>(this ITexture<T> texture, Image<T> image) where T : struct, IPixel
public static void UploadPixels<T>(this ITexture texture, Image<T> image) where T : struct, IPixel
=> texture.UploadPixels(0, 0, image);
public static void UploadPixels<T>(this ITexture<T> texture, int x, int y, Image<T> image)
public static void UploadPixels<T>(this ITexture texture, int x, int y, Image<T> image)
where T : struct, IPixel =>
texture.UploadPixels(x, y, image.Width, image.Height, image.Pixels);
public static void UploadPixels<T>(this ITexture<T> texture, T[,] pixels) where T : struct, IPixel
public static void UploadPixels<T>(this ITexture texture, T[,] pixels) where T : struct, IPixel
=> texture.UploadPixels(0, 0, texture.Width, texture.Height, pixels);
}