Replaced IntX by intX, Basic AssetViewer (can view Textures, kind of)

This commit is contained in:
Simon Lübeß
2023-07-01 00:15:01 +02:00
parent e12fcaacff
commit 77c45db122
37 changed files with 1299 additions and 1688 deletions
@@ -53,4 +53,57 @@ namespace GlitchyEngine.Renderer
RenderCommand.DrawIndexed(s_fullscreenQuadGeometry);
}
}
static class Quad
{
static GeometryBinding s_quadGeometry;
public static void Init()
{
s_quadGeometry = new GeometryBinding();
s_quadGeometry.SetPrimitiveTopology(.TriangleList);
using(var quadVertices = new VertexBuffer(typeof(float4), 4, .Immutable))
{
float4[4] vertices = .(
.(-0.5f,-0.5f, 0, 1),
.(-0.5f, 0.5f, 0, 0),
.( 0.5f, 0.5f, 1, 0),
.( 0.5f,-0.5f, 1, 1)
);
quadVertices.SetData(vertices);
s_quadGeometry.SetVertexBufferSlot(quadVertices, 0);
}
using(var quadIndices = new IndexBuffer(6, .Immutable))
{
uint16[6] indices = .(0, 1, 2, 2, 3, 0);
quadIndices.SetData(indices);
s_quadGeometry.SetIndexBuffer(quadIndices);
}
VertexElement[] vertexElements = new .(
VertexElement(.R32G32_Float, "POSITION"),
VertexElement(.R32G32_Float, "TEXCOORD")
);
using (var quadBatchLayout = new VertexLayout(vertexElements, true))
{
s_quadGeometry.SetVertexLayout(quadBatchLayout);
}
}
public static void Deinit()
{
s_quadGeometry.ReleaseRef();
}
public static void Draw()
{
s_quadGeometry.Bind();
RenderCommand.DrawIndexed(s_quadGeometry);
}
}
}