MoonWorks/src/Graphics/State/DepthStencilState.cs

80 lines
2.4 KiB
C#
Raw Normal View History

namespace MoonWorks.Graphics
{
2021-02-24 20:43:35 +00:00
/// <summary>
/// Determines how data is written to and read from the depth/stencil buffer.
/// </summary>
public struct DepthStencilState
{
2021-02-24 20:43:35 +00:00
/// <summary>
/// If disabled, no depth culling will occur.
/// </summary>
public bool DepthTestEnable;
2021-02-24 20:43:35 +00:00
/// <summary>
/// Describes the stencil operation for back-facing primitives.
/// </summary>
public StencilOpState BackStencilState;
2021-02-24 20:43:35 +00:00
/// <summary>
/// Describes the stencil operation for front-facing primitives.
/// </summary>
public StencilOpState FrontStencilState;
2021-02-24 20:43:35 +00:00
/// <summary>
/// The comparison operator used in the depth test.
/// </summary>
public CompareOp CompareOp;
2021-02-24 20:43:35 +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
/// <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
/// <summary>
/// The minimum depth value in the depth bounds test.
/// </summary>
public float MinDepthBounds;
2021-02-24 20:43:35 +00:00
/// <summary>
/// The maximum depth value in the depth bounds test.
/// </summary>
public float MaxDepthBounds;
2021-02-24 20:43:35 +00:00
/// <summary>
/// If disabled, no stencil culling will occur.
/// </summary>
public bool StencilTestEnable;
public static readonly DepthStencilState DepthReadWrite = new DepthStencilState
{
DepthTestEnable = true,
DepthWriteEnable = true,
DepthBoundsTestEnable = false,
StencilTestEnable = false,
CompareOp = CompareOp.LessOrEqual
};
public static readonly DepthStencilState DepthRead = new DepthStencilState
{
DepthTestEnable = true,
DepthWriteEnable = false,
DepthBoundsTestEnable = false,
StencilTestEnable = false,
CompareOp = CompareOp.LessOrEqual
};
public static readonly DepthStencilState Disable = new DepthStencilState
{
DepthTestEnable = false,
DepthWriteEnable = false,
DepthBoundsTestEnable = false,
StencilTestEnable = false
};
}
}