Nullable fixes, use Texture2d resource for rendering directly.

This commit is contained in:
2024-01-21 17:34:49 +01:00
parent cfbf46860d
commit 5f4e32e2e0
10 changed files with 105 additions and 74 deletions

View File

@@ -5,7 +5,7 @@ public class Font : Resource
/// <summary>
/// Internal handle for the font. If it got successfully loaded into the GPU, the value will be other than -1.
/// </summary>
internal int FontHandle { get; set; } = -1;
internal int Handle { get; set; } = -1;
public int Size { get; set; } = 16;
public Font(string path, byte[] buffer) : base(path, buffer)
{

View File

@@ -2,10 +2,43 @@ namespace DaggerFramework
{
public class Texture2d : Resource
{
/// <summary>
/// Internal handle for the texture. If it got successfully loaded into the GPU, the value will be other than -1.
/// </summary>
internal int Handle { get; set; } = -1;
public int Width { get; set; }
public int Height { get; set; }
public int Mipmaps { get; set; } = 1;
public TextureFormat Format { get; set; } = TextureFormat.UncompressedR8G8B8A8;
public Texture2d(string path, byte[] buffer) : base(path, buffer)
{
}
public static Texture2d Empty => new Texture2d(string.Empty, new byte[] { });
}
public enum TextureFormat
{
UncompressedGrayscale = 1,
UncompressedGrayAlpha,
UncompressedR5G6B5,
UncompressedR8G8B8,
UncompressedR5G5B5A1,
UncompressedR4G4B4A4,
UncompressedR8G8B8A8,
UncompressedR32,
UncompressedR32G32B32,
UncompressedR32G32B32A32,
CompressedDXT1Rgb,
CompressedDXT1Rgba,
CompressedDXT3Rgba,
CompressedDXT5Rgba,
CompressedETC1Rgb,
CompressedETC2Rgb,
CompressedETC2EACRgba,
CompressedPVRTRgb,
CompressedPVRTRgba,
CompressedASTC4x4Rgba,
CompressedASTC8x8Rgba
}
}