Added Vertexcount to GeometryBinding and made Indexbuffer optional

This commit is contained in:
Simon Lübeß
2021-08-25 22:39:11 +02:00
parent a8bef51834
commit 099763e1e3
3 changed files with 19 additions and 4 deletions
@@ -81,8 +81,9 @@ namespace GlitchyEngine.Renderer
context.nativeContext.InputAssembler.SetVertexBuffers(0, nativeBuffers.Count, &nativeBuffers, &bufferStrides, &bufferOffsets);
context.nativeContext.InputAssembler.SetInputLayout(_vertexLayout.nativeLayout);
context.nativeContext.InputAssembler.SetPrimitiveTopology((.)_primitiveTopology);
context.nativeContext.InputAssembler.SetIndexBuffer(_indexBuffer.nativeBuffer, _indexBuffer.Format == .Index32Bit ? .R32_UInt : .R16_UInt, _indexByteOffset);
if(_indexBuffer != null)
context.nativeContext.InputAssembler.SetIndexBuffer(_indexBuffer.nativeBuffer, _indexBuffer.Format == .Index32Bit ? .R32_UInt : .R16_UInt, _indexByteOffset);
}
public void Unbind(GraphicsContext context = null)
@@ -32,10 +32,13 @@ namespace GlitchyEngine.Renderer
{
_context.nativeContext.ClearDepthStencilView(target.nativeView, (.)clearFlags, depthValue, stencilValue);
}
public override void DrawIndexed(GeometryBinding geometry)
{
_context.DrawIndexed(geometry.IndexCount, geometry.IndexByteOffset, 0);
if(geometry.IsIndexed)
_context.DrawIndexed(geometry.IndexCount, geometry.IndexByteOffset, 0);
else
_context.Draw(geometry.VertexCount, 0);
}
public override void DrawIndexedInstanced(GeometryBinding geometry)