Added rudimentary DepthStencilTarget

This commit is contained in:
Simon Lübeß
2021-05-30 19:49:10 +02:00
parent 562f4855bd
commit bf94f10a64
6 changed files with 98 additions and 2 deletions
@@ -0,0 +1,29 @@
using System;
namespace GlitchyEngine.Renderer
{
// TODO: add all features.
public class DepthStencilTarget : RefCounted
{
protected internal GraphicsContext _context ~ _?.ReleaseRef();
protected uint32 _width, _height;
public uint32 Width => _width;
public uint32 Height => _height;
public this(GraphicsContext context, uint32 width, uint32 height)
{
_context = context..AddRef();
_width = width;
_height = height;
PlatformCreate();
}
protected extern void PlatformCreate();
public extern void Bind();
public extern void Clear(float depthValue, uint8 stencilValue, DepthStencilClearFlag clearFlags);
}
}
@@ -3,6 +3,13 @@ using GlitchyEngine.Math;
namespace GlitchyEngine.Renderer
{
public enum DepthStencilClearFlag
{
None = 0,
Depth = 1,
Stencil = 2
}
public static class RenderCommand
{
private static RendererAPI _rendererAPI;
@@ -24,6 +31,13 @@ namespace GlitchyEngine.Renderer
{
_rendererAPI.Clear(renderTarget, color);
}
[Inline]
public static void Clear(DepthStencilTarget target, float depthValue, uint8 stencilValue, DepthStencilClearFlag clearFlags)
{
_rendererAPI.Clear(target, depthValue, stencilValue, clearFlags);
}
[Inline]
public static void DrawIndexed(GeometryBinding geometry)
@@ -19,6 +19,8 @@ namespace GlitchyEngine.Renderer
public extern void Clear(RenderTarget renderTarget, ColorRGBA clearColor);
public extern void Clear(DepthStencilTarget target, float depthValue, uint8 stencilValue, DepthStencilClearFlag clearFlags);
public extern void DrawIndexed(GeometryBinding geometry);
public extern void DrawInstanced(GeometryBinding geometry);