mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added Vertexcount to GeometryBinding and made Indexbuffer optional
This commit is contained in:
@@ -81,8 +81,9 @@ namespace GlitchyEngine.Renderer
|
|||||||
context.nativeContext.InputAssembler.SetVertexBuffers(0, nativeBuffers.Count, &nativeBuffers, &bufferStrides, &bufferOffsets);
|
context.nativeContext.InputAssembler.SetVertexBuffers(0, nativeBuffers.Count, &nativeBuffers, &bufferStrides, &bufferOffsets);
|
||||||
context.nativeContext.InputAssembler.SetInputLayout(_vertexLayout.nativeLayout);
|
context.nativeContext.InputAssembler.SetInputLayout(_vertexLayout.nativeLayout);
|
||||||
context.nativeContext.InputAssembler.SetPrimitiveTopology((.)_primitiveTopology);
|
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)
|
public void Unbind(GraphicsContext context = null)
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ namespace GlitchyEngine.Renderer
|
|||||||
{
|
{
|
||||||
_context.nativeContext.ClearDepthStencilView(target.nativeView, (.)clearFlags, depthValue, stencilValue);
|
_context.nativeContext.ClearDepthStencilView(target.nativeView, (.)clearFlags, depthValue, stencilValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawIndexed(GeometryBinding geometry)
|
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)
|
public override void DrawIndexedInstanced(GeometryBinding geometry)
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace GlitchyEngine.Renderer
|
|||||||
internal uint32 _indexCount;
|
internal uint32 _indexCount;
|
||||||
internal uint32 _instanceCount;
|
internal uint32 _instanceCount;
|
||||||
internal PrimitiveTopology _primitiveTopology;
|
internal PrimitiveTopology _primitiveTopology;
|
||||||
|
internal uint32 _vertexCount;
|
||||||
|
|
||||||
|
public bool IsIndexed => _indexBuffer != null;
|
||||||
|
|
||||||
public this(GraphicsContext context)
|
public this(GraphicsContext context)
|
||||||
{
|
{
|
||||||
@@ -57,6 +60,14 @@ namespace GlitchyEngine.Renderer
|
|||||||
set => _instanceCount = value;
|
set => _instanceCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint32 VertexCount
|
||||||
|
{
|
||||||
|
[Inline]
|
||||||
|
get => _vertexCount;
|
||||||
|
[Inline]
|
||||||
|
set => _vertexCount = value;
|
||||||
|
}
|
||||||
|
|
||||||
[Inline]
|
[Inline]
|
||||||
public PrimitiveTopology PrimitiveTopology => _primitiveTopology;
|
public PrimitiveTopology PrimitiveTopology => _primitiveTopology;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user