MoonWorks/src/Graphics/State/DepthStencilState.cs

95 lines
2.3 KiB
C#
Raw Normal View History

2022-02-23 05:14:32 +00:00
namespace MoonWorks.Graphics
{
2022-02-23 05:14:32 +00:00
/// <summary>
/// Determines how data is written to and read from the depth/stencil buffer.
/// </summary>
public struct DepthStencilState
{
/// <summary>
/// If disabled, no depth culling will occur.
/// </summary>
public bool DepthTestEnable;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
2024-03-03 07:10:44 +00:00
/// Describes the back-face stencil operation.
2022-02-23 05:14:32 +00:00
/// </summary>
2024-03-03 07:10:44 +00:00
public StencilOpState BackStencilState;
/// <summary>
/// Describes the front-face stencil operation.
/// </summary>
public StencilOpState FrontStencilState;
/// <summary>
/// The compare mask for stencil ops.
/// </summary>
public uint CompareMask;
/// <summary>
/// The write mask for stencil ops.
/// </summary>
public uint WriteMask;
/// <summary>
/// The stencil reference value.
/// </summary>
public uint Reference;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
/// The comparison operator used in the depth test.
/// </summary>
public CompareOp CompareOp;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
/// If depth lies outside of these bounds the pixel will be culled.
/// </summary>
public bool DepthBoundsTestEnable;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
/// Specifies whether depth values will be written to the buffer during rendering.
/// </summary>
public bool DepthWriteEnable;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
/// The minimum depth value in the depth bounds test.
/// </summary>
public float MinDepthBounds;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
/// The maximum depth value in the depth bounds test.
/// </summary>
public float MaxDepthBounds;
2021-02-24 20:43:35 +00:00
2022-02-23 05:14:32 +00:00
/// <summary>
/// If disabled, no stencil culling will occur.
/// </summary>
public bool StencilTestEnable;
2022-02-23 05:14:32 +00:00
public static readonly DepthStencilState DepthReadWrite = new DepthStencilState
{
DepthTestEnable = true,
DepthWriteEnable = true,
DepthBoundsTestEnable = false,
StencilTestEnable = false,
CompareOp = CompareOp.LessOrEqual
};
2022-02-23 05:14:32 +00:00
public static readonly DepthStencilState DepthRead = new DepthStencilState
{
DepthTestEnable = true,
DepthWriteEnable = false,
DepthBoundsTestEnable = false,
StencilTestEnable = false,
CompareOp = CompareOp.LessOrEqual
};
2022-02-23 05:14:32 +00:00
public static readonly DepthStencilState Disable = new DepthStencilState
{
DepthTestEnable = false,
DepthWriteEnable = false,
DepthBoundsTestEnable = false,
StencilTestEnable = false
};
}
}