mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-06 05:01:53 +00:00
Added basic support for instanced rendering
This commit is contained in:
@@ -12,6 +12,7 @@ namespace GlitchyEngine.Renderer
|
||||
internal VertexLayout _vertexLayout;
|
||||
internal uint32 _indexByteOffset;
|
||||
internal uint32 _indexCount;
|
||||
internal uint32 _instanceCount;
|
||||
internal PrimitiveTopology _primitiveTopology;
|
||||
|
||||
public this(GraphicsContext context)
|
||||
@@ -50,6 +51,14 @@ namespace GlitchyEngine.Renderer
|
||||
[Inline]
|
||||
public uint32 IndexCount => _indexCount;
|
||||
|
||||
public uint32 InstanceCount
|
||||
{
|
||||
[Inline]
|
||||
get => _instanceCount;
|
||||
[Inline]
|
||||
set => _instanceCount = value;
|
||||
}
|
||||
|
||||
[Inline]
|
||||
public PrimitiveTopology PrimitiveTopology => _primitiveTopology;
|
||||
|
||||
|
||||
@@ -30,5 +30,11 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
_rendererAPI.DrawIndexed(geometry);
|
||||
}
|
||||
|
||||
[Inline]
|
||||
public static void DrawIndexedInstanced(GeometryBinding geometry)
|
||||
{
|
||||
_rendererAPI.DrawIndexedInstanced(geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,9 @@ namespace GlitchyEngine.Renderer
|
||||
public extern void Clear(RenderTarget renderTarget, ColorRGBA clearColor);
|
||||
|
||||
public extern void DrawIndexed(GeometryBinding geometry);
|
||||
|
||||
public extern void DrawInstanced(GeometryBinding geometry);
|
||||
|
||||
public extern void DrawIndexedInstanced(GeometryBinding geometry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ namespace GlitchyEngine.Renderer
|
||||
_vertexType = vertexType;
|
||||
|
||||
_description = .(){
|
||||
Size = ((uint32)_vertexType.Size * vertexCount),
|
||||
Size = ((uint32)_vertexType.Stride * vertexCount),
|
||||
Usage = usage,
|
||||
CPUAccess = cpuAccess,
|
||||
BindFlags = .Vertex,
|
||||
MiscFlags = .None
|
||||
};
|
||||
|
||||
_defaultBinding = .(this, (.)_vertexType.Size, 0);
|
||||
_defaultBinding = .(this, (.)_vertexType.Stride, 0);
|
||||
}
|
||||
|
||||
[Inline]
|
||||
|
||||
Reference in New Issue
Block a user