Campari/src/TextureSlice.cs

52 lines
1.3 KiB
C#
Raw Normal View History

2021-01-15 01:25:15 +00:00
using RefreshCS;
namespace Campari
2021-01-14 10:50:02 +00:00
{
public struct TextureSlice
{
public Texture Texture { get; }
2021-01-15 01:25:15 +00:00
public Refresh.Rect Rectangle { get; }
2021-01-14 10:50:02 +00:00
public uint Depth { get; }
public uint Layer { get; }
public uint Level { get; }
public TextureSlice(Texture texture)
{
Texture = texture;
2021-01-15 01:25:15 +00:00
Rectangle = new Refresh.Rect
{
x = 0,
y = 0,
w = (int) texture.Width,
h = (int) texture.Height
};
2021-01-14 10:50:02 +00:00
Depth = 0;
Layer = 0;
Level = 0;
}
2021-01-15 01:25:15 +00:00
public TextureSlice(Texture texture, Refresh.Rect rectangle, uint depth = 0, uint layer = 0, uint level = 0)
2021-01-14 10:50:02 +00:00
{
Texture = texture;
Rectangle = rectangle;
Depth = depth;
Layer = layer;
Level = level;
}
public RefreshCS.Refresh.TextureSlice ToRefreshTextureSlice()
{
RefreshCS.Refresh.TextureSlice textureSlice = new RefreshCS.Refresh.TextureSlice
{
texture = Texture.Handle,
2021-01-15 01:25:15 +00:00
rectangle = Rectangle,
2021-01-14 10:50:02 +00:00
depth = Depth,
layer = Layer,
level = Level
};
return textureSlice;
}
}
}