2022-02-23 05:14:32 +00:00
|
|
|
|
namespace MoonWorks.Graphics
|
2021-01-20 03:33:27 +00:00
|
|
|
|
{
|
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>
|
|
|
|
|
/// Describes the stencil operation for back-facing primitives.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public StencilOpState BackStencilState;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Describes the stencil operation for front-facing primitives.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public StencilOpState FrontStencilState;
|
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;
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
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
|
|
|
|
|
};
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
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
|
|
|
|
|
};
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly DepthStencilState Disable = new DepthStencilState
|
|
|
|
|
{
|
|
|
|
|
DepthTestEnable = false,
|
|
|
|
|
DepthWriteEnable = false,
|
|
|
|
|
DepthBoundsTestEnable = false,
|
|
|
|
|
StencilTestEnable = false
|
|
|
|
|
};
|
|
|
|
|
}
|
2021-01-20 03:33:27 +00:00
|
|
|
|
}
|